help with CL script

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
mustafa108
Donor
Posts: 12
Joined: 07 Jul 2014, 13:34

help with CL script

Post by mustafa108 »

Hi there! I have been using filebot for a while and have been a supporter of this great app :) I wanted to see if I could hire you to help me with a script to process files that are downloaded to my computer via goodsync.

Every night good sync checks server and downloads any new tv shows or movies into E:\incoming\

I'm hoping you can help with script to do the following:

1. identify if the file is a tv or movie, and then rename and move the file into one of the folders:

E:\Videos\TV\{n}/{"Season ${s.pad(2)}"}/{n} - {s00e00} - {t}
E:\Movies\{n} ({y})/{n} ({y}){" CD$pi"}

2. If the file is compressed... extract the file and process (rename and move)

3. I'm not sure if this is possible, but I normally copy kids movies to a different movie folder "E:\Kids Movies", not sure if there is any way to identify kids movies in a different way and move them to that folder.

I have made donations for filebot a few months ago...but would be happy to donate again if you can help with this script. Let me know :)

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

Re: help with CL script

Post by rednoah »

Yep, that should be pretty doable, shouldn't even be that hard, just running the amc script with a few customizations in the format every day.

It's probably not a lot of code, but i generally don't do individual work for less than 50 EUR. If that's fine for you let me know, and more details about the system (e.g. what OS? folders? does goodsync support calling 3rd party programs after sync?) would be good.
:idea: Please read the FAQ and How to Request Help.
mustafa108
Donor
Posts: 12
Joined: 07 Jul 2014, 13:34

Re: help with CL script

Post by mustafa108 »

Great Thanks! I would be grateful for your help and if you 50 EU is what it takes to get this done then I'm willing to pay that for your help.

OS: Windows 8.1
Goodsync has option to run command line program on complete. See attached image for reference.

FOLDERS
good sync downloads all video files to single folder: E:\incoming

The goal is when good sync finishes running each day that it will run the script to process any new video files that are downloaded and put in the right folder and rename.

TV Folder: E:\Videos\TV
Main Movie Folder: E:\Movies
Kids Movies Folder: E:\Kids Movies

I do use XBMC so would be great to trigger library refresh too.

Let me know if you have any questions and how I should send you donation for your help (not sure if you want me to send a different way than the regular donation link).
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with CL script

Post by rednoah »

Alright, this is what I put together so far:

Code: Select all

filebot -script fn:amc "%RF_ACT%" --output "E:/" --log-file amc.log --action move --conflict override -non-strict --def artwork=y --def xbmc=localhost excludeList=amc.txt "seriesFormat=Videos/TV/{n}/{'Season '+s.pad(2)}/{n} - {s00e00} - {t}" "movieFormat={genres =~ /Kids|Family/ ? 'Kids Movies' : 'Movies'}/{n} ({y})/{n} ({y}){' CD'+pi}"
But since I'm not using GoodSync I'm just guess here. ;)

You can easily test if filebot is generally working by running this command manually. Just need to replace %RF_ACT% with the path to the sync destination folder and for testing you can always do --action test do a dry-run.

Depending on how GoodSync works you can just paste the above into GoodSync and see what happens, but the %...% looks a lot like environment variable syntax so maybe you need to make a .bat file with the filebot command and then paste the path to the bat into GoodSync.

Just post back an results you get and then we'll continue from there. ;)
:idea: Please read the FAQ and How to Request Help.
MeBot
Posts: 14
Joined: 05 Jul 2014, 17:57

Re: help with CL script

Post by MeBot »

I use Goodsync too and you can put it in a batch file and just enter the path/filename (in quotes if it has spaces) into the post sync box (or post analyze if you have separate syncs for your kids files and you just want it to run after the last job in the line rather than after every sync job)

For example:

"C:/batch file/destination/batchfile.bat"
mustafa108
Donor
Posts: 12
Joined: 07 Jul 2014, 13:34

Re: help with CL script

Post by mustafa108 »

Thanks. I added the script to a batch file (with the path as you had suggested) and ran it. It ran but there were some issues...

1. video files were extracted from rar but not moved over.
2. movies didn't get moved. log listed a token error.
3. xbmc not updating.
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with CL script

Post by rednoah »

1.
Nothing is moved? Or just no movies? The logs clearly state that something is moved:

Code: Select all

[MOVE] Rename [D:\incoming\Brooklyn Nine-Nine\Season 01\Brooklyn Nine-Nine - S01E01 - Pilot.mp4] to [E:\Videos\TV\Brooklyn Nine-Nine\Season 01\Brooklyn Nine-Nine - S01E01 - Pilot.mp4]
[MOVE] Rename [D:\incoming\Brooklyn Nine-Nine\Season 01\Brooklyn Nine-Nine - S01E02 - The Tagger.mp4] to [E:\Videos\TV\Brooklyn Nine-Nine\Season 01\Brooklyn Nine-Nine - S01E02 - The Tagger.mp4]
...
2.
Seems there's a bug complicated arguments. Please use 4.1.2 for a fix for Issue (2)
https://sourceforge.net/projects/filebo ... ebot/HEAD/

