POSTBUCKET - where random posts in unrelated topics go

Any questions? Need some help?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: How about sharing your CLI scripts?

Post by rednoah »

searchMovie only gives you name/year/id movie descriptors, this will give you all the metadata:

Code: Select all

println TheMovieDB.getMovieInfo(detectMovie(f, false), Locale.ENGLISH)
:idea: Please read the FAQ and How to Request Help.
sjboyd891
Posts: 11
Joined: 25 Apr 2013, 03:27

Re: [CODE] Force series for specific files

Post by sjboyd891 »

rednoah wrote:Sometimes it might be useful to override series auto-detection by forcing a series title for a specific set of files. This is how you do it. Only process a certain set of files via file parameter and force the series title via the query parameter.

Code: Select all

rename(file: args.getFiles{ it =~ /(?i:colbert.report)/}, query: "The Colbert Report", db: "TheTVDB")
rename(file: args.getFiles{ it =~ /(?i:daily.show)/}, query: "The Daily Show with Jon Stewart", db: "TheTVDB")
...
Where do I use this script? Do I use it in the same Filebot regular cmd line or with utorrent?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [CODE] Examples and Snippets

Post by rednoah »

That's just code snippets. You write your script.groovy and then run it with -script your/script.groovy
:idea: Please read the FAQ and How to Request Help.
grande7e7
Posts: 1
Joined: 05 Jun 2013, 17:58

Re: Automated Media Center

Post by grande7e7 »

Great read. Fantastic work, but a noob here :(

Under step 1 for setting up utorrent on Windows, do I simply copy the text there and paste it in the utorrent box for everything to run? I've don exactly that, changed path name too but nothing happens.

Any help would be much appreciated!
danielsokolowski
Posts: 9
Joined: 03 Jan 2013, 01:55

Re: How about sharing our format expressions?

Post by danielsokolowski »

Here are mine used in a CLI script and as a callback when downloads finish:

1. Append a list of genres to the movies - :

Code: Select all

"movieFormat=Movies/{n} ({y}) {genres}/{n} ({y}) {genres}{\" CD$pi\"}{\".$lang\"}"

ex: Media Library\Movies\12 Rounds (2009) [Action, Adventure, Drama, Thriller]\12 Rounds (2009) [Action, Adventure, Drama, Thriller].avi

2. Append a list of genres of a tv serices and add year if year not already in series name (it does this by removing the year from title using replace function):

Code: Select all

"seriesFormat=TV Shows/{n.replaceAll(\" \\(\" + y + \"\\)\",\"\")} ({y}) {genres}/{episode.special ? \"Special\" : \"Season \"+s.pad(2)}/{n} - {episode.special ? \"S00E\"+special.pad(2) : s00e00} - {t.replaceAll(/[\`\Â\´\â\€\˜\\â\€\™\Ê\»]/, \"'\").replaceAll(/[!?.]+$/).replacePart(', Part $1')}{\".$lang\"}"


ex: Media Library\TV Shows\Battlestar Galactica (2003)  [Action, Adventure, Drama, Science-Fiction]\Season 01\Battlestar Galactica (2003) - S01E12 - .avi
ex: Media Library\TV Shows\Fringe (2008) [Drama, Science-Fiction]\Season 01\Fringe - S01E01 - Pilot.avi
cheesemaker
Posts: 49
Joined: 03 Sep 2012, 10:52

Re: Automated Media Center

Post by cheesemaker »

Can you add Command-Line-Support for disabling automatic unrar? Thanks :)
cheesemaker
Posts: 49
Joined: 03 Sep 2012, 10:52

Re: Automated Media Center

Post by cheesemaker »

hey,
If your format contains quotes, e.g. {"-$fn"}, and you just copy and paste it, e.g. "movieFormat={"-$fn"}", the quotes in the format will mess with cmdline argument parsing. Hence you MUST ESCAPE DOUBLE QUOTES, e.g. "movieFormat={\"-$fn\"}".
Here my simplified code:

Code: Select all

filebot -script fn:amc "./" --output "/mnt/media/" --action test -non-strict --conflict override --def "movieFormat=Filme/{n.upperInitial().space('.')}.{y}/{n.upperInitial().space('.')}.{y}{\"-$group\"}" clean=y music=n subtitles=y artwork=n "ut_dir=" "ut_file=" "ut_kind=" "ut_title=" "ut_label=" "ut_state="
Namin scheme in hardcoded script works fine. Trying to get it working with auto update...
But it doesn't works. Output (with three sample movies:

