Torrent Invites! Buy, Trade, Sell Or Find Free Invites, For EVERY Private Tracker! HDBits.org, BTN, PTP, MTV, Empornium, Orpheus, Bibliotik, RED, IPT, TL, PHD etc!



Results 1 to 5 of 5
Like Tree10Likes
  • 7 Post By Ronin21
  • 2 Post By Ronin21
  • 1 Post By loler

Thread: Automatically Transfer torrents from Deluge to rtorrent for Long Term Seeding

  1. #1
    Donor
    Ronin21's Avatar
    Reputation Points
    139211
    Reputation Power
    100
    Join Date
    Apr 2014
    Posts
    2,450
    Time Online
    207 d 15 h 10 m
    Avg. Time Online
    1 h 21 m
    Mentioned
    916 Post(s)
    Quoted
    560 Post(s)
    Liked
    3610 times
    Feedbacks
    135 (100%)

    Cool Automatically Transfer torrents from Deluge to rtorrent for Long Term Seeding

    This was not written by me. I'm just posting here what i found on another forum.

    This is how I got this to work on Debian Jessie, rtorrent 0.9.6

    This is borrowed heavily and updated off a tutorial from BTN, so credit to the author of that tutorial.

    Install prerequisites;

    Run as non-root user (the same user as deluge and rtorrent)


    Code:
    sudo apt-get install deluge-console
    (you need deluge console to remove the torrents via the cli)

    Convert::Bencode_XS is required, however I installed Convert::Bencode on my system prior to installing this, so maybe you can try omitting the next;

    Code:
    perl -MCPAN -e 'install Convert::Bencode'
    Code:
    perl –MCPAN – e ‘install Convert::Bencode_XS’
    on my system that failed so I had to download, patch and compile manually – no big deal.

    Code:
    cd ~/.cpan/build
    wget http://search.cpan.org/CPAN/authors/id/I/IW/IWADE/Convert-Bencode_XS-0.06.tar.gz
    tar –xzf Convert-Bencode_XS-0.06.tar.gz
    
    cd Convert-Bencode_XS-0.06/t/
    wget https://rt.cpan.org/Ticket/Attachment/1433449/761974/patch-t_001_tests_t
    patch -p1 < patch-t_001_tests_t
    cd ..
    perl Makefile.PL
    make
    make test
    sudo make install

    Install Scripts

    Run as non-root user (the same user as deluge and rtorrent)

    Make a folder to house the scripts;

    Code:
    cd ~
    mkdir src
    cd src
    create script rtorrent_fast_resume.pl in this folder, copied from here;
    rtorrent/rtorrent_fast_resume.pl at master · rakshasa/rtorrent · GitHub

    create script delugeExport.sh as per the below but changed to suit your specific file locations(note you may uncomment or edit the sleep command to suit your needs);

    Code:
     
    #!/bin/bash
     
    ####################################################################
     
    ###             Please fill in the variables below!              ###
     
    ####################################################################
     
    #sleep 20m
     
    # Which folder are you keeping rtorrent_fast_resume.pl in?
     
    dir=$HOME/src
     
     
     
    # rTorrent's watch folder
     
    watch=$HOME/Download/watch
     
     
     
    # Do not change this unless you have knowingly changed Deluge's
     
    # state folder.
     
    files=$HOME/.config/deluge/state
     
     
     
    ###                                                              ###
     
    # This script is designed to be used alongside the Execute plugin! #
     
    ###                                                              ###
     
     
     
            torrentid=$1
     
            torrentname=$2
     
            torrentpath=$3
     
            perl $dir/rtorrent_fast_resume.pl "$torrentpath" < "$files/$torrentid.torrent" > "$watch/$torrentname.$RANDOM.torrent"
     
            deluge-console rm "$torrentid"

    make both files executable;

    Code:
    chmod +x rtorrent_fast_resume.pl delugeExport.sh

    update .rtorrent.rc for watch folder and restart rtorrent;

    Code:
    schedule = watch_directory,5,5,"load.start=~/Download/watch/*.torrent,d.directory.set=~/Download"
    Deluge Execute Plugin

    Lastly activate the deluge execute plugin and add a task for torrent completion with the code;

    ~/src/delugeExport.sh

    Everything should be ready to go!
    jimmy7, Laxus, poker and 4 others like this.

  2. #2
    Donor
    Ronin21's Avatar
    Reputation Points
    139211
    Reputation Power
    100
    Join Date
    Apr 2014
    Posts
    2,450
    Time Online
    207 d 15 h 10 m
    Avg. Time Online
    1 h 21 m
    Mentioned
    916 Post(s)
    Quoted
    560 Post(s)
    Liked
    3610 times
    Feedbacks
    135 (100%)
    I’ve improved on this. I will update it here rather than edit the top of the post as its slightly more complex and complicated for anyone who doesn’t want the functionality.

    I’ve added 2 x additional features;

    1) Set-up a log of the torrent information (ratio etc) at the time the torrents are moved from deluge to rtorrent.

    2) Enable sorting of torrent storage locations by deluge plugin LabelPlus (for e.g. so all Movies / TV are saved into a ‘Movies’ / ‘TV’ folder or as I use it to save into folder based on the tracker.

    Deluge Log

    This is straightforward. The below line is added into delugeExport.sh (revised script at the bottom of this post). Each new torrent is appended to the end of the torrent_info.txt file.

    deluge-console info "$torrentid" >> $HOME/src/torrent_info.txt
    Sorting by Folder

    First of all you will need to set-up LabelPlus so that torrents are automatically labelled as per the folder you want to store them and saved to that folder, for e.g. for Broadcasthe.net I use “BTN” based on a check of the tracker name, i.e. when the plugin sees a torrent from the BTN tracker it automatically assigns the label BTN to the torrent and saves it to the location /any_folder/BTN. (note: the label and folder don’t have to match but why complicate things).

    Now you need a new script, label.py, that extracts the label (“BTN” in this example). This new script is then called from within delugeExport.sh and the output used to set the rtorrent watch folder location. The script label.py is at the bottom of this post, save to ~/src/label.py and make it executable "chmod +x label.py"

    Rtorrent set-up

    As described above you will require a separate watch folder for each label and also specify the relevant download location. Example below;

    schedule = watch_directory,5,5,"load.start=/home/Download/watch/BTN/*.torrent,d.directory.set=/home/Download/BTN/"

    schedule = watch_directory,5,5,"load.start=/home/Download/watch/Movies/*.torrent,d.directory.set=/home/Download/Movies/"
    You will need to create the relevant folders, rtorrent wont do it for you. Remember to restart rtorrent after making these changes.

    The revised delugeExport.sh pulling all this together is shown below;

    #!/bin/bash

    ################################################## ##################

    ### Please fill in the variables below! ###

    ################################################## ##################

    #sleep 30m


    # Which folder are you keeping rtorrent_fast_resume.pl in?

    dir=$HOME/src


    # Do not change this unless you have knowingly changed Deluge's

    # state folder.

    files=$HOME/.config/deluge/state



    ### ###

    # This script is designed to be used alongside the Execute plugin! #

    ### ###



    torrentid=$1

    torrentname=$2

    torrentpath=$3

    #### Extract labelplus from label.py and set watch directory based on this ####
    LABEL=$($HOME/src/label.py $torrentid)

    watch=/home/Download/watch/$LABEL
    ################################################## #

    perl $dir/rtorrent_fast_resume.pl "$torrentpath" < "$files/$torrentid.torrent" > "$watch/$torrentname.$RANDOM.torrent"

    deluge-console info "$torrentid" >> $HOME/src/torrent_info.txt

    deluge-console rm "$torrentid"
    Here is the python script for extracting the labelplus name from Deluge;


    #!/usr/bin/python

    import sys
    from deluge.ui.client import client
    from twisted.internet import reactor

    # Set up the logger to print out errors
    from deluge.log import setupLogger
    setupLogger()

    d = client.connect()

    torrent_id = sys.argv[1]

    def on_connect_success(result):
    def on_get_torrent_status(torrent):
    print torrent["labelplus_name"]
    client.disconnect()
    reactor.stop()

    client.core.get_torrent_status(torrent_id, ["labelplus_name"]).addCallback(on_get_torrent_status)

    d.addCallback(on_connect_success)

    def on_connect_fail(result):
    print result
    reactor.stop()

    d.addErrback(on_connect_fail)

    reactor.run()
    Rhialto and VoidBender like this.

  3. #3
    User cagriu1905's Avatar
    Reputation Points
    934
    Reputation Power
    36
    Join Date
    Dec 2016
    Posts
    68
    Time Online
    5 d 12 h 10 m
    Avg. Time Online
    2 m
    Mentioned
    15 Post(s)
    Quoted
    6 Post(s)
    Liked
    31 times
    Feedbacks
    7 (100%)
    So clear, thank you

  4. #4
    User
    Smolko's Avatar
    Reputation Points
    5555
    Reputation Power
    82
    Join Date
    Dec 2016
    Posts
    66
    Time Online
    1 d 15 h 7 m
    Avg. Time Online
    N/A
    Mentioned
    126 Post(s)
    Quoted
    14 Post(s)
    Liked
    160 times
    Feedbacks
    9 (100%)
    is anybody using that script?
    Tried to set up script from the first post but if I execute it I get error:
    ./delugeExport.sh: line 45: home/seedbox/.config/deluge/state/.torrent: No such file or directory
    Failed to connect to 127.0.0.1:58846 with reason: Connection refused

    btw my deluge works on 28100 port, not on 58846. Don't know how to change it.

  5. #5
    Donor
    loler's Avatar
    Reputation Points
    2031
    Reputation Power
    45
    Join Date
    Jul 2017
    Posts
    40
    Time Online
    2 d 3 h 52 m
    Avg. Time Online
    1 m
    Mentioned
    3 Post(s)
    Quoted
    15 Post(s)
    Liked
    25 times
    Feedbacks
    0
    Quote Originally Posted by Smolko View Post
    is anybody using that script?
    Tried to set up script from the first post but if I execute it I get error:
    ./delugeExport.sh: line 45: home/seedbox/.config/deluge/state/.torrent: No such file or directory
    Failed to connect to 127.0.0.1:58846 with reason: Connection refused

    btw my deluge works on 28100 port, not on 58846. Don't know how to change it.
    The error "No such file or directory" means that the file "home/seedbox/.config/deluge/state/.torrent"
    doesn't exist. Two things I noticed:

    1. The error says home/... instead of /home/...
    2. Is your actual user really seedbox? What does this command return if you execute it in your shell:

    echo $HOME

    Edit: I'm not using the script, but the "no such file or directory" error is very common in Unix-like
    operating systems and I thought I would give a try to help you resolving it if I can.
    Rhialto likes this.


LinkBacks (?)

  1. 06-02-2023, 02:22 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •