[GUIDE] Fully Automated Media Center with qBittorrent

Running FileBot from the console, Groovy scripting, shell scripts, etc
User avatar
whitestrake
Posts: 14
Joined: 26 Oct 2014, 07:35

[GUIDE] Fully Automated Media Center with qBittorrent

Post by whitestrake »

:: THIS GUIDE IS OUTDATED; DO NOT USE THIS GUIDE UNLESS YOU KNOW WHAT YOU ARE DOING ::


Setup Instructions for qBittorrent:
1. Install FileBot and qBittorrent and if you're on 64-bit make sure you have 64-bit Java installed.

2. Setup qBittorrent directories. Setup Location of Downloaded Files and make sure the path does not end with backslash.

3. Setup qBittorrent to run FileBot. Paste the following command into qBittorrent's "Run an external program on torrent completion" settings.

Options (Alt+O) -> Downloads -> Run an external program on torrent completion:

Code: Select all

filebot -script fn:amc --output "X:/path/to/media" --log-file amc.log --action copy --conflict override -non-strict --def music=y subtitles=en artwork=y excludeList=amc.txt "%f"
4. Change --output to where you want to copy/organize your files. Input is provided by qBittorrent variables.

5. Done! Setting this up will take less then a minute. Now wait and enjoy how things will be organized fully automatically.

6. Restart! If you have just installed FileBot or Java you may need to restart your computer to avoid PATH issues.

Note that qBittorrent has limited parameters for external programs, so it will not be able to pass ut_label, ut_state, ut_kind, or ut_file. It will only pass the main directory where it downloads torrents to, this means that setting --def excludeList is imperative to avoid getting banned.

Image

Head back to the main AMC documentation for more options and information!
User avatar
whitestrake
Posts: 14
Joined: 26 Oct 2014, 07:35

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by whitestrake »

Note for using filebot.launcher to prevent cmd from stealing focus

Due to a quirk in Qt for Windows, calling the script using filebot.launcher instead of filebot will not function correctly in qBittorrent. To counter this, use filebot.launcher.exe instead, like so:

Code: Select all

filebot.launcher.exe -script fn:amc --output "X:/path/to/media" --log-file amc.log --action copy --conflict override -non-strict --def music=y subtitles=en artwork=y excludeList=amc.txt "%f"
Chunkeebee
Posts: 4
Joined: 05 Sep 2014, 01:07

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by Chunkeebee »

Are we able to set absolute paths and naming conventions similar to uTorrent in --def?
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 »

It's always the same cmdline tool, so yes.
:idea: Please read the FAQ and How to Request Help.
Chunkeebee
Posts: 4
Joined: 05 Sep 2014, 01:07

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by Chunkeebee »

Having some dramas with this working nicely at the moment.
I loaded some 20 episodes last night through qbittorrent and only 3 were moved to the correct directory.

I am using Win 8.1 in a network situation. I am using my own P.C to run qbittorrent which loads the files onto my HTPC/Plex server directly. That runs flawlessy.

I would then usually just drag to whole directory into filebot and let it do its thing.

This morning I changed "filebot" to "filebot.launcher.exe" and the one file that has completed since looks to have worked. Though it didn't --action move the file. It copied it and left the download in its staging directory.

I haven't been able to use absolute paths yet. I usually use different drives in my server for movies or TV shows or music. Though it was just as easy to replicate the same files structure (drive://movies, drive://TV shows, drive://music) across all drives and just point the script and the drive with the most capacity.

Thoughts?

filebot.launcher.exe -script fn:amc --output "X:" --log-file amc.log --action move --conflict override -non-strict --def music=y subtitles=en artwork=y exludeList=amc.txt "%f"

is what I am using right now, though I want my staging area to be clean after it has moved the file to the rightful drive.

Be gentle - even though I work in ICT I haven't done any scripting for a long long long time. Took me an hour to work out how to open a port and configure the qbittorrent remote android app to work external to my network yesterday. (They should seriously write a better guide to using it, more people would use it)
User avatar
whitestrake
Posts: 14
Joined: 26 Oct 2014, 07:35

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by whitestrake »

Hi Chunkeebee,

As a side effect of qbt only reliably passing the root torrents folder via %f, when your first torrent finishes, filebot will run amc on everything currently in your torrents folder, including incomplete files from other torrents.

