[Script] Filebot auto rename, categorize, subtitle, artwork

Suggest, post, or discuss plugins for Deluge
rednoah
New User
New User
Posts: 4
Joined: Sun Apr 11, 2010 3:36 pm

Re: [Script] Filebot auto rename, categorize, subtitle, artw

Post by rednoah »

Here's what I came up with re how to integrate filebot with deluge:
http://filebot.sourceforge.net/forums/v ... 3382#p3382
jlatour88
Member
Member
Posts: 10
Joined: Sun Aug 19, 2012 7:57 pm

Re: [Script] Filebot auto rename, categorize, subtitle, artw

Post by jlatour88 »

when i try running the completed script i get the following error-

Code: Select all

josh@myserver:~/delugescripts$ ./completed
Traceback (most recent call last):
  File "./completed", line 30, in <module>
    if sys.argv[1] == 'test':
IndexError: list index out of range
Any idea what this means or how to fix it?
aristidesfl
New User
New User
Posts: 8
Joined: Sat Jul 07, 2012 4:46 am

Re: [Script] Filebot auto rename, categorize, subtitle, artw

Post by aristidesfl »

You are not giving the program any arguments. To work the program expects 3 arguments from deluge:
1. torrent id
2. torrent
3. torrent location

So it would be something like this:
completed.py 203948023sfl957905898fij602394 MyTtvshow /Path/to/the/folder/wheremytvshow/is/in

This plugin has a whitelist functionality where you can choose filebot to run only on files downloaded from selected trackers.
It uses the torrent id to connect to deluge and inquire about the tracker of the torrent.
If you just want to test it out and don't have a torrent ID, you can use the word 'test' instead like so:
completed.py test MyTtvshow /Path/to/the/folder/wheremytvshow/is/in

If you don't want the tracker whitelist functionality neither the growl notifications, you should use the simpler script rednoah created:
http://www.filebot.net/forums/viewtopic ... 3382#p3382
jlatour88
Member
Member
Posts: 10
Joined: Sun Aug 19, 2012 7:57 pm

Re: [Script] Filebot auto rename, categorize, subtitle, artw

Post by jlatour88 »

thanks for the quick reply :) . and ok that makes sense i didnt think of that. and i tried using rednoah script but its saying the "filebot: command not found" which i asume is because im using the portable version of filebot in .jar format. is there a better version i should be using instead of the portable version? im using a ubuntu server with no GUI only cmd.
aristidesfl
New User
New User
Posts: 8
Joined: Sat Jul 07, 2012 4:46 am

Re: [Script] Filebot auto rename, categorize, subtitle, artw

Post by aristidesfl »

You can modify the script to call the portable version instead or you can install filebot using one of the deb packages available here: http://www.filebot.net/
32bit: http://www.filebot.net/download.php?mod ... &arch=i386
64bit: http://www.filebot.net/download.php?mod ... arch=amd64

after downloading one of them you just have to run

Code: Select all

sudo dpkg -i packageNameHere.deb
jlatour88
Member
Member
Posts: 10
Joined: Sun Aug 19, 2012 7:57 pm

Re: [Script] Filebot auto rename, categorize, subtitle, artw

Post by jlatour88 »

ok that worked. i installed the 64 bit deb package and installed it. one more question, when i run the test argument for this script what am i supose to see to make sure it works and what should i look out for?

Update this is what i got with the test
------
INFO:root:Starting filebot

(process:14341): GLib-GIO-ERROR **: Settings schema 'org.gnome.system.proxy' is not installed

/usr/bin/filebot: line 2: 14341 Trace/breakpoint trap (core dumped) java -Xmx256m -Dunixfs=false -DuseGVFS=true -DuseExtendedFileAttributes=true -Djava.net.useSystemProxies=true -Dsun.net.client.defaultConnectTimeout=10000 -Dsun.net.client.defaultReadTimeout=60000 -Dapplication.deployment=deb -Dapplication.analytics=true -Dapplication.warmup=true -Dapplication.dir=$HOME/.filebot -Djava.io.tmpdir=$HOME/.filebot/temp -Djna.library.path=/usr/share/filebot -Djava.library.path=/usr/share/filebot -jar /usr/share/filebot/FileBot.jar "$@"
ERROR:root:Something happened
-----
am i missing a dependency?

UPDATE- i see its just showing the contents of the filebot.sh file located in /usr/share/filebot/bin/
jlatour88
Member
Member
Posts: 10
Joined: Sun Aug 19, 2012 7:57 pm

Re: [Script] Filebot auto rename, categorize, subtitle, artw

Post by jlatour88 »

Never mind i figured it out. had to install glib-networking using apt-get.

i did a test and it seems everything passed, or atleast it says filebot finished with success. I do see some small issues but nothing i cant handle. thanks for the fast reply and help aristidesfl. much appreciated.

