<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Better Programming &#187; imdbpy</title>
	<atom:link href="http://www.betterprogramming.com/tag/imdbpy/feed" rel="self" type="application/rss+xml" />
	<link>http://www.betterprogramming.com</link>
	<description>Portfolio</description>
	<lastBuildDate>Thu, 18 May 2017 14:50:57 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.1</generator>
	<item>
		<title>Filter your video collection with Python and IMDbPY</title>
		<link>http://www.betterprogramming.com/filter-your-video-collection-with-python-and-imdbpy.html</link>
		<comments>http://www.betterprogramming.com/filter-your-video-collection-with-python-and-imdbpy.html#comments</comments>
		<pubDate>Mon, 23 Aug 2010 18:31:05 +0000</pubDate>
		<dc:creator><![CDATA[Florentin]]></dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[imdb]]></category>
		<category><![CDATA[imdbpy]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[movies]]></category>

		<guid isPermaLink="false">http://www.betterprogramming.com/?p=186</guid>
		<description><![CDATA[If you have a large collection of movies (documentaries, dvd rips, etc) and you would like to decide on what worth watching next, this script may come in handy. It&#8217;s a small Python script which scans your movie collection, collects data about each one from imdb.com and allows you to filter the movies by genres, [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>If you have a large collection of movies (documentaries, dvd rips, etc) and you would like to decide on what worth watching next, this script may come in handy.<br />
It&#8217;s a small Python script which scans your movie collection, collects data about each one from imdb.com and allows you to filter the movies by genres, actors or publishing studio.</p>
<p>The movies are collected from subdirectories (of indefinite depth) of a single parent directory which is either the default path (defined in the DEFAULT_MOVIES_PATH variable inside the script) or specified by the &#8220;-p&#8221; (or &#8211;path) parameter.<br />
movies.py is looking for directories which contain at least one movie file (a file having the extension .avi, .mkv or .mpeg) The name of the movie is extracted from the directory name, not the file name.</p>
<p>Examples:<br />
├── temp<br />
│   ├── Capitalism.A.Love.Story<br />
│   │   └── cd1<br />
│   │       └── movie.avi<br />
│   ├── Home.tt1014762<br />
│   │   ├── imdb.html<br />
│   │   ├── imdb.info<br />
│   │   └── movie.dvdrip.avi<br />
│   ├── Religuous.tt0815241<br />
│   │   ├── imdb.html<br />
│   │   ├── imdb.info<br />
│   │   └── moviefile.avi<br />
│   ├── stuff<br />
│   │   └── nothinghere.txt<br />
│   └── Tapped.tt1344784<br />
│       ├── file.avi<br />
│       ├── imdb.html<br />
│       └── imdb.info</p>
<p>movies.py -p temp will identify the following directories as movies: &#8220;Home.tt1014762&#8243;, &#8220;Religuous.tt0815241&#8243;, Tapped.tt1344784 and &#8220;Cd1&#8243;<br />
&#8220;Cd1&#8243; is only a subdirectory but is seen as a movie because there is one movie file inside it.<br />
You will have to move the movie.avi file from inside &#8220;Cd1&#8243; to it&#8217;s parent, so that &#8220;Capitalism.A.Love.Story&#8221; will be recognized as a movie name.<br />
If your movie is not properly identified on imdb, you may rename the directory and add the imdb movie id to it, e.g., &#8220;Capitalism.A.Love.Story.tt1232207&#8243; or &#8220;Capitalism.A.Love.Story.1232207&#8243;</p>
<p>In order to use movies.py, you will need a couple of things:<br />
1. Python 2.6 on a Linux machine (I have Ubuntu 10.04)<br />
2. imdbpy library available<br />
sudo pip install imdbpy<br />
OR<br />
sudo easy_install imdbpy<br />
3. prettytable library<br />
sudo pip install prettytable<br />
OR<br />
sudo easy_install prettytable</p>
<p>Download the script on your machine and execute:<br />
# A) this will make your script executable<br />
chmod +x yourusername<br />
# B1) use an alias to run the &#8216;movies&#8217; script from anywhere<br />
alias movies=&#8221;/your/path/to/movies.py&#8221;<br />
# B2) alternatively, you can make use of symbolic links<br />
sudo ln -s /your/path/to/movies.py /usr/local/bin/movies.py</p>
<p>Examples of how to use the script, in case you have put movies.py somewhere in your PATH (method B2)</p>
<p>scan and refresh movies from inside the path &#8220;/home/elmo/Movies&#8221;. In case you don&#8217;t use &#8220;-p&#8221;, the default path is stored in the script variable DEFAULT_MOVIES_PATH (defined inside the script code)<br />
movies.py -p &#8220;/home/elmo/Movies&#8221; -s -r</p>
<p>show movies with &#8220;Andy Serkis&#8221; but not with &#8220;Brad Pitt&#8221;<br />
movies.py -l -a &#8220;+andy serkis,-brad pitt&#8221;</p>
<p>movies with at least one of these actors playing<br />
movies.py -l -a &#8220;?andy serkis,?angelina jolie&#8221;</p>
<p>movies with at least one favorite actor playing<br />
movies.py -l -o actor</p>
<p>comedy movies but no dramas<br />
movies.py -l -g &#8220;+comedy,-drama&#8221;</p>
<p>movies made by &#8220;lionsgate&#8221; production company<br />
movies.py -c &#8220;lionsgate&#8221;</p>
<p>movies made by any of the favorite production companies<br />
movies.py -o company</p>
<p>There are a couple of &#8216;predefined&#8217; filters.<br />
For example, in the script&#8217;s code you will see a large list of (good) actors. If you want to find movies where at least one favorite actor is playing, run:<br />
movies.py -o actor<br />
The same is true for production companies<br />
movies.py -o company</p>
<p>Example of output:<br />
movies.py -l -g &#8220;+documentary,-drama&#8221;<br />
+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| Imdb ID |   Movie   |       Genres       | Rate |       Basename      |<br />
+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+<br />
| 1014762 | Home      |    documentary     | 8.4  |    Home.tt1014762   |<br />
| 0815241 | Religuous | documentary,comedy | 7.8  | Religuous.tt0815241 |<br />
| 1344784 | Tapped    |    documentary     | 6.8  |   Tapped.tt1344784  |<br />
+&#8212;&#8212;&#8212;+&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;+</p>
<p>View the whole list of options using:<br />
movies.py -h<br />
OR<br />
movies.py &#8211;help</p>
<p>I hope you will enjoy the script and stay tuned for updates <img src="http://www.betterprogramming.com/wp-includes/images/smilies/icon_smile.gif" alt=":)" class="wp-smiley" /></p>
<p><a href="http://www.betterprogramming.com/downloads/movies.py">Download here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.betterprogramming.com/filter-your-video-collection-with-python-and-imdbpy.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
