[mythtv] [PATCH] mythvideo - category, country and genre
MaxPower
maxpower44 at tiscali.fr
Mon Feb 9 05:25:26 EST 2004
What about my patch ?
anybody would like try it ?
any feedback ?
Xavier Hervy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch_video_category_genres_countries.diff.gz
Type: application/gzip
Size: 10388 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20040209/3c1005a9/patch_video_category_genres_countries.diff.bin
-------------- next part --------------
--- /usr/local/src/scripts/imdb.pl 2004-01-29 07:58:05.000000000 +0100
+++ /mnt/maxpower/divers/scripts/imdb.pl 2004-02-07 12:45:02.000000000 +0100
@@ -153,6 +153,57 @@
}
$cast = join(',', @actors);
}
+
+
+ # parse genres
+ my @genres;
+ my $lgenres = "";
+ $count = 0;
+ $data = parseBetween($response, "<b class=\"ch\">Genre:</b>","<a href=\"keywords\">(more)</a>");
+ if ($data) {
+ my $beg = "/\">";
+ my $end = "</a>";
+ my $start = index($data, $beg);
+ my $finish = index($data, $end, $start);
+ my $genre;
+ while ($start != -1) {
+ $start += length($beg);
+ $genre = substr($data, $start, $finish - $start);
+ # add to array
+ $genres[$count++] = $genre;
+
+ # advance data to next movie
+ $data = substr($data, - (length($data) - $finish));
+ $start = index($data, $beg);
+ $finish = index($data, $end, $start + 1);
+ }
+ $lgenres = join(',', @genres);
+ }
+
+ # parse countries
+ my @countries;
+ my $lcountries = "";
+ $count = 0;
+ $data = parseBetween($response, "<b class=\"ch\">Country:</b>","<br>");
+ if ($data) {
+ my $beg = "/\">";
+ my $end = "</a>";
+ my $start = index($data, $beg);
+ my $finish = index($data, $end, $start);
+ my $country;
+ while ($start != -1) {
+ $start += length($beg);
+ $country = substr($data, $start, $finish - $start);
+ # add to array
+ $countries[$count++] = $country;
+
+ # advance data to next movie
+ $data = substr($data, - (length($data) - $finish));
+ $start = index($data, $beg);
+ $finish = index($data, $end, $start + 1);
+ }
+ $lcountries = join(',', @countries);
+ }
# output fields (these field names must match what MythVideo is looking for)
print "Title:$title\n";
@@ -164,6 +215,8 @@
print "Runtime:$runtime\n";
print "Writers: $writer\n";
print "Cast: $cast\n";
+ print "Genres: $lgenres\n";
+ print "Countries: $lcountries\n";
}
# dump Movie Poster
More information about the mythtv-dev
mailing list