Ticket #4180: imdbpatch.patch

File imdbpatch.patch, 1.9 KB (added by robert.mcnamara@…, 16 years ago)

Patch to add automatic Parental Levels.

  • mythvideo/mythvideo/scripts/imdb.pl

     
    201201       $movierating = parseBetween($movierating, ">", "<");
    202202   }
    203203
     204   # Convert MPAA Rating into Parental Rating
     205   my $parentalrating;
     206   if ($movierating =~ m/USA:G|Rated G/i) {
     207       $parentalrating = "0"
     208       }
     209   elsif ($movierating =~ m/USA:PG-13|Rated PG-13|Rated PG13/i) {
     210       $parentalrating = "2"
     211       }
     212   elsif ($movierating =~ m/USA:PG|Rated PG/i) {
     213       $parentalrating = "1"
     214       }
     215   elsif ($movierating =~ m/USA:R|Rated R/i) {
     216       $parentalrating = "3"
     217       }
     218   elsif ($movierating =~ m/USA:NC-17|Rated NC-17|Rated NC17/i) {
     219       $parentalrating = "4"
     220       }
     221   elsif ($movierating =~ m/USA:X|Rated X/i) {
     222       $parentalrating = "4"
     223       }
     224   else
     225       {
     226       $parentalrating = "0"
     227       } 
     228
    204229   # parse movie length
    205230   my $rawruntime = trim(parseBetween($response, ">Runtime:</h5>", "</div>"));
    206231   my $runtime = trim(parseBetween($rawruntime, "", " min"));
     
    246271   print "Cast: $cast\n";
    247272   print "Genres: $lgenres\n";
    248273   print "Countries: $lcountries\n";
     274   print "ParentalRating: $parentalrating\n";
    249275}
    250276
    251277# dump Movie Poster
  • mythvideo/mythvideo/videomanager.cpp

     
    643643        curitem->setUserRating(data["UserRating"].toFloat());
    644644        curitem->setRating(data["MovieRating"]);
    645645        curitem->setLength(data["Runtime"].toInt());
     646        curitem->setShowLevel(ParentalLevel::Level (data["ParentalRating"].toInt()));
    646647
    647648        //movieGenres
    648649        Metadata::genre_list movie_genres;