UPDATE- im still looking but i figured id ask here anyway. I noticed that it was placing the finished shows in its own folder, now thats not a huge issue however i was wondering if there is a way to change the default location? also i seen that its looking for subtitles even though i have set the perimeter to false. its not reading the false state i guess, any ideas how to fix?
example of what i mean is below.

Code: Select all

INFO:root:Starting filebot
Parameter: ut_kind = multi
Parameter: ut_dir = ****
Parameter: subtitles = false
Parameter: artwork = false
Parameter: plex = localhost
Parameter: gmail = ***********
Parameter: mailto = ***********
Input: ****
Group: [tvs:The Walking Dead] => [The Walking Dead S03E01 - Seed by YahSoft.mp4]
Get [false] subtitles for 1 files
Looking up subtitles by filehash via OpenSubtitles
Lookup by hash failed: SubLanguageID for 'false' not found
Looking up subtitles by filehash via Sublight
Lookup by hash failed: java.lang.IllegalStateException: Sublight login has not been configured
Searching for [The Walking Dead] at [OpenSubtitles]
Search for [The Walking Dead] failed: SubLanguageID for 'false' not found
Searching for [The Walking Dead] at [Sublight]
Search for [The Walking Dead] failed: Sublight login has not been configured
Searching for [The Walking Dead] at [Subscene]
No matching subtitles found: *****
****Removed rename output*****
Processed 1 files
Notify Plex: localhost
     [mail] Sending email: [FileBot] [The Walking Dead Season 3 Mid Season Complet HDTV]
     [mail] Sent email with 0 attachments
Done ヾ(@⌒ー⌒@)ノ
INFO:root:Filebot finished with success
Lucy_Miky

Re: [Script] Filebot auto rename, categorize, subtitle, artw

Post by Lucy_Miky »

You have to give them executable permissions, edit the options inside and add it to the execute plugin on Deluge.

_________________
Hello!I am Lucy_Miky.I like play games.Like these Wow Gold,Aion Kinah, Guild Wars 2 Gold and Diablo 3 Gold.Anyone interesting?I hope someone can paly with me.
Nooblazor
New User
New User
Posts: 8
Joined: Sun Apr 28, 2013 9:15 am

Re: [Script] Filebot auto rename, categorize, subtitle, artw

Post by Nooblazor »

There appear to be a couple of small issues with the completed.py script.
First and foremost is found on line 89 which should be changed to something like:

Code: Select all

errorCode = subprocess.call("filebot -script fn:utorrent-postprocess -non-strict --def ut_kind=multi --defut_dir= \"%s/%s\" " % (sys.argv[3], sys.argv[2]) + ' '.join(filebotOptions), shell=True)
Note the change: --defut_dir= \"%s/%s\"
This will properly escape torrent names which could cause the script to malfunction in certain cases (e.g. when there's an apostrophe in the torrent name).

Also just side note, in case someone is interested, in order to make this script work with Label Plus (http://forum.deluge-torrent.org/viewtop ... =9&t=42629) you'd need to change the section beginning on line 63 to:

Code: Select all

# get label from deluge
def on_connect_success(result):
    logging.debug('Connected to Deluge')
    return client.core.get_torrent_status(sys.argv[1], ["labelplus_name"]).addCallback(on_get_torrent_status)


def on_connect_fail(result):
    logging.error("Connection failed: %s" % result)


def on_get_torrent_status(torrent):

    # Don't process with filebot if in label blacklist
    if torrent["labelplus_name"] not in scriptOptions['whitelist']:
        logging.info("Not a movie or tv show, nothing to do here.")
    else:
        call_filebot()

    return disconnect()
Hope someone finds this useful.

EDIT
Since I'm running these scripts on a home server, I just made a whole bunch of modifications to the script which let it send growl notification to multiple computers according to which computer added the torrent.
It's not the prettiest code in the world since I was doing it quickly but I could share it if anyone's interested.
muddro

Re: [Script] Filebot auto rename, categorize, subtitle, artw

Post by muddro »

Hi all. Sorry to bother you all but I am pretty new to linux and python and scripting and all that. Trying to get this working but having no luck. The directions in a lot of this looks like you need a fair amount of prerequisite knowledge. Anyway, what I am looking for is essentially what this offers:

1: after completion, file extracts
2: gets run through filebot to change the name
3: gets moved to my network drive in a /drive/TV Shows/name of show/season X/file
4: if possible, differentiate from movies
A. rename to: Movie (Year)
B: and send them to /drive/movies/
5: Anything not a video file doesnt get touched.

With that said, I have no idea how to get a script running in the execute plugin, or anything I am supposed to do with the script after downloading it (like is it supposed to go in a certain folder, etc)

I appreciate any help. Trying to learn all I can.
Post Reply