Page 1 of 1

script to sort on MPAA ratings

Posted: April 15th, 2012, 4:13 pm
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?

Re: script to sort on MPAA ratings

Posted: April 16th, 2012, 6:42 am
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?

Re: script to sort on MPAA ratings

Posted: April 16th, 2012, 9:57 pm
by sickboy007
Thank you. This is a great help. I will let you know how it end out.

Re: script to sort on MPAA ratings

Posted: December 20th, 2014, 8:57 pm
by martinkouwen
topie