Page 1 of 2

[HELP] Fully Automated Media Center

Posted: 26 Feb 2013, 12:16
by esponjaman
Hi,
First let me say this is a wonderful tool. And this script is awesome.

My setup:
Windows 8 x64
FileBot 3.4 x64
Java 7.15 x64
uTorrent 3.3 (build 29126) x86
uTorrent Run Program -

Code: Select all

"C:\Program Files\FileBot\filebot.platform.launcher.exe" -script fn:amc --output "E:" --action copy --conflict override -non-strict --def music=n subtitles=pt,pb artwork=n clean=y "ut_dir=%D" "ut_file=%F" "ut_kind=%K" "ut_title=%N" "ut_label=%L" "ut_state=%S"
I have 3 problems using this, dunno if it is my setup or just a bug:

1 - As you can see from my uTorrent Run Program, I have to invoke FileBot from "filebot.platform.launcher.exe", because "filebot.cmd" doesn't start, I event tried rednoah invoke.vbs http://filebot.sourceforge.net/forums/v ... 583f#p2024 but no success. When I went to uTorrent logger and copy pasted to command prompt it worked. That's weird, but that is not the problem, the problem is if 2 downloads finish almost at the same time, only the first one is handled, the second one is ignore, even if in the logger it states FileBot was invoked.

2 - The script always extracts the archive to a sub folder in %D, what I would want it to do is for example, uTorrent downloads to "D:\downloads\a.movie" , FileBot extracts from "d:\downloads\a.movie" to "e:\temp\a.movie\a.movie.mkv" and after that it move it from "e:\temp\a.movie\a.movie.mkv" to "E:\movies\A movie\a movie.mkv".
What it does now, is uTorrent downloads to "D:\downloads\a.movie" , FileBot extracts from "d:\downloads\a.movie" to "D:\downloads\a.movie\a.movie.mkv" and then it copies/moves to "E:\movies\A movie\a movie.mkv". Is there a option to configure the temp folder of the zip/rar extration?

3 - And last but not least is the clean flag, if set true (clean=y) and action move it deletes extra files from the download folder, example of a directory:

Code: Select all

Directory of D:\Downloads\Shameless.US.S03E02.720p.HDTV.x264-IMMERSE

26/02/2013  11:53    <DIR>          .
26/02/2013  11:53    <DIR>          ..
26/02/2013  02:19    <DIR>          Sample
26/02/2013  11:53    <DIR>          Shameless.US.S03E02.720p.HDTV.x264-IMMERSE
26/02/2013  01:36             2 945 shameless.us.s03e02.720p.hdtv.x264-immerse.nfo
26/02/2013  01:38             2 337 shameless.us.s03e02.720p.hdtv.x264-immerse.sfv
26/02/2013  02:20        50 000 000 shameless.us.s03e02.720p.hdtv.x264-immerse.rar
26/02/2013  02:20        50 000 000 shameless.us.s03e02.720p.hdtv.x264-immerse.r00
26/02/2013  02:20        50 000 000 shameless.us.s03e02.720p.hdtv.x264-immerse.r01
It will delete the original download files sfv, .nfo, sample folder plus the temp directory of extraction Shameless.US.S03E02.720p.HDTV.x264-IMMERSE, instead of only deleting the temp directory of extraction. Making the download corrupted because of missing files.
If set to clean=y and action copy, it will delete the extracted file in the temp directory, but it will not delete the subtitles downloaded nor the temp directory.

Sorry to create such a long post, but tried to explain everything.

Re: [HELP] Fully Automated Media Center

Posted: 26 Feb 2013, 16:26
by rednoah
1. 32-bit cmd and 64-bit cmd may have a different PATH and ENVIRONMENT. You're testing with 64-bit cmd, but 32-bit utorrent is using 32-bit cmd to execute commands. Probably still just a PATH issue.

2. Yes, but only by modifying the script => extract(..., output: path, ...)

3. clean=y does different things in different --action modes. With --action move it'll clean up after moving all files, e.g. deleting all remaining clutter and empty folders. With --action copy|hardlink it'll delete those extracted files that are not really needed.

These temp folders for extracted files will be deleted if they're empty. I guess the issue is that it's deleting the extracted files but not the subtitles, so it also can't delete the folders because of the subtitles.

