[GUIDE] Fully Automated Media Center with qBittorrent

Running FileBot from the console, Groovy scripting, shell scripts, etc
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by rednoah »

The variables changed, so %f is now %F and there's new ones as well. The command template changed, but even if you use the old one, filebot should still be called, so there should be logs. If there's no logs, then filebot is never started.

If something is not working, and you don't know why, but still use filebot.launcher.exe instead of filebot.exe, then really really shouldn't use filebot.launcher.exe in the first place, until you know what you're doing.
:idea: Please read the FAQ and How to Request Help.
joedo
Posts: 3
Joined: 01 Dec 2015, 00:05

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by joedo »

Sod this.. I've not got time to mess around trying to fix it. I've gone back to 3.2.5 and it's working fine. If it doesn't even execute filebot and, as I said, there's no mention of it failing at anything in the qbittorrent logs. No sign of java in task manager.. it's got to be a bug in 3.3.

I don't know what you are referring to regarding not using filebot.launcher.exe instead of filebot.exe... what's the difference? The UI isn't popping up.. is there a technical reason why I shouldn't use it? It's not difficult to edit either way.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by rednoah »

filebot.exe is a Console application, filebot.launcher.exe is a GUI application.

If you see the Console, you know that it's called, and you'll see all the output. If you don't have a Console you will see nothing, you won't know if it's called, and you won't know when/where/how it failed.

qBittorrent doesn't log output of external commands, but if it did, using filebot.launcher.exe would also make that impossible.

Try something simple, like calling notepad, to confirm that the "run command" feature is working or not.
:idea: Please read the FAQ and How to Request Help.
dem61s
Power User
Posts: 5
Joined: 29 Oct 2015, 23:04

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by dem61s »

Sorry for taking so long to get back to you rednoah. I wanted to let my scripts run for a while before confirming whether or not I got things right. It may be a little late, but here it is anyway:

--def "ut_label=%L" "%F" has been working like a charm for me so far. --def "ut_dir=%F" "ut_kind=multi" "ut_label=%L" has been working just as well (leaving ut_file completely unspecified). I am not sure which of the two working alternatives is the most advisable.
Related side note: while %F would refer to the folder in previous versions, it now appends to the filename as well in the case of single file torrents, which AMC seems more than happy to handle. The heavy reliance on the exclude list for single file torrents described earlier in this topic should not be an issue anymore.

I would have toyed with ut_title=%N and/or whatever may be an appropriate equivalent for ut_state as well, but I am simply not quite sure what these parameters are intended to accomplish in the first place.

Reading through this topic, I would also point out that qbittorrent now comes with a warning that its parameters are case sensitive (and upper case: could that be your problem joedo?).

NB: All tests were done on qbittorrent 3.3.0 & Windows 7. If there are any additional scripts/tests to run on qbittorrent, I am happy to do so and provide whatever logs may be useful.



See a few useless examples below.

Code: Select all

Parameter: ut_label = ignore
Input: random episode from the Simpsons
Finished without processing any files
*read with Bart Simpson's voice* HAHAHA! He can't even find the most basic TV show now.

Code: Select all

Parameter: ut_label = TV Shows
Input: random episode from the Simpsons
Rename episodes using [TheTVDB]
Good boy...

Code: Select all

Parameter: ut_label = 
Input: random episode from the Simpsons
Rename episodes using [TheTVDB]
No 'TV' or 'Show' in the path either and you can still find it? Well done mate.

Code: Select all

Parameter: ut_label = Movies
Input: random episode from the Simpsons
Finished without processing any files
Wasn't there a Simpsons movie? I really expected something to get fucked up here...

Alright, let's play along:

Code: Select all

Parameter: ut_label = Dirty Movies
Input: random episode from the Simpsons
Rename episodes using [TheTVDB]
Well, that was an unexpected match. You've got a dirty mind my dear sir.


Conclusion: While AMC's log remained mostly clean while dealing with whatever creative tagging I could think of, some amount of dirtyness remained unavoidable since AMC insists on sticking its nose (or any other body part I would suppose) into any download tagged as a "Dirty Movie".

The only issues I have left merely seem to stem from my crappy scripting capabilities which fail at processing subtitles in the way I want them too. Nothing I can blame on either filebot or qbittorrent I am afraid.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by ZeroByDivide »

