Page 1 of 2
Combining scripts
Posted: 08 Sep 2016, 15:33
by saitoh183
Im using Deluge on windows and when i have torrents that are rar files, i am forced to use the Extractor plugin and it will extract the file to a single directory. The directory can contain movies and/or Tv shows. Since Deluge on windows Execution plugin doesnt seem to work, i use Windows schedule task to run my FB script on the directory every few minutes to pick up any files. Its not ideal but it works.
The problem is that i have one script for movies and one for tv shows. Would it be possible to combine the 2?
Movie script:
Code: Select all
filebot -script fn:amc --def movieFormat="D:/videos/{plex}" --action move -non-strict P:/Torrents/Completed/rar --log-file P:/scripts/movies_torrents.log --def clean=y --db TheMovieDB --def ut_label=movie -no-xattr --log Fine
TV script:
Code: Select all
filebot -script fn:amc --def seriesFormat="D:/Videos/tv/{n}/{'Season '+s}/{n} - {sxe} - {t}" --action move -non-strict P:/Torrents/Completed/rar --log-file P:/scripts/tv_torrents.log --def clean=y --db TheTVDB --def ut_label=TV -no-xattr --log Fine
For non Rar files, i already use FilebotTool but since it cant extract (yet
https://github.com/Laharah/deluge-FileBotTool/issues/8 ) i have to use the plugin. Unless you have another solution altogether to handle rar files.
Re: Combining scripts
Posted: 08 Sep 2016, 15:41
by rednoah
The amc script does auto-differentiate Movies and Episodes by default. You just happen to force one mode or the other via label.
If you need to force movie / series mode for some reason, then you can't combine the scripts (but you could set the label dynamically in the calling shell script based on some condition).
PS: The amc script can also extract archives. Some people find that useful. Others prefer other tools.
Re: Combining scripts
Posted: 08 Sep 2016, 15:57
by saitoh183
ok, so if i remove the force label it should autodetect... but what about the DB? will this also be autodetect? because since TV can be used with TheMovieDB, i dont want my tvshows to be sorted using TMDB.
I would use the extract from amc if there was a way to excute the script only when the torrent has rar files.
Re: Combining scripts
Posted: 08 Sep 2016, 16:07
by rednoah
1.
The amc script ignores your --db option so you can't set a preferred database anyway.
2.
The amc script will extract any kind of archive that is passed in as input, not just rar files.
Re: Combining scripts
Posted: 08 Sep 2016, 17:53
by saitoh183
1- ok thats good to know. so would this work for both?
Code: Select all
filebot -script fn:amc --def movieFormat="D:/videos/{plex}" seriesFormat="D:/Videos/tv/{n}/{'Season '+s}/{n} - {sxe} - {t}" --action move -non-strict P:/Torrents/Completed/rar --log-file P:/scripts/torrents.log --def clean=y -no-xattr --log Fine
2- but i only need the script for rar since i use Filebottool for everything else..but i guess i could only use the script for everything except my french TV content since it is in its own media folder and use Filebottool for my french media only...unless seriesFormat can handle multiple paths in some way and languages...maybe using Deluge label?
Because i have Deluge watching multiple folders using autoAdd. AutoAdd also sets the completed download path for each and label. Then my French shows need to sent to D:\Videos\FrenchTV and english to D:\Videos\TV
Re: Combining scripts
Posted: 09 Sep 2016, 02:23
by rednoah
Your format may check the original path, or the audio language, or anything else that might be different for French shows, and then do different things depending on that.
Re: Combining scripts
Posted: 09 Sep 2016, 02:27
by saitoh183
rednoah wrote:Your format may check the original path, and then do different things depending on that.
I dont understand your answer...can you elaborate?
Re: Combining scripts
Posted: 09 Sep 2016, 02:29
by rednoah
e.g. Move French TV (detect based on original path) to a different drive or folder:
Code: Select all
{file =~ /FrenchTV/ ? 'F:/French TV' : 'E:/TV'}
Re: Combining scripts
Posted: 09 Sep 2016, 02:35
by saitoh183
I can do this with the AMC script?
Re: Combining scripts
Posted: 09 Sep 2016, 02:43
by rednoah
Does the amc script allow you to use a FileBot Format? Yes~
Please look at the examples:
http://www.filebot.net/forums/viewtopic.php?f=5&t=2#p51
PS: If you don't know what you're doing, I highly recommend using the GUI first to play and test your format.
Re: Combining scripts
Posted: 09 Sep 2016, 02:47
by saitoh183
I do know.. and learning at the same time...i didnt mean about format i mean the piece of code you posted
Re: Combining scripts
Posted: 11 Sep 2016, 01:04
by saitoh183
I'm a bit confused about how I would integrate that snippet with calling the amc. Would I be adding it to the seriesformat?
What I would like to achieve if possible with one script is to move tv shows and Movies based on language and if the movie is dual audio, they go into a third folder. It would also need to extract files if necessary.
The way i have my media setup is:
- Deluge for Torrents
- sabnzbd for usenet
Torrents:
Autoadd watching folders
- one for TV shows (auto label to tv)
- one for French tv (auto label to frtv)
- one for French movies and dual audio (auto label to movfr)
- one for English movies (auto label mov)
Completed files go into ... \completed\(label)\
When the files are finished downloading(and extracted if necessary) , i just need to rename and move them to my media directory.
Currently I have powershell script that I use for dual audio. Since every French movie is either going to be single French audio or French and English audio, i have filebot tool move the renamed movie to a folder which I then run my powershell script against and determine if there is 1 or 2 audio streams (using mediainfo CLI) and the results will move it to French movies or dual audio movies.
I don't need to seed because that is done from another machine so no need to keep a copy
Usenet:
The completed files are not in the same location and there is no French tv or movies.
Can all this be achieved with filebot, within a single script and this single script can be used for Torrent and usenet? And if so, would it be possible to pay you create it. I know I could probably do it, but it would take me alot more time and would probably be very poorly coded.
Thanks
Re: Combining scripts
Posted: 11 Sep 2016, 02:08
by rednoah
You can access MediaInfo in the format code, so it could easily check for number of audio streams, current file path, etc and then do things differently depending on that.
Sure, but let's just say my paid rate is high (~50 EUR) because most help is for free and any solution here will be free for others to copy as well.

Re: Combining scripts
Posted: 11 Sep 2016, 02:53
by saitoh183
Would 50 eur be enough to do the job...? I don't mind that the solution will be public. The way i see it is that you have a great tool, your helping me use this tool and the fee is worth while if it fixes my problem. As for it being public, well that is what community is all about.
Re: Combining scripts
Posted: 11 Sep 2016, 03:23
by rednoah
All solutions are always public.
1.
A simple condition might look like this:
Code: Select all
{audio.size() > 1 ? 'Dual Audio' : 'Single Audio'}
2.
A complete movie format might look like this:
Code: Select all
D:/{audio.size() > 1 ? 'French Videos' : 'Videos'}/{plex}
Although, it might make more sense to put all videos that have French audio language into the French Videos folder regardless of number of audio streams:
Code: Select all
D:/{'fr' in audio.language ? 'French Videos' : 'Videos'}/{plex}
3.
Example with 3 different output folders: Multi Audio, French Single Audio and English/Other Single Audio
Code: Select all
D:/{audio.size() > 1 ? 'Multi Audio Videos' : 'fr' in audio.language ? 'French Videos' : 'English Videos'}/{plex}
Since I can't know what exactly you want, you'll need to come up with some examples of how these solutions are different from what you want.

Re: Combining scripts
Posted: 11 Sep 2016, 03:55
by saitoh183
The reason for the separation of dual audio and French movies is because my English users won't have French movie library in plex but both English and French users will have access to dual audio movie library. My dual audio will always be English and French. So if the movie is French only then it is moves to the d:\videos\French movies and dual audio goes to d:\videos\dual audio movies
Re: Combining scripts
Posted: 11 Sep 2016, 04:11
by rednoah
I recommend using Dual/French/English media folder and then having the usual Movies / TV Shows folders within that as per Plex conventions.
If you really want "French Movies" folder next to the "Movies" within the same plex media folder then that's possible of course.
Re: Combining scripts
Posted: 11 Sep 2016, 04:37
by saitoh183
You mean having d:\videos\tv\dual for example? If that is the case, why would I need to do this? I have had this setup forever and changing it will be very complicated. My method works fine for plex. I don't combine the movie folders into one plex movie library.
My current setup is:
Code: Select all
D:\videos\tv
D:\videos\movies
D:\videos\frenchtv
D:\videos\French movies
D:\videos\dual audio movies
This works perfectly in plex. I don't see the reason to have another folder level.
Re: Combining scripts
Posted: 11 Sep 2016, 05:10
by rednoah
I mean:
Code: Select all
D:\Dual Audio Media\Movies
D:\Dual Audio Media\TV Shows
D:\French Media\Movies
D:\French Media\TV Shows
...
@see
https://support.plex.tv/hc/en-us/articl ... ovie-files
This would make the format more simple because you can just use
{plex} and you'd be able to use the same format for TV
and Movie types.
Your organization scheme is possible, but the format will be more verbose and you'll need different formats for each type. I'm sure it'll work, but it's slightly less close to the Plex standard, and if you ever want to modify your format it'll be more work there as well.
Movie Format
Posted: 11 Sep 2016, 05:19
by rednoah
Your movie format:
Code: Select all
D:/videos/{audio.size() > 1 ? 'dual audio movies' : 'fr' in audio.language ? 'French movies' : 'movies'}/{plex[1..-1]}
Your series format:
Code: Select all
D:/videos/{'fr' in audio.language ? 'frenchtv' : 'tv'}/{plex[1..-1]}
Re: Combining scripts
Posted: 11 Sep 2016, 05:48
by saitoh183
My problem is that my media is on google drive and mounted via netdrive2. Changing structure with the amount of media I have will make plex scan for days to move every. If this was on my local server, it wouldn't be to bad but this script would be for my vps. The script you posted are if I were to change structure?
Re: Combining scripts
Posted: 11 Sep 2016, 06:15
by rednoah
The last two scripts create exactly the structure you want (as far as I know). Just need to plug them into your amc script call. I highly recommend using the FileBot GUI or the CLI with
--action test to preview how things would work though.
You should ALWAYS test any command-line call standalone manually, before you have other tools run it in an automated fashion.

Re: Combining scripts
Posted: 11 Sep 2016, 13:45
by saitoh183
Another question in regards to French tv shows, I'm guessing I need to force lookup in tvdb in French when French audio is detected? How can add that with the script?
Re: Combining scripts
Posted: 11 Sep 2016, 13:56
by rednoah
Since
--lang fr is passed along with your format, there is no way for the format to change the
--lang option retroactively.
You can access localized Episode data in the format though. The rest is just if-then-else like in the previous examples.
French Series Name:
French Episode Title:
Re: Combining scripts
Posted: 11 Sep 2016, 14:08
by saitoh183
Ok.. I will try to test this out once I get home.