[mythtv] mythvideo - category, country and genre
MaxPower
maxpower44 at tiscali.fr
Sat Feb 7 07:08:28 EST 2004
hi,
I send a new version of my patch that support the new "abstract IMDB
queries into external scripts" feature.
imdb.pl.diff is a patch to allow grabbing information about country and
genres from imdb
the seconde file is the patch for mythvideo.
I have replace <NULL> value by Unknown.
I hope that's my patch will be apply this time.
thx
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/20040207/9dfcce01/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