Dunno why this is happening for me but I recently updated filebot to the latest version (I'm running the portable version btw) but when ever I download a show/movie/anime/whatever, filebot never seems to work correctly anymore.

I'm currently running filebot 4.6.1
Qbittorrent 3.3.1

Every time I download a movie or tv show I always get this error -

Code: Select all

Run script [fn:amc] at [Tue Dec 08 11:07:09 CST 2015]
Parameter: subtitles = en
Parameter: deleteAfterExtract = y
Parameter: clean = y
Parameter: ut_title = Quantico.S01E10.HDTV.x264-LOL[ettv]
Parameter: ut_label = 
Parameter: ut_file = C:\Users\timta\Desktop\QBT\Quantico.S01E10.HDTV.x264-LOL[ettv]
Parameter: ut_dir = C:\Users\timta\Desktop\QBT\
MissingPropertyException: No such property: ut_kind for class: Script1
groovy.lang.MissingPropertyException: No such property: ut_kind for class: Script1
	at Script1.run(Script1.groovy:183)
	at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:61)
	at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:82)
	at net.filebot.cli.ArgumentProcessor.process(ArgumentProcessor.java:114)
	at net.filebot.Main.main(Main.java:169)
Failure (°_°)
and this is how my script looks like inside of qbittorent -

Code: Select all

