Page 1 of 1

Execute Plugin and Labels

Posted: Fri Feb 27, 2015 12:56 pm
by darkcircuituk
Hey all,
I'm a big fan of Deluge, I run it on 4 different machines and it has worked flawlessly up till now. In Ubuntu I am trying to get the deluge Execute plugin to talk nicely with filebot and although the vast majority of the script works great, I am hitting a problem when trying to get the label I specified with the label plugin. Does anyone have any knowledge on how to get the label within a bash script? I blindly hoped that argument 4 might be the label but nope; I have put my script below in-case it helps.

Code: Select all

#!/bin/bash
TORRENT_ID=$1
TORRENT_NAME=$2
TORRENT_PATH=$3
TORRENT_LABEL=$4

filebot -script fn:amc --output "/media/NAS" --log-file filebot.log --action test --conflict override -non-strict --def music=y artwork=n clean=y "seriesFormat=Videos/TV Shows/{n.replace(':','- ')}/Season {s}/{'S'+s.pad(2)}{'E'+e.pad(2)} - {t.replace(':','- ')}"  "ut_dir=$TORRENT_PATH/$TORRENT_NAME" "ut_kind=multi" "ut_title=$TORRENT_NAME" "ut_label=$TORRENT_LABEL"


Thanks for any help

Re: Execute Plugin and Labels

Posted: Fri Mar 06, 2015 10:30 am
by darkcircuituk
No-one has pulled out labels from deluge in a post processing script?

Re: Execute Plugin and Labels

Posted: Sun Mar 15, 2015 3:25 pm
by noze2000
+1 on this.

Sync'ing from my download (seed)box to my local NAS works great.
But I would like to not have a constand xtra opy of my downloads (need to unpack for media center Sickrage/(plex) which means that i need two copies if I am to stop a constant syncing from seedbox to local machine).

This would help a lot

Re: Execute Plugin and Labels

Posted: Mon Mar 23, 2015 10:18 am
by darkcircuituk
I did a bit of digging and found a script in a 2 year old thread that claims it can retrieve the label from a torrent, but I haven't been able to get it working. In the hope that someone can help, or that you have more luck with it than me, here it is:

getLabel.py

Code: Select all

#!/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["label"]
        client.disconnect()
        reactor.stop()

    client.core.get_torrent_status(torrent_id, ["label"]).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()


postprocessingscript:

Code: Select all

LABEL=$(/home/***/MyScripts/getLabel.py $torrentid)

Re: Execute Plugin and Labels

Posted: Tue Aug 11, 2015 1:49 pm
by sndo37
Another +1 on this. Deluge is fantastic, and the plugins are great, but I would LOVE to have to option to copy completed on a per-label basis.

Not sure if anyone is still working on the basic label plugin, but adding a "Copy" option (in addition to the pre-existing "Move" option) would save a ton of headaches for me, and probably others too:)

Re: Execute Plugin and Labels

Posted: Fri May 19, 2017 6:26 pm
by Weenyhead
Little late to this party, but in case someone finds this page like I did, here's the solution I came up with:

Set a different "move to location" (directory) for each label.
Then in your execute script you can check that directory (the path variable).

example:

Code: Select all

#!/bin/bash

torrentid=$1
torrentname=$2
torrentpath=$3

if [ $torrentpath == "/home/vpn/Downloads/complete/tv" ] ; then
    # do something to tv downloads
elif [ $torrentpath == "/home/vpn/Downloads/complete/movie" ] ; then
    # do something to movie downloads
else
    # do something with all other downloads
fi


Hope that helps :)