17/02/2011

QNAP, FlexGet and Transmission or How to watch your favorite TV shows without a DVR/TiVo...

Well, if you, like me, enjoy downloading shows from the web via RSS, there is FlexGet (from FlexGet.com. Problem is, how to get that egg running on your NAS (especially when you have the old QNAP x09). Here are some steps to come to your aid:

  1. You need to have ipkg. I used the QPKG to install the IPKG then, in ipkg, I use the repository from:

    http://ipkg.nslu2-linux.org/feeds/optware/tsx09/cross/unstable/Packages
  2. Second, you need to install the right python setuptools (after running ipkg update, of course):

    [~] # ipkg install py25-setuptools
    Installing py25-setuptools [.....]
    Successfully terminated.
    

    Be patient, this took a while to install...
  3. Then, from the FlexGet page you get the right download and install it (at the time at this post I was running it like this):

    mkdir /share/tmp
    export TEMP=/share/tmp
    cd /share/tmp/
    wget http://download.flexget.com/unstable/FlexGet-1.0r1419-py2.6.egg
    ls
    # shows FlexGet-1.0r1419-py2.6.egg
    easy_install ./FlexGet-1.0r1419-py2.6.egg
    Another alternative to fix the TEMP is to make the /tmp size bigger:
    mount -o remount,size=128M /tmp

    Make sure you change the default temp directory as it will run out of space if you use the default one.
  4. Now you have it installed in /opt/local/bin/flexget and you should make it work for you. Edit the crontab and add (username is whatever user you have there, or other favorite location). Beware that crontab is in /etc/config/crontab or /mnt/HDA_ROOT/.config/crontab:
    0 4 * * * /opt/local/bin/flexget --cron -c /share/*USERNAME*/.flexget/config.yml
    
  5. Config file shold be linked also:

    ln -s /share/username/.flexget/config.yml /share/MD0_DATA/.qpkg/Optware/local/config.yml
    
  6. Install transmission
    ipkg install transmission
  7. Install your own rc.local that will auto-start the transmission at reboot:
    cat > /share/*USERNAME*/rc.local <<EOF
    #!/bin/sh
    echo "/share/MD0_DATA/.qpkg/Optware/lib/" >> /etc/ld.so.conf
    ldconfig
    export EVENT_NOEPOLL=0
    export TRANSMISSION_WEB_HOME=/share/MD0_DATA/.qpkg/Optware/share/transmission/web
    /share/MD0_DATA/.qpkg/Optware/bin/transmission-daemon -p 9091 -T -a YOUR.SUBNET.IP.* -w /share/Qdownload/ -g /share/Qdownload/config/ > /var/log/debug_tm.txt
    EOF
    
  8. And if you want to be more of a maniac and optimize the TCP/IP stack default, you can append this:
    cat >> /share/*USERNAME*/rc.local <<EOF
    # Some tcp/ip optimizations
    ifconfig eth0 txqueuelen 50000
    # ifconfig eth1 txqueuelen 50000
    # default: 0
    echo 1 > /proc/sys/net/ipv4/tcp_rfc1337
    # default: 0
    echo 2 > /proc/sys/net/ipv4/tcp_frto
    # default: 0
    echo 1 > /proc/sys/net/ipv4/tcp_mtu_probing
    # default: 0
    echo 1 > /proc/sys/net/ipv4/tcp_workaround_signed_windows
    # default: 0
    echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
    # default: 0
    echo 1 > /proc/sys/net/ipv4/tcp_low_latency
    # default: 0
    echo 1 > /proc/sys/net/ipv4/tcp_ecn
    EOF
    

Comments are welcome. There are other fine tunning things that you can do also, especially regarding the transmission configuration, twonkymedia, or even flexget, so fell free to ask me questions...

Useful link for:
1. Transmission
2. wiki: Running Your Own Application at Startup
3. Network speed optimizations

1 comment:

Unknown said...

An update. It seems that ezrss.it is down. Another alternative is: http://showrss.karmorra.info