Installing Transmission on a Text Only SBC

Overview

The availability of low-cost single-board computers such as Orange Pi One and the Orange Pi PC allow stable Armbian releases to be run on low power with low purchase and running costs.

This is a quick overview of how to set up an SBC to automatically grab new content and download to a NAS. There are housekeeping scripts to allow automated 24 x 7 x 365 operation.

Once setup you can just add new shows/subscriptions to your RSS provider and new content will appear on the NAS old downloads are logged in a text file so they will only be downloaded once.


Code examples here https://github.com/frownbreaker/FeedTransmissionExtras

Stable Text-Based Linux Install (Text mode is best)

Install a stable image onto a known good SD card and boot, ensure that you boot into text mode only and install Transmission


  • https://askubuntu.com/questions/870221/booting-into-text-mode-in-16-04/870226
  • https://help.ubuntu.com/community/TransmissionHowTo

Note most distros have support for SMB https://libreelec.wiki/how_to/mount_network_share

Add LAN Connection to NAS (Cheap single disk NAS is fine)

I used these changes to allow access from the LAN with no auth

"rpc-authentication-required": false,
"rpc-whitelist": "127.0.0.1,192.168.*.*",
"umask": 2,

Then ensure a permanent mount to a low-cost NAS drive, again low cost, low running costs

https://wiki.ubuntu.com/MountWindowsSharesPermanently

Your fstab should have a line like this

//192.168.0.133/pvr /media/windowsshare cifs username=nasuser,password=secret,iocharset=utf8,sec=ntlm 0 0


You might see an error like this

root@orangepipc:/media/windowsshare# sudo mount -a
mount error(112): Host is down

I got this and changed the fstab line to this note the, "vers=1.0" toward the end of the line. You might have to user 1.0, 2.0 or 3.0 depending on the age of the SMB server you are using.

//192.168.0.130/pvr  /media/windowsshare  cifs  username=pvr,password=secret,iocharset=utf8,sec=ntlm,vers=1.0  0  0

Config Transmission using the Web GUI

Then  head over to the web UI and set the download directory http://server-ip:9091


Click the spanner on the bottom left toolbar and set the download directory /media/windowsshare/recordings or some other directory under the mount point. Avoid using the root of the SMB mountpoint: Later you may decide to add more transmission servers so it makes sense to have a separate directory off the single share/mount point per server.

Also in the setup web GUI find the blocklist tab and enable it you can use this URL http://john.bitsurge.net/public/biglist.p2p.gz, hit save/update there will be a short delay as the block list is downloaded and parsed. More info here:

https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/

Installing FeedTransmission

Transmission is a python program https://github.com/lupus78/feedtransmission/
Python ships with most server installations. However, you might want to add these utils which  might be useful

sudo apt-get install python-pip
pip install --upgrade pip setuptools

You can grab the python code directly

wget https://raw.githubusercontent.com/lupus78/feedtransmission/master/feedtransmission.py
chmod +x feedtransmission.py

I have some utility routine to check the NAS connection is up, purge completed content etc they run from cron jobs to automate things



checknas.sh

if [ ! -d "/media/windowsshare/recordings" ]; then
        # Control will enter here if $DIRECTORY doesn't exist.
        echo "Can't see Windows recording directory. Stopping Transmission.."
        sudo service transmission-daemon stop
        echo "Running mount -a .."
        sudo mount -a
        echo "Sleeping 20s"
        sleep 20
        if [ ! -d "/media/windowsshare/recordings" ]; then
                echo "mount -a did not work rebooting"
                reboot
        else
                echo "mount -a worked no need to reboot. Restarting Transmission.."
                sudo service transmission-daemon start
        fi
#else
#       echo "/media/windowsshare/recordings is mounted -Seems good"
fi

Grab new shows...

getnewshows.sh 

/root/feedtransmission.py --transmission-host 192.168.0.xxx --transmission-port 9091 http://showrss.info/user/yyy.rss?magnets=true&namespaces=true&name=null&quality=null&re=null

Script to clean up complete downloads

purge-tvroom.py

#!/usr/bin/python

import sys, os
import feedparser
import transmissionrpc
import argparse
import datetime

# Read the torrents on the server...
kc=0
tc=transmissionrpc.Client('192.168.0.xxx',port=9091)
t=tc.get_torrents()
for key in t:
#for torrent in tc.items():
        if key.isFinished:
                print 'Removing Seed Complete', key.name
                tc.remove_torrent(key.id)
        else:
                if key.percentDone == 1:
                        print 'Removing Download Complete',key.name
                        kc=kc+1
                        tc.remove_torrent(key.id) #Retains data. Torrent is removed



if kc>0:
        sttime = datetime.datetime.now().strftime('%Y%m%d_%H:%M:%S - ')
        le = "Purge run. " + str(kc) +" file(s) removed."
        log = '/root/purgetvroom.log'
        with open(log, 'a') as logfile:
                logfile.write(sttime + le + '\n')