Code: Select all

root@download01:/mnt/media/Movies# filebot -script fn:amc "./" --output "/mnt/media/" --action test -non-strict --conflict override --def "movieFormat=Filme/{n.upperInitial().space('.')}.{y}/{n.upperInitial().space('.')}.{y}{\"-$group\"}" clean=y music=n subtitles=y artwork=n "ut_dir=" "ut_file=" "ut_kind=" "ut_title=" "ut_label=" "ut_state="
Parameter: movieFormat = Filme/{n.upperInitial().space('.')}.{y}/{n.upperInitial().space('.')}.{y}{"-"}
Parameter: clean = y
Parameter: music = n
Parameter: subtitles = y
Parameter: artwork = n
Parameter: ut_dir = 
Parameter: ut_file = 
Parameter: ut_kind = 
Parameter: ut_title = 
Parameter: ut_label = 
Parameter: ut_state = 
Argument: /mnt/media/Movies
Input: /mnt/media/Movies/Forrest.Gump.1994.German.AC3.1080p.BluRay.x264-SEKTiON9.sub
Input: /mnt/media/Movies/From.Hell.2001.1080p.BluRay.DTS.DL.x264-HDC.mkv
Input: /mnt/media/Movies/xXx.2002.1080p.BluRay.DTS.DL.x264-HDC.mkv
Forrest.Gump.1994.German.AC3.1080p.BluRay.x264-SEKTiON9.sub [series: null, movie: Forrest Gump (1994)]
From.Hell.2001.1080p.BluRay.DTS.DL.x264-HDC.mkv [series: null, movie: From Hell (2001)]
xXx.2002.1080p.BluRay.DTS.DL.x264-HDC.mkv [series: null, movie: xXx (2002)]
Group: [tvs:null, mov:Forrest Gump (1994), anime:null] => [Forrest.Gump.1994.German.AC3.1080p.BluRay.x264-SEKTiON9.sub]
Group: [tvs:null, mov:From Hell (2001), anime:null] => [From.Hell.2001.1080p.BluRay.DTS.DL.x264-HDC.mkv]
Group: [tvs:null, mov:xXx (2002), anime:null] => [xXx.2002.1080p.BluRay.DTS.DL.x264-HDC.mkv]
No missing subtitles
Rename movies using [TheMovieDB]
Auto-detect movie from context: [/mnt/media/Movies/Forrest.Gump.1994.German.AC3.1080p.BluRay.x264-SEKTiON9.sub]
[TEST] Rename [/mnt/media/Movies/Forrest.Gump.1994.German.AC3.1080p.BluRay.x264-SEKTiON9.sub] to [/mnt/media/Filme/Forrest.Gump.1994/Forrest.Gump.1994-.sub]
Processed 1 files
Get [English] subtitles for 1 files
Looking up subtitles by filehash via OpenSubtitles
Looking up subtitles by filehash via Sublight
Lookup by hash failed: java.lang.IllegalStateException: Sublight login has not been configured
Searching for [From Hell] at [OpenSubtitles]
Searching for [From Hell] at [Sublight]
Search for [From Hell] failed: Sublight login has not been configured
Searching for [From Hell] at [Subscene]
No matching subtitles found: /mnt/media/Movies/From.Hell.2001.1080p.BluRay.DTS.DL.x264-HDC.mkv
Rename movies using [TheMovieDB]
Auto-detect movie from context: [/mnt/media/Movies/From.Hell.2001.1080p.BluRay.DTS.DL.x264-HDC.mkv]
[TEST] Rename [/mnt/media/Movies/From.Hell.2001.1080p.BluRay.DTS.DL.x264-HDC.mkv] to [/mnt/media/Filme/From.Hell.2001/From.Hell.2001-.mkv]
Processed 1 files
Get [English] subtitles for 1 files
Looking up subtitles by filehash via OpenSubtitles
Looking up subtitles by filehash via Sublight
Lookup by hash failed: java.lang.IllegalStateException: Sublight login has not been configured
Exception: Failed to auto-detect query
Rename movies using [TheMovieDB]
Auto-detect movie from context: [/mnt/media/Movies/xXx.2002.1080p.BluRay.DTS.DL.x264-HDC.mkv]
[TEST] Rename [/mnt/media/Movies/xXx.2002.1080p.BluRay.DTS.DL.x264-HDC.mkv] to [/mnt/media/Filme/XXx.2002/XXx.2002-.mkv]
Processed 1 files
Done ヾ(@⌒ー⌒@)ノ
//EDIT:

