script to sort on MPAA ratings

Come up with a useful post-processing script? Share it here!
Post Reply
sickboy007
Newbie
Newbie
Posts: 2
Joined: April 15th, 2012, 3:59 pm

script to sort on MPAA ratings

Post by sickboy007 »

I want to create a script (Windows) to sort downloaded movies into folders by their MPAA rating. Currently I download into a temporary download/complete/ folder and manually sort into other folders. Folders are setup as follows:

V:/Movies-G-PG/
W:/Movies-PG-13/
X:/Movies-R/

Does anyone have anything similar that they could share? Or can someone point me in the right direction on how to proceed with writing this script?
User avatar
sander
Release Testers
Release Testers
Posts: 8811
Joined: January 22nd, 2008, 2:22 pm

Re: script to sort on MPAA ratings

Post by sander »

I don't use MPAA ratings and I don't use Windows, so I haven't got a complete script for you. However, the following might get you started.

I think the essential step is to find the rating of a specific movie. As a prototype, I made a one-liner on Linux, that reports the rating. See examples below:

Code: Select all

sander@R540:~$ lynx --dump 'https://www.google.nl/search?q=the+dark+knight%3Aimdb.com+parentalguide' | grep -i www.imdb.com | head -1 | awk '{ print "lynx --dump " $1 " | grep Rated" }'  | /bin/sh

   Rated PG-13 for intense sequences of violence and some menace


sander@R540:~$ lynx --dump 'https://www.google.nl/search?q=the+hunger+games+site%3Aimdb.com+parentalguide' | grep -i www.imdb.com | head -1 | awk '{ print "lynx --dump " $1 " | grep Rated" }'  | /bin/sh

   Rated PG-13 for intense violent thematic material and disturbing images


sander@R540:~$ lynx --dump 'https://www.google.nl/search?q=The+Girl+with+the+Dragon+Tattoo+site%3Aimdb.com+parentalguide' | grep -i www.imdb.com | head -1 | awk '{ print "lynx --dump " $1 " | grep Rated" }'  | /bin/sh

   Rated R for brutal violent content including rape and torture, strong


sander@R540:~$ lynx --dump 'https://www.google.nl/search?q=101+dalmatians+site%3Aimdb.com+parentalguide' | grep -i www.imdb.com | head -1 | awk '{ print "lynx --dump " $1 " | grep Rated" }'  | /bin/sh


So, in the above you see 4 queries for 4 different movies. You can see the name of the movie in the google search and you can the Rating found. The fourth movie (101 dalmations) has no rating. Is that correct?

Explanation of the one-liner:
First it does a search on google for the movie, asking for only links on imdb.com with those movie words and including the word "parentalguide". Then it extracts only lines with http://www.imdb.com in them. It then picks the first line. It uses the URL in that line to get that page, and only find the line with "Rated" in it.

If you understand and like the above, the next question is how to get the movie name from your download. It could be in the directory or file name, but extra's like "DVDR", "Promo_XVID", "Season 01" or "subtitles included" have to be excluded from the first Google search. Or maybe your directory are more clean by themselves, and can be punt into the Google search without any stripping?
sickboy007
Newbie
Newbie
Posts: 2
Joined: April 15th, 2012, 3:59 pm

Re: script to sort on MPAA ratings

Post by sickboy007 »

Thank you. This is a great help. I will let you know how it end out.
martinkouwen
Newbie
Newbie
Posts: 1
Joined: December 20th, 2014, 7:33 am

Re: script to sort on MPAA ratings

Post by martinkouwen »

topie
Post Reply