EDIT: Fixed #3 => You can run the latest rev like this:

Code: Select all

-script svn:amc

Re: [HELP] Fully Automated Media Center

Posted: 26 Feb 2013, 18:57
by esponjaman
Thanks for the very fast reply.

1. I think you're right I did a small test and it seems that when FileBot is called from uTorrent it utilizes the 32 bit cmd.exe.

Code: Select all

C:\Windows\SysWOW64>path
PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\FileBot\

C:\Windows\SysWOW64>filebot
'java' is not recognized as an internal or external command,operable program or batch file.

C:\Windows\SysWOW64>SET PATH=%PATH%;"c:\Program Files\Java\jre7\bin"

C:\Windows\SysWOW64>filebot
--it ran
2. So if i change this:

Code: Select all

def extractedFiles = extract(file: input.findAll{ it.isArchive() }, output: null, conflict: 'override', filter: { it.isVideo() || (music && it.isAudio()) }, forceExtractAll: true)
into this:

Code: Select all

def extractedFiles = extract(file: input.findAll{ it.isArchive() }, output: E:/TEMP, conflict: 'override', filter: { it.isVideo() || (music && it.isAudio()) }, forceExtractAll: true)
it should work?

3. Where can I get the latest revision of the script? ----> ignore, found it http://sourceforge.net/p/filebot/code/1 ... amc.groovy

Re: [HELP] Fully Automated Media Center

Posted: 26 Feb 2013, 19:46
by rednoah
2. Quotes!

Code: Select all

output: 'E:/TEMP'
3. Uploaded everything => fn:amc should work as well

Re: [HELP] Fully Automated Media Center

Posted: 27 Feb 2013, 16:46
by esponjaman
Hi again, sorry to be so annoying.

1. It is resolved, had to change the path for the 32bits command prompt (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\path)
Now I can have a log of what FileBot is doing.

Code: Select all

filebot -script fn:amc --output "E:" --action move --conflict override -non-strict --def music=n subtitles=pt,pb artwork=n clean=y "ut_dir=%D" "ut_file=%F" "ut_kind=%K" "ut_title=%N" "ut_label=%L" "ut_state=%S" >> "%D\filebot.log" 2>&1
2. Well it didn't work, tried changing output: 'E:/TEMP' in the new version and the old version of the groovy file, ignored and used the download location.
Have the log files in the attachment.

3. Same result, the new one deleted the same files, plus the filebot.log but that one is expected. This test was made with the output changed in point 2.

Re: [HELP] Fully Automated Media Center

Posted: 27 Feb 2013, 17:09
by rednoah
2. You seem to be confused about something. Here again how it works...

My Standard Scripts: from online, e.g. fn:amc => http://filebot.sourceforge.net/scripts/amc.groovy

Code: Select all

filebot -script fn:amc ...
Your scripts: local files, e.g. C:/myamc.groovy

Code: Select all

filebot -script "C:/myamc.groovy" ...
3. In copy|hardlink modes it'll delete files extracted from archives and newly downloaded subtitles. In move mode it'll run the cleaner script. More info on that one in the shared scripts thread.

Re: [HELP] Fully Automated Media Center

Posted: 01 Mar 2013, 11:29
by esponjaman
2. Ups didn't RTFM to the end
fn:name will automatically fetch the online script but you can also specify a local path to run your own customized script
my bad.
It is working now with my local script.

3. Gave up to use the clean flag, as it was not very logical, with move flag there aren't temporary files.

Thanks very much for the support.

Just one last thing, in the script where do you call the subtitles script, I only found this:

Code: Select all