Code: Select all

 --def "movieFormat=Filme/{n.upperInitial().space('.')}.{y}/{n.upperInitial().space('.')}.{y}{$vc}"
Only {$vc} also don't work. {vc} works. Looks like it can't manage the conditional function in command line mode...
curl
Posts: 1
Joined: 12 Jun 2013, 17:08

Re: Automated Media Center

Post by curl »

Hey there,

great piece of software you've built. Thanks a lot!
Only wish i'd discovered it sooner :)
But this script is acutally giving me a bit of a headache.

First, i keep getting a bunch of these in my cmdline output:

Code: Select all

Failed to write xattr: java.io.File.toPath()Ljava/nio/file/Path;
And secondly, this one line

Code: Select all

WARNUNG: Unable to inherit IO: java/lang/ProcessBuilder$Redirect
Any of those something i need to worry about?

Oh, and btw, anyone have a good tutorial or documentation on fpcalc?
I would love to have AMC sort my audiofiles as well, but as of now, i can't seem to get a handle on that fpcalc thingy.

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

Re: Automated Media Center

Post by rednoah »

Use Java 7 if possible. But it'll still work with Java 6 except with some warnings.

The fpcalc command needs to be in the PATH or /usr/bin or something. Just so it can find the command.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automated Media Center

Post by rednoah »

cheesemaker wrote:Only {$vc} also don't work. {vc} works. Looks like it can't manage the conditional function in command line mode...
It's either {vc} or {"$vc"}.

PS: CMD escaping sucks, i'm pretty much just trying around until it works as well.
:idea: Please read the FAQ and How to Request Help.
cheesemaker
Posts: 49
Joined: 03 Sep 2012, 10:52

Re: Automated Media Center

Post by cheesemaker »

rednoah wrote:
cheesemaker wrote:Only {$vc} also don't work. {vc} works. Looks like it can't manage the conditional function in command line mode...
It's either {vc} or {"$vc"}.

PS: CMD escaping sucks, i'm pretty much just trying around until it works as well.
Ok, Thanks, I managed it. For an item, which will be only added when it's given and have a separator '.', the cmd code is:

Code: Select all

