Sunday, June 12, 2016

Making Transmission and RSS best buddies

Ok here is the thing. I will keep coming back till I am alive.

Today, just to waste sometime, decided to find a way by which I can add rss support to transmission.

Thanks to this post, I found a way with the help of this script.

BUT there are problems with the script -

1. It will parse the rss and add the torrents to transmission's queue. But is if happen to delete the torrent, it will again add it.
2. There is no log file which it can refer to while deciding about downloading it.

Then I summon the my coding super powers to modify the script. Now my script while parsing the  RSS also refers to the log file and checks the title of the torrent. If it is there, script will not add the torrent. Rather it will display a message like below

Torrent Already Downloaded / or in queue: Torrent Name
 Here is my script. https://github.com/nigamankit7/transmission-rss

Now steps to set it up -

  1. Open SSH and connect to your cloud
  2. Install Transmission (I used this  tutorial)
  3. Go to your home dir or anywhere you like
    cd ~/
  4. Download chinese PHP script with wget:
    wget https://raw.githubusercontent.com/nigamankit7/Transmission-RSS/master/rss.php
  5. Edit the config section at the end of the file with any text editor
       nano rss.php
 Here is the list of RSS links (it can be more than one. Just delete all of them here and put yours. Remember to omit the comma after the last link.
$rss = array(
    'http://chdbits.org/torrentrss.php...',
    'http://totheglory.im/putrssmc.php...',
    'https://hdcmct.org/torrentrss.php...',
    'https://open.cd/torrentrss.php?.....',
    'https://mv.open.cd/torrentrss.php?..',
    'http://hdwing.com/rss.php?..........',
    'http://hdtime.org/torrentrss.php?...'
);
 Internal IP to your cloud (it's better to use static local IP, I'm not sure if the name would work like on your computer)
$server = 'http://127.0.0.1';
 Access port to Transmission (if you haven't change it, skip it)
$port = 9091;
 RPC path for Transmission (same here, skip it if you haven't changed it)
$rpcPath = '/transmission/rpc';
 Credentials for your Transmission (empty by default)
$user = '';
$password = '';
  1. Save and exit
  2. Test your script with
    php rss.php
 If all goes well, it should return a list of found links and added to Transmission, for example:
success add torrent: Two and a Half Men 12x09 Bouncy, Bouncy, Bouncy, Lyndsey 720p
success add torrent: The Big Bang Theory 8x12 The Space Probe Disintegration 720p
success add torrent: Forever 1x12 720p
success add torrent: The Mentalist 7x06 Green Light 720p
  1. Check your Transmission web UI if they are downloading.
  2. Now we can add the task to cron. Edit the cron with
    crontab -e
  3. You should see at least one line with Transmission daemon. We need to add another line, like
    */10 * * * * php ~/rss.php >> /var/log/rss.log 2>&1
 or the one without logs

*/10 * * * * php ~/rss.php

 This should run our script every 10 mins.

MAKE SURE CRON IS ENABLED ON RASPBERRY

EDIT - "/home/pi/.kodi/userdata/addon_data/script.raspbmc.settings/settings.xml"

SET :  sys.service.cron TO "true"