<?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>Jumpingmushroom &#187; flexget</title>
	<atom:link href="http://www.jumpingmushroom.com/tag/flexget/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jumpingmushroom.com</link>
	<description></description>
	<lastBuildDate>Sat, 25 Jun 2011 21:59:20 +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>Instant entertainment</title>
		<link>http://www.jumpingmushroom.com/2010/03/22/instant-entertainment/</link>
		<comments>http://www.jumpingmushroom.com/2010/03/22/instant-entertainment/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 14:10:31 +0000</pubDate>
		<dc:creator>johnny</dc:creator>
				<category><![CDATA[Gadgets]]></category>
		<category><![CDATA[flexget]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mediacenter]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[TV-Show]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://jumpingmushroom.com/?p=859</guid>
		<description><![CDATA[Ever wondered if there&#8217;s a way to have all the TV-Shows you would ever want directly delivered to your media centre as soon as it&#8217;s available online? Over the last years I&#8217;ve experimented with several ways of automatic download, sorting and management of my shows, and I think I have found a setup that works [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wondered if there&#8217;s a way to have all the TV-Shows you would ever want directly delivered to your media centre as soon as it&#8217;s available online? Over the last years I&#8217;ve experimented with several ways of automatic download, sorting and management of my shows, and I think I have found a setup that works according to my needs.</p>
<p><span id="more-859"></span></p>
<p>Here&#8217;s what I currently have in my mediacenter setup:<br />
- <a href="http://www.asrock.com/nettop/spec/ion%20330.asp">Asrock NetTop ION330</a><br />
- <a href="http://www.amazon.com/Western-Digital-Network-Attached-WDH1NC10000N/dp/B001RB1QWW/ref=dp_cp_ob_e_title_0">Western Digital MyBook World Edition II</a></p>
<p>Configurations:<br />
<strong>Western Digital MyBook World edition II:</strong><br />
This box has been configured in the usual way you would set up up according to the manual, however I disabled samba and ftp support, and enabled NFS for speed. Also, I disabled the built in remote management system, and Twonkymedia for speed. Basically, what you want to do is to disable as many services as possible, and leaving the disk as strictly a remote storage disk. I can highly recommend reading up on this site <a href="http://mybookworld.wikidot.com/">http://mybookworld.wikidot.com/</a> They have a lot of useful information regarding this box and how to hack it to do just about everything. I did earlier run this box as a seed-box, but unfortunately it doesn&#8217;t handle high speeds (100mbit) connections very well on torrents.</p>
<p><strong>Asrock NetTop ION330:</strong></p>
<p>This<strong> </strong>box has a lot of configurations, both for my media centre functions, and for my personal projects, but here&#8217;s the basics needed to have a fully functional, automatic downloading, sorting and renaming media box.</p>
<p>The system itself: XBMC LiveCD &#8211; For me, this is by far the best media center known to man. Works flawlessly on the box and runs GNU/Linux (Ubuntu). Download the ISO image from <a href="http://sourceforge.net/projects/xbmc/files/XBMC%20Live/Camelot%20-%209.11/xbmc-9.11-live-repack.zip/download">here</a>, burn to a CD and boot up. Follow the installation instructions, and voila!</p>
<p>Now for the nitty gritty configurations and script working in the background and making everything happen.</p>
<p>First of all, you will have to set up <a href="http://www.flexget.com">FlexGet</a> . I have written a complete guide on how to do this <a href="http://jumpingmushroom.com/2009/08/20/getting-the-latest-with-flexget">here</a>.</p>
<p>Then, you will have to install an application to start these downloads with, like <a href="http://libtorrent.rakshasa.no">rTorrent</a>. This is easiest done by running the following command:</p>
<pre class="brush: bash">user@XBMCLive:~$ sudo apt-get install rtorrent</pre>
<p>Then there&#8217;s the configuration:<br />
<em>rtorrent.rc</em></p>
<pre class="brush: bash">max_peers = 131

max_uploads = 11

upload_rate = 2000

directory = /your/path/to/downloading

session=/your/path/to/sessions

schedule = watch_directory,5,5,load_start=/your/watchfolder/*.torrent
schedule = tied_directory,5,5,start_tied=/your/watchfolder/*.torrent
schedule = untied_directory,5,5,stop_untied=/your/watchfolder/*.torrent

schedule = low_diskspace,5,60,close_low_diskspace=100M

execute_log = /your/logfolder/rtorrent.log

port_range = 55556-55560

port_random = no

check_hash = no

use_udp_trackers = yes

encryption = allow_incoming,enable_retry,prefer_plaintext

dht = auto

dht_port = 6881

peer_exchange = yes

on_finished = seed,"execute=mv,-u,$d.get_base_path=,/your/path/to/seeding/"

schedule = ratio,60,60,"close_on_ratio=200"

on_close = move_fin,"execute=mv,-u,$d.get_base_path=,/your/path/to/completed//"

on_close = remove_fin,"execute=rm,$d.get_tied_to_file="</pre>
<p>Here you need to change the following values to suit your needs:</p>
<ul>
<li><em>upload_rate</em> &#8211; Max upload rate for all torrents combined.</li>
<li> <em>directory</em> &#8211; path to where your downloads will be when the download is running.</li>
<li><em>watch/tied/untied_directory</em> &#8211; where you will be placing your .torrent files you want to start.</li>
<li><em>execute_log</em> &#8211; Path to the logfile for all executed actions.</li>
<li> <em>port_range</em> &#8211; Ports you want the torrents to be connectable to. Remember to open these ports on your router/firewall!</li>
<li><em>on_finished</em> &#8211; Path to where you want files to be stored when they&#8217;re seeding.</li>
<li> <em>ratio</em> &#8211; At what share ratio you want your torrent to be stopped. Default is 200%.</li>
<li> <em>on_close</em> &#8211; The directory you want the files to be stored once finished downloading.</li>
</ul>
<p>Once you have this up and running in a screen, the next is to configure two scripts that run as a cron job every day and rename + sort the downloads once they arrive in the completed folder.</p>
<p><strong>Sorting</strong><br />
We want to sort our downloads into neat folders so our XBMC system understand what kind of shows we have. The most important part for this script to work is the directory structure. It must be set up like this:</p>
<pre class="brush: bash">/your/path/Show Name/Season X/</pre>
<p>And here&#8217;s the script that is going to do the job of sorting:<br />
<em>mvfiles.sh</em></p>
<pre class="brush: bash">#!/bin/bash

# specify the base directory to move to
fs="/your/path/to/TV"

# specify the base directory to search
base="/your/path/to/completed/"
for file in `find "$base" | replace " " "~" | egrep 'mkv|avi'`; do

        file=`echo $file | replace "~" " "`

        show=`basename "$file" | grep -io "[^\/]*S[0-9]\{1,2\}" | grep -io ".*[\._ -]" | replace "." " " "_" " " "-" " " `
        while [ -n "`echo "$show" | grep \" \{2\}\"`" ]; do
                show=`echo "$show" | replace "  " " "`
        done

        show=`echo "\`expr "$show" : '[ ]*\(.*\)[ *]$'\`"`
        #echo "\"$show\""
        snum=`basename "$file" | grep -io "S[0-9]\{1,2\}" | grep -io "[1-9]\?[1-9]"`
        season="Season $snum"
        #echo $season

        show=`ls "$fs" | grep -io "$show"`
        #echo "DIR: \"$show\""

        dest=$fs
        if [ -d "$fs/$show/$season/" ]; then
                dest="$fs/$show/$season/"
        else
                if [ -d "$fs/$show/Season$snum" ]; then
                        dest="$fs/$show/Season$snum/"
                else
                        if [ -d "$fs/$show/" ]; then
                                dest=""
                        fi
                fi
        fi

        if [ "$dest" != "" ]; then
                #echo "mv -v \"$file\" \"$dest\""
                mv -v "$file" "$dest"
                wait `pidof mv`
        fi

done

# Delete all .nfo, .srt, .txt files
find "$base" -name *.nfo -exec rm {} \;
# find "$base" -name *.srt -exec rm {} \;
find "$base" -name *.txt -exec rm {} \;

# Delete all empty folders (recursively)
find "$base" -depth -mindepth 1 -type d -empty -exec rmdir {} \;

exit 0;</pre>
<p>As you can see, it works with simple regexp and Linux commands, and after a couple of weeks testing, it does the job very well. If it doesn&#8217;t recognize the name, it leaves the file alone.</p>
<p>Just to note, I did not write this script, unfortunately I do not know who did, but if you&#8217;re out there, thanks! I spent several months trying to find a way to do this, and this script saved me from having to study bash and write it from scratch.</p>
<p><strong>Renaming</strong><br />
In order to rename the files to names more fitting the naming conventions of XBMC, I made a very simple bash script that uses a python script  called <a href="http://github.com/dbr/tvdb_api">tvnamer</a>. This script checks with <a href="http://www.thetvdb.com">TheTVdb.com</a> and renames the file according to what is specified there. Usually this will be <em>&#8220;Show name [01x01] Episode name.ext&#8221;</em> and makes it very easy for XBMC to recognize the show.<br />
<em>renameTV.sh</em></p>
<pre class="brush: bash">#!/bin/bash

/usr/local/bin/tvnamer -b -r /your/path/to/TV &gt; /dev/null 2&gt;&amp;1</pre>
<p>Be aware though, that this script goes through the entire TV folder and renames any episode there without interaction. If you don&#8217;t want this, you might want to figure out another way to set this up.</p>
<p>And last but not least, how to run these scripts automatically. I simply set up a cron job for each one like this, also, I did add a third line that updates the XBMC library automatically once everything is sorted and renamed, so we really have everything ready when we&#8217;re back home.</p>
<pre class="brush: bash">
0 15 * * * sh /your/path/to/scripts/mvfiles.sh &gt;&gt; /var/log/mvfiles.log
0 16 * * * sh /your/path/to/scripts/renameTV.sh
0 17 * * * curl --get "http://localhost:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn&amp;parameter=XBMC.updatelibrary(video) >> /var/log/xbmc-update.log
"</pre>
<p>This runs the first script that moves files at 15:00, and the renaming script at 16:00. Which means when I get home from work at 18:00, everything will be sorted and ready for me. Now be aware, this works great for me,  because I live in Scandinavia, which means most shows I&#8217;m watching come out in the middle of the night here, and gets downloaded during the early hours of the day. This means that by lunch, the files are already to sort.<br />
This might however be different for you if you live in America.</p>
<p>Hope this guide was useful for you! And please leave feedback if you have any questions.</p>
<p><strong>Updated:</strong> Added cron job for updating the XBMC library automatically once everything is sorted and renamed.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jumpingmushroom.com/2010/03/22/instant-entertainment/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting the latest with Flexget</title>
		<link>http://www.jumpingmushroom.com/2009/08/20/getting-the-latest-with-flexget/</link>
		<comments>http://www.jumpingmushroom.com/2009/08/20/getting-the-latest-with-flexget/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 11:42:16 +0000</pubDate>
		<dc:creator>johnny</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[flexget]]></category>
		<category><![CDATA[movie]]></category>
		<category><![CDATA[TV-Show]]></category>

		<guid isPermaLink="false">http://jumpingmushroom.com/?p=662</guid>
		<description><![CDATA[Seeing as I&#8217;m slightly lazy, I wanted to find a way to automatically download all TV-Series and movies, without any human interaction. After searching around a bit, I stumbled upon a python script called Flexget. The easy explanation for what kind of script this is the following: You specify where to download from, what to [...]]]></description>
			<content:encoded><![CDATA[<p>Seeing as I&#8217;m slightly lazy, I wanted to find a way to automatically download all TV-Series and movies, without any human interaction.</p>
<p>After searching around a bit, I stumbled upon a <a href="http://www.python.org/">python</a> script called <a href="http://flexget.com/">Flexget</a>. The easy explanation for what kind of script this is the following:</p>
<p><strong>You specify where to download from, what to download, and where to download it to.</strong></p>
<p>The long explanation all tough, is so much more interesting!</p>
<p>Here is a config file I have compiled together:</p>
<pre class="brush: yaml">global:
  statistics:
   file: /path/to/your/wwwroot

  email:
    from: flexget@myserver.com
    to: your@mailaddress.com
    smtp_host: mail.mailaddress.com
    smtp_port: 25
    smtp_login: true
    smtp_username: your@mailaddress.com
    smtp_password: yourpassword123

feeds:
  tv-shows:
    rss: http://www.website.com/rssfeed.php
    series:
      - True Blood:
          timeframe:
            hours: 6
            enough: 720p
      - Eureka:
          timeframe:
            hours: 12
            enough: 720p
      - Family Guy
      - Dirty Jobs

    download: /path/to/torrent/watchdir

  movies:
    rss: http://www.website.com/rssfeed.php
    limit_new: 3
    imdb:
      min_score: 6.2
      min_votes: 6000
      min_year: 1997
    download: /path/to/torrent/watchdir

  flexget:
    interval: 3 days
    html: http://download.flexget.com/0.9/
    regexp:
      accept:
        - flexget.*zip
    download: /root/fgreleases

  diggnation:
    interval: 3 days
    rss: http://revision3.com/diggnation/feed/MP4-hd30
    limit_new: 1
    regexp:
      accept:
        - diggnation*.mp4
    exec: wget -b -P /path/to/podcast/directory %(url)s</pre>
<p>And here is an explanation on what each part does:</p>
<p>First part:</p>
<pre class="brush: yaml">global:
  statistics:
   file: /path/to/your/wwwroot</pre>
<p>Basically, this part sets all the global settings of the entire config file. in this section I&#8217;ve only set up that statistics for all downloads should be parsed to an index file on my box. Here you will see what kind of sites that generate the most results.</p>
<p>Second part:</p>
<pre class="brush: yaml">  email:
    from: flexget@myserver.com
    to: your@mailaddress.com
    smtp_host: mail.mailaddress.com
    smtp_port: 25
    smtp_login: true
    smtp_username: your@mailaddress.com
    smtp_password: yourpassword123</pre>
<p>This part is very cool. It&#8217;s for setting up so you get a mail as soon as a new show/movie/whatever is downloaded. Combine this with an iPhone and a push mail service, and you got yourself an instant notification as soon as your favorite show has started downloading. Also, If you combine this with the <a href="http://en.wikipedia.org/wiki/Deluge">Deluge</a> <a href="http://flexget.com/wiki/Plugins/deluge">plugin in Flexget</a>, you can set up Deluge to mail you as soon as the download has finished!</p>
<p>Third part:</p>
<pre class="brush: yaml">feeds:
  tv-shows:
    rss: http://www.website.com/rssfeed.php
    series:
      - True Blood:
          timeframe:
            hours: 6
            enough: 720p
      - Eureka:
          timeframe:
            hours: 12
            enough: 720p
      - Family Guy
      - Dirty Jobs
    download: /path/to/torrent/watchdir</pre>
<p>Now for the things that really matter. The downloads. Here I have specified the following values:</p>
<ul>
<li>feeds: &#8211; This indicates that the following list will consist of rss feeds</li>
<li>tv-shows: &#8211; This just tells flexget that the feed we are about to parse will consist of tv-shows. It will then make it easier for flexget to understand how to parse the names, focus on season and episode numbers and so on.</li>
<li>rss: &#8211; Here we just specify the rss feed for a place to get the latest tv-shows.</li>
<li>series: &#8211; This part is the fun part. Here you just write the name of the show you want to get. There are no real rules needed to specify, no regexp to focus on, just write the name, that&#8217;s it. Just remember to write it as it&#8217;s shown in the feed, otherwise flexget will get confused.</li>
<li>timeframe: &#8211; Here we want to specifiy some extra settings. The timeframe value can make use of the settings &#8220;hours&#8221; and &#8220;enough&#8221;. This makes it so that IF the 720p version of a release has not been displayed within 6 hours, the SD (Standard definition) version should be downloaded.</li>
<li>download: Here is where the .torrent file will get downloaded. After this, the torrent client (in my case <a href="http://www.transmissionbt.com/">transmission</a>) will take over and start downloading.</li>
</ul>
<p>Fourth part:</p>
<pre class="brush: yaml">  movies:
    rss: http://www.website.com/rssfeed.php
    limit_new: 3
    imdb:
      min_score: 6.2
      min_votes: 6000
      min_year: 1997
    download: /path/to/torrent/watchdir</pre>
<p>This second part is for downloading the latest HD movie releases, which in turn gets checked through <a href="http://www.imdb.com">IMDB</a> to check the rating (I&#8217;ll explain this later).</p>
<ul type="circle">
<li>movies: &#8211; This just tells flexget that we are now dealing with movies, not tv-shows.</li>
<li>rss: &#8211; Same as above, the rss feed for a site where you are to download from.</li>
<li>limit_new: 1 &#8211; I had to add this in order to not kill of my box completely. Basically it only checks one link each time the cron job is run (which is once every hour).</li>
<li>imdb: &#8211; Here we tell flexget that the following will be values used to check towards imdb.</li>
<li>min_score: 6.2 &#8211; We don&#8217;t want crap movies in our archives, so here we tell flexget to only download movies with a rating ABOVE 6.2 on IMDB.</li>
<li>min_votes: 6000 &#8211; We also don&#8217;t want the script to download movies where there are only 100 votes (which is mostly the actors and cast of the movie) and have received a high initial rating.</li>
<li>download: &#8211; Same as above, download path is to the watch-dir for your torrent client.</li>
</ul>
<p>The third part:</p>
<pre class="brush: yaml">  flexget:
    interval: 3 days
    html: http://download.flexget.com/0.9/
    regexp:
      accept:
        - flexget.*zip
    download: /root/fgreleases</pre>
<p>We of course want to keep up with the latest updates of the script. There might be changes to <a href="http://www.imdb.com">IMDB</a> that require the script to be updated, or new features which we can take use of. That&#8217;s where this part comes in.</p>
<ul>
<li>flexget: &#8211; Loads the flexget module, which is made specifically for downloading latest updates of flexget.</li>
<li>interval: 3 days &#8211; Check every 3 days for new updates.</li>
<li>html: &#8211; Seeing as there is no rss feed for releases, we have to rely on html parsing. That&#8217;s where this module comes in.</li>
<li>patterns: &#8211; Here we have to use regexp in order to dive through the html code, and finding the file we need.</li>
<li>download: &#8211; Aaand where to download the release. Here we just dump it in a folder on our home path.</li>
</ul>
<p>The last part:</p>
<pre class="brush: yaml">  diggnation:
    interval: 3 days
    rss: http://revision3.com/diggnation/feed/MP4-hd30
    limit_new: 1
    regexp:
      accept:
        - diggnation*.mp4
    exec: wget -b -P /path/to/podcast/directory %(url)s</pre>
<p>I watch a lot of <a href="http://www.diggnation.com">Diggnation</a>, so naturally it would be cool to have the latest episodes waiting for me on my box when they are available. This part simply uses more or less the same functions as the flexget section, except it also specifies that it should only download the newest link found. I have also set it to use wget to download it, and not flexgets own get function, as 1. It takes up a lot of load, and 2. The download can last for quite some time, which in turn can make the script start running in several instances.</p>
<p>So that&#8217;s it! I really love this script and how versatile it is. If you wish to read more about using flexget and how to modify it to your needs:</p>
<p>Configuration samples: <a href="http://flexget.com/wiki/CookBook">http://flexget.com/wiki/CookBook</a></p>
<p>Usage for various plugins: <a href="http://flexget.com/wiki/Modules">http://flexget.com/wiki/Modules</a></p>
<p><strong>Last edited: 10/11/2009 at 14:15</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jumpingmushroom.com/2009/08/20/getting-the-latest-with-flexget/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