filebot -script fn:amc --output "C:/Users/timta/Videos" --log-file amc.log --conflict auto -non-strict --filter "age < 250" --def subtitles=en deleteAfterExtract=y clean=y "ut_title=%N" "ut_label=%L" "ut_file=%F" "ut_dir=%D"
The same code was working before I updated to the latest version of filebot but even doing a downgrade doesn't fix it..
now the thing is I dunno where it's pulling this whole ut_kind thing out of since I don't have it in my code since qbittorent doesn't support ut_kind at all. I've tried downgrading both qbittorent and filebot to earlier versions already to see if that would fix it but to no avail at all :( so I'm currently lost on what the issue could be, hopefully someone can help me out with what the issue is.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by rednoah »

1.
If my call says --def ut_kind=multi and works... but your call doesn't and fails with an error regarding ut_kind... I'm sure you'll figure it out. ;)

@see viewtopic.php?f=4&t=215#p9774


2.
Apparently %F is the a file/folder the downloaded files, whereas %D is the downloads folder that contains everything:

Code: Select all

Parameter: ut_file = C:\Users\timta\Desktop\QBT\Quantico.S01E10.HDTV.x264-LOL[ettv]
Parameter: ut_dir = C:\Users\timta\Desktop\QBT\
Is there any particular reason why you don't stick to the recommended usage?

Code: Select all

"ut_dir=%F" "ut_kind=multi" "ut_title=%N" "ut_label=%L"
@see viewtopic.php?f=4&t=215#p9774
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by ZeroByDivide »

Well I didn't think ut_kind was needed since it always worked before without it, it just recently stopped working once I did the update to filebot from 4.6 to 4.6.1 .. as for the second thing I don't really have an answer for that, was just an extra I added in on accident.

anyways that looks to have fixed it though.. dunno why it worked before without ut_kind and now it doesn't work unless it has ut_kind...
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by rednoah »

ut_kind is needed if both ut_dir and ut_file is specified

PS: make sure you're not accidentally processing your entire downloads folder over and over ;)
:idea: Please read the FAQ and How to Request Help.
ZeroByDivide
Posts: 170
Joined: 16 Dec 2014, 01:39

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by ZeroByDivide »

Ah well that would explain my problem then xD and haha I'm not processing my entire downloads folder over and over, always goes through the folder for the torrent download and that's it after it renames and moves the file to the correct place and deletes left over files the script stops like it should.
thebestnumberis42
Posts: 11
Joined: 12 Aug 2015, 15:21

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by thebestnumberis42 »

Just FYI for those who updated to qBittorent 3.3.5, a length limit was accidentally imposed on the external command length. See github comment: https://github.com/qbittorrent/qBittorrent/issues/5399

Most likely this means your downloads aren't being processed by the AMC script. It looks like it's being fixed, but if you happen to get the following error in your qBittorrent log, that's why.

Code: Select all

run external program command too long (length > 260), execution failed.
@rednoah - Thank you for creating and supporting a fantastic piece of software. I never realized how much I relied on it until it wasn't there / being used. I tried donating 3 times just now but PP is being difficult. I'll keep trying until you get the donation.
[edit] fourth time's a charm. Thank you.
cowrecked
Posts: 1
Joined: 22 Jun 2016, 05:01

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by cowrecked »

Just FYI for those who updated to qBittorent 3.3.5, a length limit was accidentally imposed on the external command length. See github comment: https://github.com/qbittorrent/qBittorrent/issues/5399

Most likely this means your downloads aren't being processed by the AMC script. It looks like it's being fixed, but if you happen to get the following error in your qBittorrent log, that's why.
OK, glad it wasn't just me. I just spent the last hour or so trying to figure out why amc wasn't working anymore. I finally got it working by reverting back to qBittorrent 3.3.3.

Also, obligatory thank you to rednoah, donation sent your way as well!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by rednoah »

1.
Use @file syntax to pass command-line arguments (e.g. lengthy format expressions) via external text files:
viewtopic.php?f=3&t=3244


2.
I never realized how much I relied on it until it wasn't there / being used
I guess that's the definition of successful technologies: become invisible and taken for granted :lol:
:idea: Please read the FAQ and How to Request Help.
filebotuser
Posts: 1
Joined: 22 Jun 2016, 13:22

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by filebotuser »

rednoah wrote:1.
Use @file syntax to pass command-line arguments (e.g. lengthy format expressions) via external text files:
viewtopic.php?f=3&t=3244
Could someone possibly give an example of this? I'm having trouble understanding what I need to do to set this up. I'm trying to use these arguments to process files.

Code: Select all

"C:/Program Files/FileBot/filebot.launcher.exe" -script fn:amc --output "D:/Windows Related/Videos" --log-file amc.log --action copy --conflict override -non-strict --def music=y artwork=n clean=y deleteAfterExtract=y excludeList=amc.txt "ut_dir=%F" "ut_kind=multi" "ut_title=%N"
Thanks for your time.
thebestnumberis42
Posts: 11
Joined: 12 Aug 2015, 15:21

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by thebestnumberis42 »

filebotuser wrote: Could someone possibly give an example of this? I'm having trouble understanding what I need to do to set this up. I'm trying to use these arguments to process files.
My guess is your command would be something like:

Code: Select all

"C:/Program Files/FileBot/filebot.launcher.exe" -script fn:amc --output "D:/Windows Related/Videos" --log-file amc.log --action copy --conflict override -non-strict --def @"D:/arguments.txt"
And your arguments.txt file would maybe be:

Code: Select all

music=y
artwork=n 
clean=y
deleteAfterExtract=y 
excludeList=amc.txt
"ut_dir=%F"
"ut_kind=multi"
"ut_title=%N"
Based on your command it sounds like you're running windows. In rednoah's link the comments say to not use a windows program to edit the text file. I would recommend notepad++. It should let you create a text file with relevant encoding (CP1252) and no extra invisible characters.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by rednoah »

qBT won't be able to replace the %variables if you do it like that though...

It'll look more like this:

Code: Select all

filebot @/path/to/args.txt --def "ut_dir=%F" "ut_kind=multi" "ut_title=%N"
:idea: Please read the FAQ and How to Request Help.
thebestnumberis42
Posts: 11
Joined: 12 Aug 2015, 15:21

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by thebestnumberis42 »

rednoah wrote:qBT won't be able to replace the %variables if you do it like that though...
Thanks for the correction. qBT properly parses the command now, I didn't know I could move everything but the %variables to the args.txt file. Thanks for the great tip. Unfortunately the command still fails, since with both %F and %N the command is still longer than 260 characters. My torrent names just happen to be too damn long.

I presumably need both "ut_dir=%F and "ut_title=%N" for filebot to process correctly, right? Would I be able to get by with just "ut_dir=%F" since %F also appends the file name or does Filebot need both ut_dir and ut_title to function properly?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by rednoah »

You might be able to get away with not passing in ut_title.
:idea: Please read the FAQ and How to Request Help.
thebestnumberis42
Posts: 11
Joined: 12 Aug 2015, 15:21

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by thebestnumberis42 »

@rednoah - If I should start a new thread to not hijack this one, please let me know and I'll do it.

I'm not sure if removing ut_title worked or not. I tried both with and without both ut_title and ut_dir but FileBot wasn't being called from qBT. Checked both FileBot and qBT logs but no external command call. I downgraded to qBT 3.3.4 and then 3.3.3 each time trying a combination of different commands, but still no FileBot call. Frustrated, I tried your tip to use cmd and fill in qBT's variables to see wtf is going on. This is what I got.

Code: Select all

Error during startup: The filename, directory name, or volume label syntax is incorrect
java.io.IOException: The filename, directory name, or volume label syntax is incorrect
        at net.filebot.Main.initializeLogging(Main.java:397)
        at net.filebot.Main.main(Main.java:106)
Launch4j: Failed to run the given command.
I'm running windows java 8.0.910.14, FileBot version 4.7.

The file name looks right, from your tutorial. Same with the directory name and volume label syntax. The %variables have the correct slash direction "\" as qBT would output, and I'm using the correct slash direction "/" from your tutorial for the program call. I tried used launcher and platform.launcher exe's in CMD but only the regular exe outputted the error.

I must be missing something obvious. Does anything jump out at you (besides that I'm using Windows)? I'd really appreciate the advice.

Here's my external command and args.txt:

Code: Select all

"C:/Program Files/FileBot/filebot.launcher.exe" @"K:/args.txt" --def "ut_dir=%F" "ut_kind=multi" "ut_title=%N"

Code: Select all

-script fn:amc
--output "Z:"
--log-file "K:/amc.log"
--action copy
...
Last edited by thebestnumberis42 on 26 Jun 2016, 03:58, edited 1 time in total.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by rednoah »

1 line = 1 argument

Code: Select all

-script
fn:amc
--output
Z:
--log-file
K:/amc.log
...
Use -script fn:sysenv to see the argument array you're passing in, and see if it makes sense.
:idea: Please read the FAQ and How to Request Help.
thebestnumberis42
Posts: 11
Joined: 12 Aug 2015, 15:21

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by thebestnumberis42 »

Thanks for the tip rednoah - I finally got it working. FYI to others trying to use an arguments text file, make sure there's no extra white spaces anywhere, especially at the end of commands. Was hunting awhile for my syntax error until I found the damn white space.

Unfortunately I still had to downgrade qBT to 3.3.3, since even with the args txt file, the external command was too long for 3.3.5. I'll upgrade once they fix the problem, but at least now I know how the arg txt file formats work.

Here's my final command and arg txt file in case anyone wants to reference it. Thanks again rednoah.

external command

Code: Select all

"C:/Program Files/FileBot/filebot.launcher.exe" @"K:/args.txt" --def "ut_dir=%F" "ut_kind=multi" "ut_title=%N"
args.txt

Code: Select all

-script
fn:amc
--output
Z:
--log-file
K:/amc.log
--action
copy
--conflict
override
-non-strict
--def
music=n
artwork=n
reportError=y
pushover=***
seriesFormat=X:/TV/{n}/{'Season '+s}/{n} - {sxe} - {t}
movieFormat=Z:/Movies/{n} ({y})/{n} ({y})
excludeList=K:/amc.txt
benzoto
Posts: 12
Joined: 04 Oct 2016, 09:50

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by benzoto »

Hi All,

First I would like to thank for this Topic. I would like to create the Automated Media Center using Filebot and qBittorrent. The current setup that i have is as follows:

Qbit is downloading all torrents to a folder on a NAS called Z:/Downloads (obviously local drive) :)
Airvideo HD Server is running using this Z:/Downloads location as a source of the video files. No other files besides TV Shows and Movies are being downloaded in this folder.

My question would be:
- What would be the script to run if I want the FileBot just to run through the new downloaded files and download subtitles for them, without renaming, copying, moving or any other action to be performed for those video files.

I've tried few times to set it up and I experienced the following issues

- Not always the subtitles are downloaded - Bulgarian and English - using this command - subtitles=en, bg
- It ran through the Download Location and reorganize my files - Create new folder structure for the Movies/TV Shows, Rename the actual video file

I would appreciate your support and I'm looking forward for your reply.

Regards,
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by rednoah »

* The amc script is about organizing your files. If you don't want to organize your files you can't use the amc script
* Subtitles are not always available (especially for uncommon languages like Bulgarian)

Please read: viewtopic.php?t=5#p8871
:idea: Please read the FAQ and How to Request Help.
benzoto
Posts: 12
Joined: 04 Oct 2016, 09:50

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by benzoto »

Hi,

Thank you for the reply.

So I would not need the AMC script, the thing that I would need to set the Fetch subtitles as per the other thread. Could you please just confirm if the script would look like this, having in mind my Home Setup?

filebot -script fn:suball Z:/Downloads --lang en,bg -non-strict --def maxAgeDays=3

And one more thing, do I add it still in the "Run external program on torrent completion" or I would need to set it as a Scheduled Task or automated CMD script. I know that sometimes Bulgarian subtitles might not be available, that's why i would like to check for both languages - BG and EN.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by rednoah »

1. Open CMD
2. Run the command
3. Read at the output and see if it's doing what you want it to do

You'll probably wanna add --log-file suball.log just in case.
:idea: Please read the FAQ and How to Request Help.
benzoto
Posts: 12
Joined: 04 Oct 2016, 09:50

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by benzoto »

I've ran the following script using CMD as Administrator and CMD advised it is COMPLETED.

filebot -script fn:suball Z:\Downloads -non-strict --lang en,bg --def maxAgeDays=7 --log-file suball.log

However no subtitles were downloaded. The Logfile shows the following info:

Done ヾ(@⌒ー⌒@)ノ

Done ヾ(@⌒ー⌒@)ノ

Done ヾ(@⌒ー⌒@)ノ

Done ヾ(@⌒ー⌒@)ノ

Done ヾ(@⌒ー⌒@)ノ

I'm not sure where the issue is. I've also tried with filebot.launcher.exe but with this nothing happened even the log file was not filled with details.
Post Reply