groups.each{ group, files ->
	// fetch subtitles (but not for anime)
	if (subtitles && !group.anime) {
		subtitles.each{ languageCode ->
			def subtitleFiles = getMissingSubtitles(file:files, output:'srt', encoding:'UTF-8', lang:languageCode)
			files += subtitleFiles
			tempFiles += subtitleFiles // if downloaded for temporarily extraced files delete later
		}
	}
I want to try to mess around with it, try to add another provider.
XBMC has a plugin for subtitles that has many other providers, and it is open source, so if you want/have time you could expand this part of the script.

Re: [HELP] Fully Automated Media Center

Posted: 01 Mar 2013, 11:56
by rednoah
3. But with --action move there's empty folders and clutter files left behind, and with --def clean=y these left-overs will be taken care of.

4. Making xbmc plugins work in FileBot would be extremely difficult for technical reasons on many many levels. Porting the sources and keeping it up to date would take hundreds of hours. Suffice to say, not gonna happen. :P

Re: [HELP] Fully Automated Media Center

Posted: 04 Mar 2013, 14:11
by colicab
Hi.

First of all thanks for this awesome script. Filebot is already great but this really makes it perfect.

I have just one problem I can't seem to handle for the moment.

When I download episode I immediately download the English as well as the Dutch subtitle for that episode (with AutoSub from Bierdopje.com). At the end they either have ".English.srt" or ".Dutch.srt"

Is it possible with amc.groovy to rename and move both subtitles with the episode keeping this extension after the episode name?


Thanks

Re: [HELP] Fully Automated Media Center

Posted: 04 Mar 2013, 14:15
by rednoah
Take a closer look at the episode/movie format engine. You can do absolutely anything.

I guess you're trying to come up with this snippet:

Code: Select all

{".${lang.displayName}"}

Re: [HELP] Fully Automated Media Center

Posted: 04 Mar 2013, 17:56
by colicab
Hi rednoah,

glad to here it's definitely possible. Although I'm not really sure how.


1) Thnx for the snippet. I guess I have to change

Code: Select all

replaceAll(/[!?.]+$/).replacePart(', Part $1')}{".$lang"}'''
with

Code: Select all

replaceAll(/[!?.]+$/).replacePart(', Part $1')}{".${lang.displayName}"}'''
in the "// series/anime/movie format expressions" part of the code ont the line "tvs", correct?


2) Do I have to change anything to my command. For the moment it is:

Code: Select all

/share/MD0_DATA/.qpkg/Optware/usr/share/filebot/bin/filebot.sh -script /share/MD0_DATA/.qpkg/myscripts/amc.groovy /share/Qmultimedia/transmission/input --output /share/Qmultimedia/transmission/input --def "seriesFormat=Series/{n}/{n} Season {s}/{n}.{s.pad(2)}x{e.pad(2)}.{t}" "movieFormat=Movies/{n} [{y}]/{n} [{y}]" "clean=y" 
Do I have to add something after {t}? If yes, what is the variable there?
I tried it without changing my format in my command but then he skips one of the subtitles. I guess I have to add something but I'm not sure what.

Thanks so much for the help!

Re: [HELP] Fully Automated Media Center

Posted: 04 Mar 2013, 18:26
by colicab
Hi rednoah,

OK I think I didn't understand your post the first time. I figured out you meant changing my command instead of the script, right?

So, I changed it and it looks like this now

Code: Select all

/share/MD0_DATA/.qpkg/Optware/usr/share/filebot/bin/filebot.sh -script /share/MD0_DATA/.qpkg/myscripts/amc.groovy /share/Qmultimedia/transmission/input --output /share/Qmultimedia/transmission/Qmultimedia --def "seriesFormat=Series/{n}/{n} Season {s}/{n}.{s.pad(2)}x{e.pad(2)}.{t}.{lang.displayName}" "movieFormat=Movies/{n} [{y}]/{n} [{y}]"
Parameter: seriesFormat = Series/{n}/{n} Season {s}/{n}.{s.pad(2)}x{e.pad(2)}.{t}.{lang.displayName}
It works, he will now process both subtitles and add ".eng.srt" and ".nld.srt" to the names. This is fine, although I wonder, could I customize and make it "English" "Dutch"?
However, with the mkv file he will rename it as Boardwalk Empire.02x02.Ourselves Alone..mkv (with the double dot). Any way to get rid of this double dot?

Re: [HELP] Fully Automated Media Center

Posted: 04 Mar 2013, 18:32
by rednoah
This means you're overriding the format via cmdline parameter:

Code: Select all

--def "seriesFormat=Series/{n}/{n} Season {s}/{n}.{s.pad(2)}x{e.pad(2)}.{t}"
This is so you don't have to modify the script and can grab it from online via fn:name