3.
I assume xbmc runs on localhost?

Code: Select all

Notify XBMC: localhost
java.net.ConnectException: Connection refused: connect
If yes then you probably just haven't activated TCP control:
http://wiki.xbmc.org/?title=JSON-RPC_AP ... g_JSON-RPC
:idea: Please read the FAQ and How to Request Help.
mustafa108
Donor
Posts: 12
Joined: 07 Jul 2014, 13:34

Re: help with CL script

Post by mustafa108 »

it did move the tv shows earlier but not the movie files. Regarding xbmc I didnt have the network settings enabled...and I think I needed to restart xbmc for them to take effect. Will check again once we get the first part working...

I just installed latest version of filebot and ran it and returned with similar errors. here is the log

E:\command>processvideos.bat

E:\command>filebot -script fn:amc "D:\incoming" --output "E:/" --log-file amc.lo
g --action move --conflict override -non-strict --def artwork=y --def xbmc=local
host excludeList=amc.txt "seriesFormat=Videos/TV/{n}/{'Season '+s.pad(2)}/{n} -
{s00e00} - {t}" "movieFormat={genres =~ /Kids|Family/ ? 'Kids Movies' : 'Movies'
}/{n} ({y})/{n} ({y}){' CD'+pi}"
Locking C:\Users\gmust_000\AppData\Roaming\FileBot\logs\amc.log
Parameter: artwork = y
Parameter: xbmc = localhost
Parameter: excludeList = amc.txt
Parameter: seriesFormat = Videos/TV/{n}/{'Season '+s.pad(2)}/{n} - {s00e00} - {t
}
Parameter: movieFormat = {genres
Argument: D:\incoming
Input: D:\incoming\The.Legend.of.1900.1998.720p.BRRip.x264-WiNTeaM\The.Legend.of
.1900.1998.720p.BRRip.x264-WiNTeaM.mkv
Exclude: D:\incoming\Brooklyn Nine-Nine\Season 01\poster.jpg
Exclude: D:\incoming\Brooklyn Nine-Nine\Season 01\folder.jpg
Exclude: D:\incoming\Brooklyn Nine-Nine\tvshow.nfo
Exclude: D:\incoming\Brooklyn Nine-Nine\poster.jpg
Exclude: D:\incoming\Brooklyn Nine-Nine\banner.jpg
Exclude: D:\incoming\Brooklyn Nine-Nine\fanart.jpg
Exclude: D:\incoming\Brooklyn Nine-Nine\landscape.jpg
Exclude: D:\incoming\Brooklyn Nine-Nine\folder.jpg
Exclude: D:\incoming\_gsdata_\_cleanup.gss
Exclude: D:\incoming\_gsdata_\_file_state_v4._gs
Exclude: D:\incoming\_gsdata_\_insync_v4.gsl
Exclude: D:\incoming\_gsdata_\2014-0708-133316-MEDIACENTER-TV.log
Exclude: D:\incoming\_gsdata_\2014-0701-203237-MEDIACENTER-TV.log
Exclude: D:\incoming\_gsdata_\2014-0702-071253-MEDIACENTER-TV.log
Exclude: D:\incoming\_gsdata_\2014-0702-070846-MEDIACENTER-TV.log
Exclude: D:\incoming\_gsdata_\2014-0702-153251-MEDIACENTER-TV.log
Exclude: D:\incoming\_gsdata_\2014-0703-220004-MEDIACENTER-TV.log
Exclude: D:\incoming\_gsdata_\2014-0704-220002-MEDIACENTER-TV.log
Exclude: D:\incoming\_gsdata_\2014-0705-220004-MEDIACENTER-TV.log
Exclude: D:\incoming\_gsdata_\2014-0706-220002-MEDIACENTER-TV.log
Exclude: D:\incoming\_gsdata_\2014-0707-220002-MEDIACENTER-TV.log
Exclude: D:\incoming\_gsdata_\2014-0708-134009-MEDIACENTER-TV.log
Exclude: D:\incoming\_gsdata_\2014-0705-134009-MEDIACENTER-TV.log
Exclude: D:\incoming\_gsdata_\2014-0703-072837-MEDIACENTER-TV.log
Exclude: D:\incoming\Thumbs.db
Exclude: D:\incoming\Noah.2013.720p.BluRay.x264-SPARKS.idx
Exclude: D:\incoming\The.Legend.of.1900.1998.720p.BRRip.x264-WiNTeaM\The.Legend.
of.1900.1998.720p.BRRip.x264-WiNTeaM.nfo
Exclude: D:\incoming\The.Legend.of.1900.1998.720p.BRRip.x264-WiNTeaM\WiNTeaM.jpg

Exclude: D:\incoming\The.Legend.of.1900.1998.720p.BRRip.x264-WiNTeaM\The.Legend.
of.1900.1998.720p.BRRip.x264-WiNTeaM_sample.mkv
The.Legend.of.1900.1998.720p.BRRip.x264-WiNTeaM.mkv [series: The Legend, movie:
The Legend of 1900 (1998)]
Exclude Series: The Legend
Group: [tvs:null, mov:the legend of 1900 1998, anime:null] => [The.Legend.of.190
0.1998.720p.BRRip.x264-WiNTeaM.mkv]
javax.script.ScriptException: SyntaxError: missing token: }
Finished without processing any files
Failure (┬░_┬░)
Launch4j: Failed to run the given command.

