<?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>correl.phoenixinquis.net</title>
	<atom:link href="http://correl.phoenixinquis.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://correl.phoenixinquis.net</link>
	<description>projects and coding adventures</description>
	<lastBuildDate>Fri, 29 Apr 2011 02:51:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Transmission, RSS and XBMC</title>
		<link>http://correl.phoenixinquis.net/2011/04/27/transmission-rss-and-xbmc/</link>
		<comments>http://correl.phoenixinquis.net/2011/04/27/transmission-rss-and-xbmc/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 22:05:07 +0000</pubDate>
		<dc:creator>Correl Roush</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[bittorrent]]></category>
		<category><![CDATA[htpc]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[transmission]]></category>
		<category><![CDATA[xbmc]]></category>

		<guid isPermaLink="false">http://trinity.phoenixinquis.net/wordpress/?p=67</guid>
		<description><![CDATA[I&#8217;m a huge fan of XBMC. My pc (currently running Ubuntu 10.04) has taken root in my living room, piping all my movies and tv shows straight to my HDTV. While my pc is set up as a DVR using &#8230;<p class="read-more"><a href="http://correl.phoenixinquis.net/2011/04/27/transmission-rss-and-xbmc/">Read more &#187;</a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a huge fan of <a href="http://www.xbmc.org/">XBMC</a>. My pc (currently running Ubuntu 10.04) has taken root in my
living room, piping all my movies and tv shows straight to my HDTV.</p>

<p>While my pc is set up as a DVR using <a href="http://www.mythtv.org">MythTV</a> to record shows off my FIOS box, it tends to be a little unreliable, which can suck when it&#8217;s time to catch up on Daily Show and Colbert episodes.
I&#8217;ve had <a href="http://www.transmissionbt.com/">Transmission</a> set up for a while for all my torrenting needs, and
I&#8217;ve even written an <a href="https://github.com/correl/Transmission-XBMC">XBMC script to manage torrents</a>, so I got to looking for
tools to track tv show torrent rss feeds.</p>

<p><span id="more-67"></span></p>

<p>My first stop was <a href="http://ted.nu/">TED</a>. TED worked well enough, but would occasionally hang.
Since it&#8217;s a GUI java app running in the taskbar, it would require me to dig
out my mouse and break out of full screen XBMC to fiddle with it. I eventually
got tired of dealing with TED and went back to prodding Myth.</p>

<p>Recently I&#8217;ve been itching to reliably watch my shows again, so I checked around
for a simple command-line utility to track rss feeds and download torrents.
Finding none, I loaded up vim and threw together a python script to handle it
all for me.</p>

<p>I also have another, simple script from when I was using TED (or just manually
downloading shows) which looks at completed torrents, compares their names with
the folders in my TV directory, and moves the shows into them for XBMC to see.</p>

<p>A couple cron jobs and a few rss feeds later, and I&#8217;ve got all my shows
automatically delivered straight to XBMC for my lazy evening viewing pleasure.</p>

<h3>trss.py</h3>

<p><a href="https://github.com/correl/trss/raw/master/trss.py">Download</a></p>



<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="txt"><pre class="de1">Usage:
    trss.py add &lt;rss-url&gt; [&lt;recent-items&gt;]
        Adds an RSS feed to follow
        rss-url:        Full URL to the RSS feed
        recent-items:   (Optional) number of recent items to queue
                        for downloading
    trss.py remove &lt;index&gt;
        Remove an RSS feed
        index:          Numeric index of the feed to remove as
                        reported by the list command
    trss.py list
        Displays a list of followed feeds
&nbsp;
    trss.py download
        Fetch all feeds and download new items
&nbsp;
    trss.py set [&lt;setting&gt; [&lt;value&gt;]]
        Set or view configuration settings
        Call without any arguments to list all settings and their values
        Call with a setting and no value to see the current value for that setting
&nbsp;
        Currently, the only used setting is 'download_dir', which allows you to set
        a directory to store all retrieved torrents, such as a directory your
        torrent application watches for new downloads. If 'download_dir' is not set,
        the current directory will be used.</pre></div></div></div></div></div></div></div>



<h3>transmission-tv.py</h3>



<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="python"><pre class="de1"><span class="co1">#!/usr/bin/python</span>
<span class="kw1">import</span> <span class="kw3">os</span>
<span class="kw1">import</span> <span class="kw3">re</span>
&nbsp;
<span class="kw1">import</span> transmissionrpc
&nbsp;
TV_PATH <span class="sy0">=</span> <span class="st0">'/media/Gaia/Video/TV/'</span>
&nbsp;
<span class="kw1">class</span> TVShowCollection:
	<span class="kw1">def</span> <span class="kw4">__init__</span><span class="br0">&#40;</span><span class="kw2">self</span><span class="sy0">,</span> path<span class="br0">&#41;</span>:
		<span class="kw2">self</span>.<span class="me1">path</span> <span class="sy0">=</span> path
		<span class="kw2">self</span>.<span class="me1">shows</span> <span class="sy0">=</span> <span class="kw3">os</span>.<span class="me1">listdir</span><span class="br0">&#40;</span>path<span class="br0">&#41;</span>
		<span class="kw2">self</span>.<span class="me1">patterns</span> <span class="sy0">=</span> <span class="br0">&#91;</span><span class="br0">&#91;</span>s.<span class="me1">lower</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">replace</span><span class="br0">&#40;</span><span class="st0">' '</span><span class="sy0">,</span> <span class="st0">'.?'</span><span class="br0">&#41;</span><span class="sy0">,</span> s<span class="br0">&#93;</span> <span class="kw1">for</span> s <span class="kw1">in</span> <span class="kw2">sorted</span><span class="br0">&#40;</span><span class="kw2">self</span>.<span class="me1">shows</span><span class="sy0">,</span> key<span class="sy0">=</span><span class="kw2">len</span><span class="sy0">,</span> reverse<span class="sy0">=</span><span class="kw2">True</span><span class="br0">&#41;</span><span class="br0">&#93;</span>
	<span class="kw1">def</span> match<span class="br0">&#40;</span><span class="kw2">self</span><span class="sy0">,</span> filename<span class="br0">&#41;</span>:
		<span class="kw1">for</span> pattern<span class="sy0">,</span> show <span class="kw1">in</span> <span class="kw2">self</span>.<span class="me1">patterns</span>:
			<span class="kw1">if</span> <span class="kw3">re</span>.<span class="me1">findall</span><span class="br0">&#40;</span>pattern<span class="sy0">,</span> filename.<span class="me1">lower</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span>:
				<span class="kw1">return</span> show
		<span class="kw1">return</span> <span class="kw2">None</span>
&nbsp;
<span class="kw1">def</span> move<span class="br0">&#40;</span><span class="kw2">self</span><span class="sy0">,</span> ids<span class="sy0">,</span> location<span class="br0">&#41;</span>:
	<span class="st0">&quot;&quot;&quot;Move torrent data to the new location.&quot;&quot;&quot;</span>
	<span class="kw2">self</span>._rpc_version_warning<span class="br0">&#40;</span><span class="nu0">6</span><span class="br0">&#41;</span>
	args <span class="sy0">=</span> <span class="br0">&#123;</span><span class="st0">'location'</span>: location<span class="sy0">,</span> <span class="st0">'move'</span>: <span class="kw2">True</span><span class="br0">&#125;</span>
	<span class="kw2">self</span>._request<span class="br0">&#40;</span><span class="st0">'torrent-set-location'</span><span class="sy0">,</span> args<span class="sy0">,</span> ids<span class="sy0">,</span> <span class="kw2">True</span><span class="br0">&#41;</span>
&nbsp;
<span class="kw1">if</span> <span class="kw2">float</span><span class="br0">&#40;</span>transmissionrpc.__version__<span class="br0">&#41;</span> <span class="sy0">&lt;</span> <span class="nu0">0.4</span>:
	<span class="co1"># The move function is not present in versions 0.3 and older</span>
	transmissionrpc.<span class="me1">Client</span>.<span class="me1">move</span> <span class="sy0">=</span> move
&nbsp;
collection <span class="sy0">=</span> TVShowCollection<span class="br0">&#40;</span>TV_PATH<span class="br0">&#41;</span>
client <span class="sy0">=</span> transmissionrpc.<span class="me1">Client</span><span class="br0">&#40;</span><span class="br0">&#41;</span>
&nbsp;
torrents <span class="sy0">=</span> client.<span class="me1">info</span><span class="br0">&#40;</span><span class="br0">&#41;</span>
<span class="kw1">for</span> i<span class="sy0">,</span> torrent <span class="kw1">in</span> torrents.<span class="me1">iteritems</span><span class="br0">&#40;</span><span class="br0">&#41;</span>:
	status <span class="sy0">=</span> torrent.<span class="me1">status</span>
	<span class="kw1">if</span> status <span class="kw1">not</span> <span class="kw1">in</span> <span class="br0">&#91;</span><span class="st0">'seeding'</span><span class="sy0">,</span> <span class="st0">'stopped'</span><span class="br0">&#93;</span>:
		<span class="kw1">continue</span>
	show <span class="sy0">=</span> collection.<span class="me1">match</span><span class="br0">&#40;</span>torrent.<span class="me1">name</span><span class="br0">&#41;</span>
	<span class="kw1">if</span> show <span class="kw1">is</span> <span class="kw2">None</span>:
		<span class="kw1">continue</span>
	path <span class="sy0">=</span> <span class="st0">'{0}{1}/'</span>.<span class="me1">format</span><span class="br0">&#40;</span>TV_PATH<span class="sy0">,</span> show<span class="br0">&#41;</span>
	<span class="kw1">if</span> torrent.<span class="me1">downloadDir</span>.<span class="me1">startswith</span><span class="br0">&#40;</span>path<span class="br0">&#41;</span>:
		<span class="kw1">continue</span>
	<span class="kw1">print</span> <span class="st0">'Found {0} torrent <span class="es0">\'</span>{1}<span class="es0">\'</span> in show <span class="es0">\'</span>{2}<span class="es0">\'</span>, moving...'</span>.<span class="me1">format</span><span class="br0">&#40;</span>status<span class="sy0">,</span> torrent.<span class="me1">name</span><span class="sy0">,</span> show<span class="br0">&#41;</span>
	result <span class="sy0">=</span> client.<span class="me1">move</span><span class="br0">&#40;</span>i<span class="sy0">,</span> path<span class="br0">&#41;</span>
	<span class="kw1">if</span> status <span class="sy0">==</span> <span class="st0">'seeding'</span>:
		<span class="kw1">print</span> <span class="st0">'Re-starting torrent to continue seeding'</span>
		client.<span class="me1">start</span><span class="br0">&#40;</span>i<span class="br0">&#41;</span></pre></div></div></div></div></div></div></div>


]]></content:encoded>
			<wfw:commentRss>http://correl.phoenixinquis.net/2011/04/27/transmission-rss-and-xbmc/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Potatoes and Portal Guns</title>
		<link>http://correl.phoenixinquis.net/2011/04/27/26/</link>
		<comments>http://correl.phoenixinquis.net/2011/04/27/26/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 20:29:01 +0000</pubDate>
		<dc:creator>Correl Roush</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[portal]]></category>
		<category><![CDATA[xbox]]></category>

		<guid isPermaLink="false">http://trinity.phoenixinquis.net/wordpress/?p=26</guid>
		<description><![CDATA[Got my hands on Portal 2 and finished a run through the single player campaign. Was a lot of fun, the characters were bursting with humor and personality. Just like the first game, it was hard to stop playing. Unlike &#8230;<p class="read-more"><a href="http://correl.phoenixinquis.net/2011/04/27/26/">Read more &#187;</a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://correl.phoenixinquis.net/wp-content/uploads/2011/04/portal_2_logo.jpg"><img src="http://correl.phoenixinquis.net/wp-content/uploads/2011/04/portal_2_logo-150x150.jpg" alt="" title="portal_2_logo" width="150" height="150" class="alignright size-thumbnail wp-image-27" /></a>
Got my hands on Portal 2 and finished a run through the single player campaign. Was a <em>lot</em> of fun, the characters were bursting with humor and personality. Just like the first game, it was hard to stop playing. <em>Unlike</em> the first game, it&#8217;s got some length, so I stayed up late a couple nights with my eyes glued to the television. I already want to play through it again to find any little things I my tired eyes may have missed.</p>

<p>I&#8217;m itching to give co-op a try, so if you happen to have it on xbox or care to drop by, let me know.</p>

<p><strong>Update:</strong> Played some co-op with Jen, had fun navigating puzzles together <img src='http://correl.phoenixinquis.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://correl.phoenixinquis.net/2011/04/27/26/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Meh.php</title>
		<link>http://correl.phoenixinquis.net/2011/04/27/meh-php/</link>
		<comments>http://correl.phoenixinquis.net/2011/04/27/meh-php/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 20:18:56 +0000</pubDate>
		<dc:creator>Correl Roush</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://trinity.phoenixinquis.net/wordpress/?p=4</guid>
		<description><![CDATA[&#60;?php if &#40;!defined&#40;'meh'&#41;&#41; define&#40;'meh', null&#41;; &#160; class Meh &#123; public function __set&#40;$name, $value&#41; &#123; &#125; public function __get&#40;$name&#41; &#123; return meh; &#125; public function __isset&#40;$name&#41; &#123; return true &#124;&#124; false; &#125; public function __unset&#40;$name&#41; &#123; &#125; public function __call&#40;$name, $arguments&#41; &#8230;<p class="read-more"><a href="http://correl.phoenixinquis.net/2011/04/27/meh-php/">Read more &#187;</a>]]></description>
			<content:encoded><![CDATA[

<div class="wp-geshi-highlight-wrap5"><div class="wp-geshi-highlight-wrap4"><div class="wp-geshi-highlight-wrap3"><div class="wp-geshi-highlight-wrap2"><div class="wp-geshi-highlight-wrap"><div class="wp-geshi-highlight"><div class="php"><pre class="de1"><span class="kw2">&lt;?php</span>
<span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span><span class="kw3">defined</span><span class="br0">&#40;</span><span class="st_h">'meh'</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="kw3">define</span><span class="br0">&#40;</span><span class="st_h">'meh'</span><span class="sy0">,</span> <span class="kw4">null</span><span class="br0">&#41;</span><span class="sy0">;</span>
&nbsp;
<span class="kw2">class</span> Meh <span class="br0">&#123;</span>
  <span class="kw2">public</span> <span class="kw2">function</span> __set<span class="br0">&#40;</span><span class="re0">$name</span><span class="sy0">,</span> <span class="re0">$value</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
  <span class="br0">&#125;</span>
  <span class="kw2">public</span> <span class="kw2">function</span> __get<span class="br0">&#40;</span><span class="re0">$name</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="kw1">return</span> meh<span class="sy0">;</span>
  <span class="br0">&#125;</span>
  <span class="kw2">public</span> <span class="kw2">function</span> __isset<span class="br0">&#40;</span><span class="re0">$name</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="kw1">return</span> <span class="kw4">true</span> <span class="sy0">||</span> <span class="kw4">false</span><span class="sy0">;</span>
  <span class="br0">&#125;</span>
  <span class="kw2">public</span> <span class="kw2">function</span> __unset<span class="br0">&#40;</span><span class="re0">$name</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
  <span class="br0">&#125;</span>
  <span class="kw2">public</span> <span class="kw2">function</span> __call<span class="br0">&#40;</span><span class="re0">$name</span><span class="sy0">,</span> <span class="re0">$arguments</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="kw1">return</span> meh<span class="sy0">;</span>
  <span class="br0">&#125;</span>
  <span class="kw2">public</span> <span class="kw2">function</span> __callStatic<span class="br0">&#40;</span><span class="re0">$name</span><span class="sy0">,</span> <span class="re0">$arguments</span><span class="br0">&#41;</span> <span class="br0">&#123;</span>
    <span class="kw1">return</span> meh<span class="sy0">;</span>
  <span class="br0">&#125;</span>
<span class="br0">&#125;</span>
&nbsp;
<span class="re0">$bwuh</span> <span class="sy0">=</span> <span class="kw2">new</span> Meh<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$bwuh</span><span class="sy0">-&gt;</span><span class="me1">give_a_shit</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="kw1">echo</span> <span class="re0">$bwuh</span><span class="sy0">-&gt;</span><span class="me1">concerns</span><span class="sy0">;</span>
&nbsp;
&nbsp;
<span class="kw2">class</span> SuperDuperBillingProcessor <span class="kw2">extends</span> Meh <span class="br0">&#123;</span><span class="br0">&#125;</span>
&nbsp;
<span class="re0">$p</span> <span class="sy0">=</span> <span class="kw2">new</span> SuperDuperBillingProcessor<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$p</span><span class="sy0">-&gt;</span><span class="me1">calculateEverything</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span>
<span class="re0">$p</span><span class="sy0">-&gt;</span><span class="me1">profit</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div></div></div></div></div></div>


]]></content:encoded>
			<wfw:commentRss>http://correl.phoenixinquis.net/2011/04/27/meh-php/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