Anyway, it's really easy. Here's a sample:

Code: Select all

D:\testdata>filebot -script fn:amc --log info --action test --output "D:/Organized Media" -non-strict --def "seriesFormat=TV/{n}/{n} {sxe} {t}{'.'+lang.getDisplayName(Locale.ENGLISH)}" "AMC-EM (regression test)"
Output:

Code: Select all

[TEST] Rename [D:\testdata\AMC-EM (regression test)\Firefly 1x01.en.srt] to [D:\Organized Media\TV\Firefly\Firefly 1x01 The Train Job.English.srt]
You can figure out the rest from here.

PS: Remember that seriesFormat and movieFormat are completely independent from each other so you'll want to add that {lang} part to both.

Re: [HELP] Fully Automated Media Center

Posted: 05 Mar 2013, 11:06
by colicab
Thanks for that. I already managed to get rid of the dot in the mkv file.

I still can't get the other thing to work. I tried it exactly as you said

Code: Select all

[~] # /share/MD0_DATA/.qpkg/Optware/usr/share/filebot/bin/filebot.sh -script /share/MD0_DATA/.qpkg/myscripts/amc.groovy /share/Qmultimedia/transmission/input --output /share/Qmultimedia/transmission/Qmultimedia --def "seriesFormat=Series/{n}/{n} Season {s}/{n}.{s.pad(2)}x{e.pad(2)}.{t}{'.'+lang.getDisplayName(Locale.ENGLISH)}" "movieFormat=Movies/{n} [{y}]/{n} [{y}]"
Parameter: seriesFormat = Series/{n}/{n} Season {s}/{n}.{s.pad(2)}x{e.pad(2)}.{t}{'.'+lang.getDisplayName(Locale.ENGLISH)}
Parameter: movieFormat = Movies/{n} [{y}]/{n} [{y}]
Argument: /share/MD0_DATA/Qmultimedia/transmission/input
Input: /share/MD0_DATA/Qmultimedia/transmission/input/Boardwalk Empire.02x02.Ourselves Alone.mkv
Input: /share/MD0_DATA/Qmultimedia/transmission/input/Boardwalk Empire.02x02.Ourselves Alone.English.srt
Input: /share/MD0_DATA/Qmultimedia/transmission/input/Boardwalk Empire.02x02.Ourselves Alone.Dutch.srt
Group: [tvs:Boardwalk Empire] => [Boardwalk Empire.02x02.Ourselves Alone.mkv, Boardwalk Empire.02x02.Ourselves Alone.English.srt, Boardwalk Empire.02x02.Ourselves Alone.Dutch.srt]
Rename episodes using [TheTVDB]
Auto-detected query: [Boardwalk Empire]
Fetching episode data for [Boardwalk Empire]
Auto-detected query: [Boardwalk Empire]
Fetching episode data for [Boardwalk Empire]
Auto-detected query: [Boardwalk Empire]
Fetching episode data for [Boardwalk Empire]
[MOVE] Rename [/share/MD0_DATA/Qmultimedia/transmission/input/Boardwalk Empire.02x02.Ourselves Alone.mkv] to [/share/Qmultimedia/transmission/Qmultimedia/Series/Boardwalk Empire/Boardwalk Empire Season 2/Boardwalk Empire.02x02.Ourselves Alone.mkv]
[MOVE] Rename [/share/MD0_DATA/Qmultimedia/transmission/input/Boardwalk Empire.02x02.Ourselves Alone.English.srt] to [/share/Qmultimedia/transmission/Qmultimedia/Series/Boardwalk Empire/Boardwalk Empire Season 2/Boardwalk Empire.02x02.Ourselves Alone.eng.srt]
[MOVE] Rename [/share/MD0_DATA/Qmultimedia/transmission/input/Boardwalk Empire.02x02.Ourselves Alone.Dutch.srt] to [/share/Qmultimedia/transmission/Qmultimedia/Series/Boardwalk Empire/Boardwalk Empire Season 2/Boardwalk Empire.02x02.Ourselves Alone.nld.srt]
Processed 3 files
Done ヾ(@⌒ー⌒@)ノ
He still changes it to ".eng.srt" and ".nld.srt". Do I have to set the Locale parameter somewhere, perhaps?

