Introduction: Automatic Start/stop of Torrents on Raspberry

If you're a gamer and you use torrents you have to stop them to play games and resume them after. It is even more tedious if you're not the only gamer in the house. Well now you can use raspberry to be your torrentbox and do that automatically for you. Because scheduling is just not enough. There are lots of times over the day when we are on job or in school and LAN is free to do some seeding

Step 1: Install Rasbian, Usb Storage, Transmission and Samba

I won't go over this step by step. Eveything is already well explained in the next links..

Download raspbian:

https://www.raspberrypi.org/downloads/raspbian/

Use instructions to install:

https://www.raspberrypi.org/help/noobs-setup/

Turn on SSH on raspberry and install putty on windows. Connect through it for future changes and installs

https://mediatemple.net/community/products/dv/2044...

Setup USB as NTFS and install transmission and samba:

(I have skipped steps about removing GUI but it is up to you)

https://www.raspberrypi.org/forums/viewtopic.php?f...

Transmission is a program that allows you to download and seed torrents (like utorrent on windows).

Samba is a program that allows you to connect to raspberry and map its directory like a network drive which really speeds up the process of getting to your content.

While you're still in samba.conf do some changes:

wins support = yes (remove # from begging of line)

under [homes] (near the end of file)

browseable = yes

read only = no

To get to the folder on raspberry just go to windows explorer and in adress bar type in \\192.168.x.xx

Then right click on the folder and select Map network drive, just choose a letter and it is shown in my computer like a regular hard drive

Step 2: Set Up Transmission

Connect via putty and go to settings

cd /etc/init.d/transmission-daemon

sudo nano settings.json

Change following + whatever you want:

rpc-enabled: true,

rpc-username: xx, //set username same as in IPs max 20 chars

rpc-password: yy, //set password same as in IPs max 20 chars

rpc-whitelist: "127.0.0.1, 192.168.x.*", //allow connection from any LAN connected device where x is your number (check router settings or pc ip)

When you're done with changes press ctrl+x to exit followed by enter twice to confirm that you want to overwrite and save changes

Reload transmission after that or changes won't stick:

sudo service transmission-daemon force-reload

Step 3: Download ProgramTorrent and Setup

Go to

https://github.com/seky2205/programTorrent

and press Download ZIP.

There are now two versions of program. If you're new I recommend you to use Java version. Java version will work on any platform that can run java and transmission.

FOR C++:

UNZIP it and move it to the folder on raspberry. You can access raspberry pi home folder and place it somewhere there. My folder is named programTorrent.

After you have placed it you can go to putty again.

cd programTorrent

sudo cp startprogramTorrent /etc/init.d/

sudo nano IPs.txt

in first line change username to username you setup in transmission

in second put the password for transmission

and then just put an ip adress of PC that you wish to block torrent traffic when turned on (as many as you want)

delete all empty rows on the end

exit with ctrl+x

sudo service startprogramTorrent start


FOR JAVA:

Unzip folder and go to subfolder Java. Copy over programTorrent.jar to any folder of your likening.

After you have placed it you can go to putty again. My folder is named programTorrent.

Go to putty again and do following:

sudo nano /etc/rc.local

Right before exit 0 add following lines:

cd /home/pi/programTorrent

java -jar programTorrent.jar [options]

options are:
-s [string] for subnet.. replace string with subnet. Example -s 192.168.5.

-u [username] Example: -u Eclipse

-p [password] Example: -p Mars

-ip [ip1 ip2] Example: -ip 10 23 24

-d for debug

Full example:

java -jar programTorrent.jar -u Eclipse -p Mars -s 192.168.5. -ip 10 23 24

Subnet is first 3 parts of your local IP. Note that you HAVE TO PUT last dot in there.

Username and password are from Transmission config files.

Ips are last numbers of all devices that you wish to block the torrent traffic when active. I recomment putting them on static DHCP in your router settings.

-d is for debug, and you really don't need to use it. All is working fine :D

Step 4: Use Transmission

In browser go to IP adress and port of your raspberry transmisson: 9091 default

Here you can add .torrent files or directly URLs

programTorrent will auto start them when he detects no predefined PCs on LAN

Happy torrenting :D