{\".\$vc\"}
best regards,
cheesemaker
phDave
Posts: 2
Joined: 26 Jun 2013, 14:30

Re: Automated Media Center

Post by phDave »

Hi folks

Almost got this working but always seems to hang just after:

Code: Select all

Rename movies using [TheMovieDB]
[COPY] Rename [M:\Movies\blahblah.avi] to [M:\Movies\Blah Blah (2001).avi]
could this be because M: is a network drive accessed by WiFi and blahblah is a big file?
Is it really doing a COPY-DELETE rather than a RENAME? (I guess it might, othewise how can it move blahblah whilst it's still seeding?)

Thanks in advance, awesomely clever piece of SW.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automated Media Center

Post by rednoah »

You've set --action copy so it's gonna copy...

[COPY] => COPY (copy as in copy, no delete)
[MOVE] => MOVE (as in rename)

How exactly that operation is performed is platform dependent.


You probably wanna look into using --action hardlink and/or running filebot on that smb server.

Understanding hardlinks:
http://en.wikipedia.org/wiki/Hard_link
:idea: Please read the FAQ and How to Request Help.
phDave
Posts: 2
Joined: 26 Jun 2013, 14:30

Re: POSTBUCKET - where random posts in unrelated topics go

Post by phDave »

You've set --action copy so it's gonna copy...
Duh - thanks! - will RTFM. Linking sounds safest - leave the source where it is and point to it. SMB server is an ACRyan media player so not much chance of running on there I don't think.

Thx for the response.
andrewtdop
Posts: 5
Joined: 01 Jul 2013, 14:16

Re: Automated Media Center

Post by andrewtdop »

Could I ask for some help please?

I have run the script you suggested, and it worked for some time, but now I get an error. I'm kinda new at this, so bear with me... Below is the script I used and the error log. Any help would be appreciated. Thanks in advance.

SCRIPT:

"C:/Program Files/Filebot/filebot.exe" -script fn:amc "Z:/Downloads" --output "Z:/" --log-file amc.log --action copy --conflict override -non-strict --def music=n artwork=y "ut_dir=%D" "ut_file=%F" "ut_kind=%K" "ut_title=%N" "ut_label=%L" "ut_state=%S" --def xbmc=HOST --def gmail=Username:Password --def mailto=[email protected] --def clean=y


LOG:


Parameter: music = n
Parameter: artwork = y
Parameter: ut_dir = F
Parameter: ut_kind = N
Parameter: ut_label = S
Parameter: xbmc = HOST
Parameter: gmail = User:Password
Parameter: mailto = [email protected]
Parameter: clean = y
Argument: Z:\Downloads
Exception: Conflicting arguments: pass in either file arguments or ut_dir/ut_file parameters but not both
Failure (°_°)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automated Media Center

Post by rednoah »

RTFM
Standalone Usage
You can use the script directly from the cmdline like this, by just adding files as arguments instead of the utorrent parameters.
@see http://www.filebot.net/forums/viewtopic ... =793#p5114
:idea: Please read the FAQ and How to Request Help.
andrewtdop
Posts: 5
Joined: 01 Jul 2013, 14:16

Re: Automated Media Center

Post by andrewtdop »

Thanks, I've tried that and it works (mostly) but I really want this to run after the torrent downloads in utorrent.

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

Re: Automated Media Center

Post by rednoah »

RTFM @see http://www.urbandictionary.com/define.php?term=RTFM

µTorrent usage:
µTorrent -> Run Program -> Run this program when torrent finishes:

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 "ut_dir=%D" "ut_file=%F" "ut_kind=%K" "ut_title=%N" "ut_label=%L" "ut_state=%S"
:idea: Please read the FAQ and How to Request Help.
andrewtdop
Posts: 5
Joined: 01 Jul 2013, 14:16

Re: Automated Media Center

Post by andrewtdop »

Wow, thanks. That's what I had before that didn't work. And it still doesn't. Appreciate it.
andrewtdop
Posts: 5
Joined: 01 Jul 2013, 14:16

Re: Automated Media Center

Post by andrewtdop »

I've tried every variation I can think of for this, beginning with the original code provided "in the manual" and it worked and then suddenly, with no system changes, stopped working. Seriously, I read the manual, understand how this works and am looking for real help. If you're willing, I'd appreciate it.

Since it stopped working, I get this in the log:

Code: Select all

Parameter: music = y
Parameter: subtitles = en
Parameter: artwork = y
Parameter: ut_dir = F
Parameter: ut_kind = N
Parameter: ut_label = S--def
Parameter: xbmc = HOST
Parameter: gmail = user:pass
Parameter: mailto = [email protected]
Parameter: clean = y
MissingPropertyException: No such property: ut_file for class: Script3
groovy.lang.MissingPropertyException: No such property: ut_file for class: Script3
	at Script3.run(Script3.groovy:78)
	at net.sourceforge.filebot.cli.ScriptShell.evaluate(Unknown Source)
	at net.sourceforge.filebot.cli.ScriptShell.runScript(Unknown Source)
	at net.sourceforge.filebot.cli.ArgumentProcessor.process(Unknown Source)
	at net.sourceforge.filebot.Main.main(Unknown Source)
Failure (°_°)
Parameter: music = y
Parameter: subtitles = en
Parameter: artwork = y
Parameter: ut_dir = F
Parameter: ut_kind = N
Parameter: ut_label = S
Parameter: xbmc = HOST
Parameter: gmail = user:pass
Parameter: mailto = [email protected]
Parameter: clean = y
Argument: Z:\Downloads
Exception: Conflicting arguments: pass in either file arguments or ut_dir/ut_file parameters but not both
Failure (°_°)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Automated Media Center

Post by rednoah »

This is how a good call looks like:

Code: Select all

filebot -script fn:amc --output "D:/Organized Media" --log-file amc.log --action hardlink --conflict override -non-strict --def "ut_dir=D:\Media\Avatar" "ut_file=" "ut_kind=multi" "ut_title=Avatar" "ut_label=" "ut_state=5"
WHAT IS THIS?

Code: Select all

Parameter: ut_dir = F
I explain: %var are variables for utorrent. They will be replaced with actual values, as in the statement above. You're obviously doing something wrong. Did you just copy and paste the statement into the cmd? I can see that you did. RTFM. It tell you to check the utorrent Logger for the command that is executed by utorrent, not the template you paste into utorrent.

If this is the output you get, something is seriously not working (or you're doing it wrong). How can FileBot know where the newly finished torrent is? It's in F ??? F ??? Of course not. %F should resolved to something like D:\Media\Avatar by utorrent before filebot is even called:

Code: Select all

Parameter: ut_dir = F <-- WRONG, OBVIOUSLY
Parameter: ut_kind = N
Parameter: ut_label = S
Clear? This is when I say utorrent usage.


If you check the sample cmdline for utorrent THERE IS NEVER a file argument? What is a file argument? It's path that you just add that is not a regular cmdline option or --def option, just arguments you add. In your case that's Z:\Downloads. You will see that im my utorrent sample there is no such random file argument.

This is a log for standalone usage (ut_dir/ut_file parameters):

Code: Select all

Argument: Z:\Downloads
This is a log for utorrent usage (no file arguments):

Code: Select all

Parameter: ut_dir = /path/to/newly/finished/download/pass/in/by/utorrent

This is also the perfect time to explain why I updated the script to stop what you have been doing till now. You realize you process all of Z:\Downloads each and everytime you call filebot?? And if you're doing --action copy you'll be processing everything over and over for no reason, wasting TMDb/TheTVDB and other free services. Don't do that.
:idea: Please read the FAQ and How to Request Help.
andrewtdop
Posts: 5
Joined: 01 Jul 2013, 14:16

Re: Automated Media Center

Post by andrewtdop »

Thank you. Yes, that is clearer. I will try that. I didn't see that level of uTorrent specificity in the manual. That does help. Yes, I threw the Z:\Downloads in there to get it working and it did. I'll change it now that I understand better. Thank you for the help (and for creating such a neat and effective program.) Much appreciated.
Rhavenom
Posts: 5
Joined: 09 Jul 2013, 16:20

Re: How about sharing our format expressions?

Post by Rhavenom »

My movie format expression:

Code: Select all

{genres[0]}/{n.acronym().getAt(0)}/{"$collection/"}/{n} [{y}]{"CD$pi"}{' '+file.path.match(/UNRATED|REMASTERED|EXTENDED|THEATRICAL|UNCUT|DIRECTORS CUT|THEATRICAL EDITION|THEATRICAL CUT/)}/{n.replaceTrailingBrackets()} [{try{"$source"}catch(e){'BluRay'}} m-{"$vf"} {" $vc"} {" $ac"} {media.AudioLanguageList} {" $af"}][{y}]{" CD$pi"}{fn.match(/[.]fanart|[.]mkv/)}{"."+lang.getDisplayName(Locale.getDefault()).lower()}
EX: /Action/A/Avatar Collection/Avatar [BluRay m-1080p x264 AC3 Spanish English 6ch][2009].mkv

Is it possible to display to rename all audio channels is the movie as well as the language of each of them?

EX: Avatar [BluRay m-1080p x264 Dual DTS Esp AC3 Eng 6ch][2009].mkv ??
Chryses
Posts: 66
Joined: 26 Aug 2012, 19:11

Re: Automated Media Center

Post by Chryses »

Hi, tnx for this, this's very usefull!!!

I've 2 question:

1. I tried many way but with no lucky, it's possible to have always a "0" on the series name? I mean Dexter - 08x01 and not Dexter - 8x01
2. Some time the movie is 1 cd some time not :) Ther's a way to tell the script that if the movie is on 1 single file to make the movie name without the cd at the end? I actually use this method to rename te movie "movieFormat=Film/{n} ({y}){\" Cd$pi\"}"

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

Re: Automated Media Center

Post by rednoah »

1. Very easy:

Code: Select all

{s.pad(2)}x{e.pad(2)}
1.1. A bit more complicated if you take multi-episode files into consideration as well:

Code: Select all

{s.pad(2)}x{es.collect{ it.pad(2) }.join('-')}
2. If there's only one movie file, {pi} will be undefined and unwind the whole {...} block. That's the difference between {" CD$pi"} and CD{pi} and if you use my examples it covers all these common cases.
:idea: Please read the FAQ and How to Request Help.
Post Reply