The system could not find the environment option that was entered.


E:\command>
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with CL script

Post by rednoah »

Are you sure you updated to FileBot 4.1.2? Because that log wasn't created by 4.1.2

i.e. the latest revision from here, which is newer than the latest release on the website
:idea: Please read the FAQ and How to Request Help.
mustafa108
Donor
Posts: 12
Joined: 07 Jul 2014, 13:34

Re: help with CL script

Post by mustafa108 »

I clicked on that link and then downloaded the file that said : "Looking for the latest version? Download FileBot-setup.exe (102.1 kB)"

i wasnt sure what file in the 4.1.3 folder to download...
mustafa108
Donor
Posts: 12
Joined: 07 Jul 2014, 13:34

Re: help with CL script

Post by mustafa108 »

ok I installed this file from the 4.1.3 folder http://sourceforge.net/projects/filebot ... i/download

and then got this error after running the command again:

"E:\command>processvideos.bat

E:\command>filebot -script fn:amc "D:\incoming" --output "E:/" --log-file amc.lo
g --action move --conflict override -non-strict --def artwork=y --def xbmc=local
host excludeList=amc.txt "seriesFormat=Videos/TV/{n}/{'Season '+s.pad(2)}/{n} -
{s00e00} - {t}" "movieFormat={genres =~ /Kids|Family/ ? 'Kids Movies' : 'Movies'
}/{n} ({y})/{n} ({y}){' CD'+pi}"
Locking C:\Users\gmust_000\AppData\Roaming\FileBot\logs\amc.log
Parameter: artwork = y
Parameter: xbmc = localhost
Parameter: excludeList = amc.txt
Parameter: seriesFormat = Videos/TV/{n}/{'Season '+s.pad(2)}/{n} - {s00e00} - {t
}
Parameter: movieFormat = {genres =~ /Kids|Family/ ? 'Kids Movies' : 'Movies'}/{n
} ({y})/{n} ({y}){' CD'+pi}
Argument: D:\incoming
No files selected for processing
Failure (┬░_┬░)
Launch4j: Failed to run the given command.

The system could not find the environment option that was entered.


E:\command>"

I un-installed the app and then re-installed it just to make sure and had the same issue.
mustafa108
Donor
Posts: 12
Joined: 07 Jul 2014, 13:34

Re: help with CL script

Post by mustafa108 »

ok i played around a bit and changed the drive letter path for "incoming" folder and it ran. I'm going to test on a few different types of videos and will get back to you to see if all is in order now :) thx
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with CL script

Post by rednoah »

Yep, you got it.

FileBot-setup.exe just downloads and installs the latest release, not the latest beta. The .msi you downloaded is what I meant. ;)
:idea: Please read the FAQ and How to Request Help.
mustafa108
Donor
Posts: 12
Joined: 07 Jul 2014, 13:34

Re: help with CL script

Post by mustafa108 »

thanks. Tested again with kids movies, tv show and a compressed video. it worked great and moved everything as expected! this is great! Is there anyway to delete the compressed files (rar) and folders after the videos are moved? There are random sample video files and others that get left behind.
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with CL script

Post by rednoah »

Just add --def deleteAfterExtract=y clean=y to the command ;)
:idea: Please read the FAQ and How to Request Help.
mustafa108
Donor
Posts: 12
Joined: 07 Jul 2014, 13:34

Re: help with CL script

Post by mustafa108 »

Thanks... will do that. Should I just click the "Donate" link to pay you for your help?
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with CL script

Post by rednoah »

Sure, that would be most convenient. :D
:idea: Please read the FAQ and How to Request Help.
mustafa108
Donor
Posts: 12
Joined: 07 Jul 2014, 13:34

Re: help with CL script

Post by mustafa108 »

I was wondering if there is a way to also sort TV shows that would be considered "kids shows"

thanks..
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with CL script

Post by rednoah »

What would be considered "Kids Shows" based on what information?
:idea: Please read the FAQ and How to Request Help.
mustafa108
Donor
Posts: 12
Joined: 07 Jul 2014, 13:34

Re: help with CL script

Post by mustafa108 »

probably "animation" category....
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: help with CL script

Post by rednoah »

I highly doubt that "Animation" is equivalent to "Kids Shows" but that is all up to your format. Take this as an example:

Code: Select all

{genres =~ /Animation|Children/ ? 'Kids Shows' : 'TV Shows'}/{n}/{'Season '+s.pad(2)}/{n} - {s00e00} - {t}
:idea: Please read the FAQ and How to Request Help.
mustafa108
Donor
Posts: 12
Joined: 07 Jul 2014, 13:34

Re: help with CL script

Post by mustafa108 »

Thanks. Since I don't download adult animation....that's the closest I could think of how to pick out kids shows. (eg: legend of Kora )
Post Reply