Re: [HELP] Fully Automated Media Center

Posted: 05 Mar 2013, 12:25
by rednoah
Look at my log, has to work. You probably made some change in the script that makes it not work. Use my standard script via -script fn:amc.

Re: [HELP] Fully Automated Media Center

Posted: 05 Mar 2013, 13:38
by colicab
Hi,

I did it with the online script but still it always changes it to ".eng"

Code: Select all

[~] # /share/MD0_DATA/.qpkg/Optware/usr/share/filebot/bin/filebot.sh -script fn:amc --log info --action test /share/Qmultimedia/transmission/subs_added --output /share/Qmultimedia/transmission/Qmultimedia --def "seriesFormat=Series/{n}/{n} Season {s}/{n}.{s.pad(2)}x{e.pad(2)}.{t}{'.'+lang.getDisplayName(Locale.ENGLISH)}"
[TEST] Rename [/share/MD0_DATA/Qmultimedia/transmission/subs_added/Rules of Engagement.07x05.Fountain of Youth.English.srt] to [/share/Qmultimedia/transmission/Qmultimedia/Series/Rules of Engagement/Rules of Engagement Season 7/Rules of Engagement.07x05.Fountain of Youth.eng.srt]
[TEST] Rename [/share/MD0_DATA/Qmultimedia/transmission/subs_added/Rules of Engagement.07x05.Fountain of Youth.mkv] to [/share/Qmultimedia/transmission/Qmultimedia/Series/Rules of Engagement/Rules of Engagement Season 7/Rules of Engagement.07x05.Fountain of Youth.mkv]
FYI, this is on a QNAP NAS.

Anyway, it's only a detail, doesn't matter that much. Already very glad I can add multiple subtitles.

Thanks!

Re: [HELP] Fully Automated Media Center

Posted: 05 Mar 2013, 13:46
by rednoah
If that's really the format that 's in effect... then very odd. Maybe Java doesn't have the full i18n data available in the embedded package or something. No idea. You can always use {fn.match(/english|dutch/)} to retain pieces of the original filename.

Re: [HELP] Fully Automated Media Center

Posted: 05 Mar 2013, 14:06
by colicab
Can make it work with this one :D


Thanks!!

FYI: with this ready I have my entire QNAP automated for downloading series and movies (semi-auto). I will write a review on the QNAP forum soon!

Re: [HELP] Fully Automated Media Center

Posted: 06 Mar 2013, 10:58
by colicab
I have another question.

I have some problem with renaming episodes from the TV series Touch (the current series with Kiefer Sutherland). The reason is this series is "Touch (2012)", "Touch" refers to an older animation series. Problem is (2012) is not in the torrent name of these episodes so he doesn't find the right one.

Is there a way to 'force' filebot to choice the correct? I will probably get the same issue with Revolutionary (2012)....


Thanks

Re: [HELP] Fully Automated Media Center

Posted: 06 Mar 2013, 11:49
by rednoah
In conflicting cases like this FileBot will additional check File.lastModified against Episode.airdate and in most cases be able to pick the correct match based on that.

Tried it right now, works for me (for a newly created file):

Code: Select all

[COPY] Rename [D:\testdata\AMC-EM (regression test)\Touch 1x02.avi] to [D:\output\TV Shows\Touch (2012)\Season 01\Touch - S01E02 - 1 Plus 1 Equals 3.avi]
You can pass your own filter logic as to what episodes will be included/excluded from matching:

Code: Select all

--filter expression                    : Episode filter
Or manually force the query:

Code: Select all

--q series/movie title                 : Force lookup query

Re: [HELP] Fully Automated Media Center

Posted: 06 Mar 2013, 12:46
by colicab

Code: Select all