As you may be aware files currently being downloaded in qbt give "file open in another program" when you try to move/delete them. Thus when your first torrent finishes, AMC catalogs your entire torrent list, attempts to move everything (as your action is set to ’move'), and fails on every file not already finished. They are then added to the exclude list, which stops them from being scanned and actioned again later, when they are finished.

My own solution has been to use action hardlink. It creates a special form of shortcut at the filesystem level that points to the actual file. The downside is that the torrents folder and the Plex media library must be on the same disk. The upside is that it not only works on uncompleted files, but the hard linked "copies" finish as the torrents do, you spend less processing and disk time actually copying bits from one end of your hard drive to the other, and you can then simply delete the completed torrents in qbt and tick the "delete files on disk" option, and your hardlink copies stay as the real deal. I highly suggest you read up on hard links if you are unsure what they are or why they act as they do.

Hope this helps a bit.
Chunkeebee
Posts: 4
Joined: 05 Sep 2014, 01:07

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by Chunkeebee »

Thank you.

I will revert back to copy. I am happy to delete my "completed" directory from my staging area. That is easy enough to do or even schedule. My torrents files are kept on another PC from my server - not that this is a major issue, I could probably install qbittorrent on the server and use the web ui to control it. Though I will use copy for now and see how that goes.
lospo
Posts: 24
Joined: 10 Apr 2015, 16:59

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by lospo »

Hi and good morning :D

Is it possible to configure the language for the renaming?
I am italian and i'd like to see the italian title.
By now with this script it convert the italian title of my film into the english/american version.

THANKS
User avatar
whitestrake
Posts: 14
Joined: 26 Oct 2014, 07:35

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by whitestrake »

Hi lopso,

That question isn't specific to qbittorrent so you might get better luck asking in a new forum thread.

I'm sorry I can't help you as I've never had to use amc in a language other than English. I don't even know if filebot supports that as the databases it matches against are in English and I don't know if they supply metadata in other languages. I've never looked.
lospo
Posts: 24
Joined: 10 Apr 2015, 16:59

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by lospo »

sorry, i thinked that was an AMC option, but here http://www.filebot.net/cli.html thell me the truth.

Simple add the "-- lang it" at the end.
User avatar
whitestrake
Posts: 14
Joined: 26 Oct 2014, 07:35

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by whitestrake »

Glad you were able to fix the issue.

If you have any other AMC questions, feel free to open another topic.
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 »

Have you considered adding ut_title to make the report title / email subject / message subject more meaningful?

Code: Select all

--def "ut_title=%n"
:idea: Please read the FAQ and How to Request Help.
lospo
Posts: 24
Joined: 10 Apr 2015, 16:59

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by lospo »

Another question (hope in the roght place this time)

Can i set to download two languages for the subs? something like:
(my english is not so good, i need the italian subs to understand :D)

Code: Select all

subtitles=en,it
lospo
Posts: 24
Joined: 10 Apr 2015, 16:59

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by lospo »

Someone know where can i find the AMC.txt (that one: "exludeList=amc.txt")?

edit: OS Windows 7
User avatar
alexander_q
Posts: 21
Joined: 19 Aug 2014, 02:02

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by alexander_q »

I use the following script with qbittorrent:
"C:/Program Files/FileBot/filebot.launcher.exe" -script fn:amc --output "S:" --log-file amc.log --action copy --conflict override -non-strict --def music=n artwork=n xbmc=192.168.20.3 pushbullet=############# clean=y unsorted=y reportError=y "seriesFormat=S:/_TV Shows/{n}/{'Season '+s}/{fn}" "movieFormat=S:/_Movies/{n} ({y})/{fn}" "%f"
When I check my filebot logs, and indeed when I see the pushbullet notifications, I can see that filebot is processing every file in the staging area every time a new file is downloaded. How can I prevent this?
User avatar
whitestrake
Posts: 14
Joined: 26 Oct 2014, 07:35

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by whitestrake »

Hi alexander_q,

qBittorrent is limited in that it does not create subdirectories for every torrent. It also doesn't pass the full filepath via "%f". This makes it impossible to effectively target AMC to the single torrent in question for every type of torrent. I mention this in a previous post.

Use the following code to stop AMC from matching the same file multiple times.

Code: Select all

--def excludeList=amc.txt
This code is documented in the main AMC guide.
Last edited by whitestrake on 16 Nov 2015, 06:47, edited 1 time in total.
thebestnumberis42
Posts: 11
Joined: 12 Aug 2015, 15:21

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by thebestnumberis42 »

whitestrake wrote:Hi alexander_q,

qBittorrent is limited in that it does not create subdirectories for every torrent. It also doesn't pass the full filepath via "%f". This makes it impossible to effectively target AMC to the single torrent in question for every type of torrent. I mention this in a previous post.

Use the following code to stop AMC from matching the same file multiple times.

Code: Select all

--def exludeList=amc.txt
This code is documented in the main AMC guide.
In your previous post, you commented based on the assumption of moving/deleting the originally downloaded file. What if I want to keep the original file instead and copy it to a new directory for processing. Would I presumably run into the same issue where an incomplete download is processed prematurely, added to the exclusion list and never processed again, leaving an incomplete copy in the target directory? I wasn't sure if the situation was the same. I will gladly do research on the topic, but you seemed more immediately familiar.

[edit] I ask because I can't use a hard link. Where I'm copying to and where the original file resides are on two different volumes.
User avatar
whitestrake
Posts: 14
Joined: 26 Oct 2014, 07:35

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by whitestrake »

I think that would work well, as long as you targeted FileBot at your folder you send your copies to. This would also avoid issues trying to copy/move a file currently in use by qbittorrent.

If you get qbt to copy the file to a new directory itself, and then call FileBot, you might be able to keep your FileBot call anonymized, but I'd double check what qbt passes to the script - the original file or the copy.
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 »

It's excludeList, not exludeList. Some of the examples here are wrong.
:idea: Please read the FAQ and How to Request Help.
User avatar
whitestrake
Posts: 14
Joined: 26 Oct 2014, 07:35

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by whitestrake »

Thanks for the heads up - my original guide was correct, but the example I provided further on has just been corrected.
dem61s
Power User
Posts: 5
Joined: 29 Oct 2015, 23:04

Re: [GUIDE] Fully Automated Media Center with qBittorrent

Post by dem61s »

Popping in to point out that, for anyone who has updated to version 3.3.0 of qbittorrent, the list of available parameters has now been extended to:
  • %N: Torrent name
  • %L: Label
  • %F: Content path (same as root path for multifile torrent)
  • %R: Root path (first torrent subdirectory path)
  • %D: Save path
  • %C: Number of files
  • %Z: Torrent size (bytes)
  • %T: Current tracker
  • %I: Info hash
I would wager the label and path parameters ought to be useful to anyone trying to run filebot with the command line option.
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 »

I'm happy to update the default usage if you update for and test with the new parameter options.

Passing along the label to the amc script can be quite useful.
: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 »

Hi there, am mostly a visitor here. My qBittorrent execute command stopped working with the 3.3 update... I have the following..

"C:/Program Files/FileBot/filebot.launcher.exe" -script fn:amc --output "R:/FB" --log-file amc.log --action copy --conflict auto -non-strict --def music=n artwork=n excludeList=amc.txt "ut_kind=multi" "ut_dir=%f" --def unsorted=y --def "seriesFormat=R:/FB/TV Shows/{n} - {s00e00} - {t}" "animeFormat=R:/FB/Anime/{fn}" "movieFormat=R:/FB/Movies/{n} ({y})" --def clean=y

Anything looking weird here? Did the update change anything that would break it? I set it up a while ago and can't entirely remember how it all works..

Any help would be much appreciated.
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 »

: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 »

Sorry, did you want me to create a new thread? The title on this one already specifically covers the subject.. or were you pointing me to requirement of posting the log file? The log output is not getting written to... amc.txt hasn't been modified since before the 3.3 update.. as if qBittorrent doesn't run the .exe at all. There's nothing in the execution log on qbittorent.. and filebot never appears in task manager, so it's not getting that far anyway.

I have "C:/Program Files/FileBot/filebot.launcher.exe" at the start of the command.. is that correct? Tried it without quotation marks... though I don't think that will make a difference.

I've updated to the latest version of filebot.. I can load filebot from command prompt. It's there!

Not sure what to try next..
Post Reply