Parameter: seriesFormat = Series/{n}/{n} Season {s}/{n}.{s.pad(2)}x{e.pad(2)}.{t}{'.'+fn.match(/english|dutch/)}
Parameter: movieFormat = Movies/{n} [{y}]/{n} [{y}]
Argument: /share/MD0_DATA/Qmultimedia/transmission/rename
Input: /share/MD0_DATA/Qmultimedia/transmission/rename/Hitchcock (2012) 1080p BluRay AC3+DTS HQ Eng NL Subs.mkv
Input: /share/MD0_DATA/Qmultimedia/transmission/rename/Touch.s02e03.English.srt
Input: /share/MD0_DATA/Qmultimedia/transmission/rename/Touch.s02e03.mkv
Input: /share/MD0_DATA/Qmultimedia/transmission/rename/Touch.s02e03.Dutch.srt
Mar 6, 2013 12:39:50 PM net.sourceforge.filebot.mediainfo.MediaInfo <clinit>
WARNING: Failed to preload libzen
Hitchcock (2012) 1080p BluRay AC3+DTS HQ Eng NL Subs.mkv [series: null, movie: The Transmission (2012)]
Group: [tvs:null, mov:The Transmission (2012), anime:null] => [Hitchcock (2012) 1080p BluRay AC3+DTS HQ Eng NL Subs.mkv]
Group: [tvs:Touch] => [Touch.s02e03.English.srt, Touch.s02e03.mkv, Touch.s02e03.Dutch.srt]
Rename movies using [TheMovieDB]
Looking up movie by filehash via [TheMovieDB]
TheMovieDB: Hash lookup not supported
Auto-detect movie from context: [/share/MD0_DATA/Qmultimedia/transmission/rename/Hitchcock (2012) 1080p BluRay AC3+DTS HQ Eng NL Subs.mkv]
Exception: [transmission/Hitchcock (2012) 1080p BluRay AC3+DTS HQ Eng NL Subs.mkv] Failed to auto-select search result: [The Transmission (2012), Hitchcock (2012), Backstreet Boys: Live Disney Transmission (1999), The Secret NASA Transmissions The Smoking Gun (2001)]
Rename episodes using [TheTVDB]
Auto-detected query: [Touch]
ExecutionException: java.lang.Exception: Failed to auto-select search result: [Touch, Touch (2012), The Evil Touch, The Gentle Touch, Touching Evil, Touching Evil (UK), Touched by an Angel, Touche Turtle & Dum Dum, The Untouchables, A Touch of Cloth, Touch Me, I'm Karen Taylor, Untouchable, The Untouchables (1993), A Touch of Frost]
Done ヾ(@⌒ー⌒@)ノ
It seems like he recognizes it correctly at first

Code: Select all

Rename episodes using [TheTVDB]
Auto-detected query: [Touch]
but then says

Code: Select all

Failed to auto-select search result
Any idea why? Also why do I have this?

Code: Select all

WARNING: Failed to preload libzen
Another problem with auto-detect is also shown with the movie Hitchcock. It's in a subfolder Transmission, which he will use as a clue for the look-up.
How can I fix this?


FYI, I downloaded some other episodes (NCIS, Pretty Little Liars) this morning and it worked just fine


Thanks!

Re: [HELP] Fully Automated Media Center

Posted: 06 Mar 2013, 14:36
by rednoah
1.
FAQ wrote:Keep in mind that the CLI is strict by default so it will never mess up your files. In some cases you may need to enable -non-strict for more opportunistic matching like the GUI does.
You'll need to allow FileBot to handle uncertain cases as well:

Code: Select all

-non-strict
2.

Code: Select all

Mar 6, 2013 12:39:50 PM net.sourceforge.filebot.mediainfo.MediaInfo <clinit>
WARNING: Failed to preload libzen
libmediainfo and libzen are not working. FileBot isn't able to grab media information. WARNING => Ignore unless something doesn't work for you.

3.
Added "transmission" to the blacklist. Should auto-magically work by tomorrow.

Re: [HELP] Fully Automated Media Center

Posted: 06 Mar 2013, 16:12
by colicab
Right, in my newest command the -non-strict was gone. This solved it

Thanks for the transmission thingy ;)

Re: [HELP] Fully Automated Media Center

Posted: 06 Mar 2013, 18:11
by itzkr0me
Disregard, created a new thread.

Re: [HELP] Fully Automated Media Center

Posted: 08 Mar 2013, 14:47
by colicab
Rednoah,

thanks for all the help and for making FileBot :D

I posted my setup using FileBot here

http://forum.qnap.com/viewtopic.php?f=45&t=72488

Cheers