Automated Media Center: --def exec option
Automated Media Center: --def exec option
I've been using the amc with uTorrent for renaming and fetching subtitles for some time now and it works like a charm!
Amc sorts my incoming media files depending on type (Movies/TVshows) and the TVshows are put into folders named after the show.
Nothing strange, just basic stuff for amc (isn't that nice ).
As it happens, I now need to have an extra copy of my TV show episodes (on another drive).
So I added the new exec command to the amc call after the --def flag like this: "exec=E:/batfiles/tvixcopy.bat ""{file}"""
The called tvixcopy.bat file consist of one line only: "copy "%~f1" "E:\TVshows\%~nx1""
So far so good, also works just fine.
However, I would like to get a duplicate copy of TV shows only but not of Movies.
So to the questions:
1. Is there a smarter way of doing this? Searched the forums but didn't find anything...
2. If not; are there any other parameters (than the {file}) to send along? (For this purpose or others).
(I know that there's always the possibility to filter on the {file} parameter against my known TV/Movies location but when changing target locations I would have to edit the tvixcopy.bat as well.)
Cheers
/D
Amc sorts my incoming media files depending on type (Movies/TVshows) and the TVshows are put into folders named after the show.
Nothing strange, just basic stuff for amc (isn't that nice ).
As it happens, I now need to have an extra copy of my TV show episodes (on another drive).
So I added the new exec command to the amc call after the --def flag like this: "exec=E:/batfiles/tvixcopy.bat ""{file}"""
The called tvixcopy.bat file consist of one line only: "copy "%~f1" "E:\TVshows\%~nx1""
So far so good, also works just fine.
However, I would like to get a duplicate copy of TV shows only but not of Movies.
So to the questions:
1. Is there a smarter way of doing this? Searched the forums but didn't find anything...
2. If not; are there any other parameters (than the {file}) to send along? (For this purpose or others).
(I know that there's always the possibility to filter on the {file} parameter against my known TV/Movies location but when changing target locations I would have to edit the tvixcopy.bat as well.)
Cheers
/D
Re: Automated Media Center: --def exec option
Well, you'll still have to check that somewhere. By the time it's running the execs it doesn't know anymore what's originally been a movie and what not.
The parameters work the same as the format. So you could do something like
The parameters work the same as the format. So you could do something like
Code: Select all
copy "{file =~ /Movies/ ? file : 'N:/invalid-path-that-makes-copy-fail'}" "X:/some/where"
Please read the FAQ and How to Request Help.
Re: Automated Media Center: --def exec option
Are you saying that it's possible to pass along all parameters from http://www.filebot.net/naming.html, section Binding Reference?
So if the uTorrent amc call included:
--def "exec=E:/batfiles/tvixcopy.bat ""{file}"" ""{n}"" ""{sxe}"" ""{t}"" "
my bat file would receive 4 parameters (file, series/movie name, season / episode numbers, episode title) ?
(I assume some sort off null value for n.a. values; like {sxe} for a Movie file?)
Where can I find info about the syntax in your example?
(file =~ /Movies/ ? file : 'N:/invalid-path-that-makes-copy-fail')
Is it groovy? I'll google it, but maybe you have some good suggestions?
PS
Am I right in assuming that your example was supposed to be used like this?:
--def "exec=copy "{file =~ /Movies/ ? file : 'N:/invalid-path-that-makes-copy-fail'}" "X:/some/where" "
DS
/D
So if the uTorrent amc call included:
--def "exec=E:/batfiles/tvixcopy.bat ""{file}"" ""{n}"" ""{sxe}"" ""{t}"" "
my bat file would receive 4 parameters (file, series/movie name, season / episode numbers, episode title) ?
(I assume some sort off null value for n.a. values; like {sxe} for a Movie file?)
Where can I find info about the syntax in your example?
(file =~ /Movies/ ? file : 'N:/invalid-path-that-makes-copy-fail')
Is it groovy? I'll google it, but maybe you have some good suggestions?
PS
Am I right in assuming that your example was supposed to be used like this?:
--def "exec=copy "{file =~ /Movies/ ? file : 'N:/invalid-path-that-makes-copy-fail'}" "X:/some/where" "
DS
/D
Re: Automated Media Center: --def exec option
Kinda, but of course all the episode/movie bindings will error out, always. You can only use file-based bindings {file} {fn} {ext} {folder} {vc} etc but not episode/movie-based bindings {n} {sxe} {year} etc
Yes, it's Groovy.
And make sure you cmdline-escape double-quotes properly.
Yes, it's Groovy.
And make sure you cmdline-escape double-quotes properly.
Please read the FAQ and How to Request Help.
Re: Automated Media Center: --def exec option
Thanks rednoah,
time to start experimenting.
Yeah, double quoting... I'll do as always - trial and error. After a while it ususally gets right.
- Still confused, but on a higher level!
time to start experimenting.
Yeah, double quoting... I'll do as always - trial and error. After a while it ususally gets right.
- Still confused, but on a higher level!
Re: Automated Media Center: --def exec option
@Hematot: Have you found the answer yet, cause I have a similar problem I can't seem to get past.
I'm trying to pass {file} {fn} {ext} {folder} to a batch script, so that I can re-encode with Handbrake, but I can't get those damn quotes right, so that Handbrake can understand the output filename. eg. --def exec=x:\batfile.bat "{file}" "{fn}" "{ext}" "{folder}" becomes eg. c:\tmp\"this is the folder name"\"this is the filename".mkv if there are spaces in file/folder name - and that's no good
I'm trying to pass {file} {fn} {ext} {folder} to a batch script, so that I can re-encode with Handbrake, but I can't get those damn quotes right, so that Handbrake can understand the output filename. eg. --def exec=x:\batfile.bat "{file}" "{fn}" "{ext}" "{folder}" becomes eg. c:\tmp\"this is the folder name"\"this is the filename".mkv if there are spaces in file/folder name - and that's no good
Re: Automated Media Center: --def exec option
Try this:
The amc script does log each command that is executed so you can easily try it yourself and see where you messed up the quotes.
Code: Select all
--def "exec=cmd /c x:\batfile.bat \"{file}\" \"{fn}\" \"{ext}\" \"{folder}\""
Please read the FAQ and How to Request Help.
Re: Automated Media Center: --def exec option
Yes, I got that working, but maybe I didn't explain my problem properly.
--def "exec=cmd /c x:\batfile.bat \"{file}\" \"{fn}\" \"{ext}\" \"{folder}\"" will execute the batfile with 4 variables.
The problem is that, when the file runs, the variables are still in "" eg. %2 = "Some filename" and %4 = "Some filepath".
Handbrake uses an -o (output) option it's filename to write to. But if I do like eg. "c:\tmp\%4\%2.ext", the result will be: "c:\tmp\"Some filepath"\"Some filename".mkv". As you can see that will not work, so I somehow have to to remove those " from the variables before pushing it in as a filepath/ -name.
--def "exec=cmd /c x:\batfile.bat \"{file}\" \"{fn}\" \"{ext}\" \"{folder}\"" will execute the batfile with 4 variables.
The problem is that, when the file runs, the variables are still in "" eg. %2 = "Some filename" and %4 = "Some filepath".
Handbrake uses an -o (output) option it's filename to write to. But if I do like eg. "c:\tmp\%4\%2.ext", the result will be: "c:\tmp\"Some filepath"\"Some filename".mkv". As you can see that will not work, so I somehow have to to remove those " from the variables before pushing it in as a filepath/ -name.
Re: Automated Media Center: --def exec option
Well, that's really an issue with your bat script. That always sucks.
Lets do more Groovy and less batch scripting. So you mean you want the filename? {file} will evaluate to the absolute path. You seem to want {file.name}, only the filename (i.e. filename with extension).
Lets do more Groovy and less batch scripting. So you mean you want the filename? {file} will evaluate to the absolute path. You seem to want {file.name}, only the filename (i.e. filename with extension).
Please read the FAQ and How to Request Help.
Re: Automated Media Center: --def exec option
Well basicly I just want a complete output-path. eg. c:\movies\Moviename (yyyy)\Moviename (yyyy).mkv, so I can pass that as an output string to Handbrake. Same place/path as FileBot copies the files to.
The thing is, I want to convert ISO files to mkv files, which my TV can play.
I actually got it working now with a little batch scripting (search/replace). I'm def not into groovy scripting lol
The thing is, I want to convert ISO files to mkv files, which my TV can play.
I actually got it working now with a little batch scripting (search/replace). I'm def not into groovy scripting lol
Re: Automated Media Center: --def exec option
Hi Hausner,
what I do is to pass along {file} from uTorrent like this:
'some stuff here' --def "exec=E:/batfiles/tvixcopy.bat ""{file}""" 'other --def args here'
Then in my batch file (tvixcopy.bat) I check if the target drive is U: (only my TV shows are renamed to that drive) and if so copy the file to E:
echo off
rem echo Full filename: %~f1
rem echo Parsed filename parts:
rem echo Drive letter only: %~d1
rem echo Path only: %~p1
rem echo File name only: %~n1
rem echo Extension only: %~x1
rem echo Target file name: E:\TVshows\%~nx1
if /i "%~d1" equ "U:" (
copy "%~f1" "E:\TVshows\%~nx1"
)
But as you can see in the rem'd rows, you can extract most anything!
Take a look at ss64.com: http://ss64.com - especially http://ss64.com/nt/syntax-args.html.
First test your syntax by calling a bat file that only echoes your parsed file name parts so you know when you've got your quotes and other things right.
Then move along to the actual stuff you wanna do (in my case the 'if then copy').
Hope this is some help for you.
/D
Btw, don't you want {file} as it is? It is the complete path with file name and everything...?
what I do is to pass along {file} from uTorrent like this:
'some stuff here' --def "exec=E:/batfiles/tvixcopy.bat ""{file}""" 'other --def args here'
Then in my batch file (tvixcopy.bat) I check if the target drive is U: (only my TV shows are renamed to that drive) and if so copy the file to E:
echo off
rem echo Full filename: %~f1
rem echo Parsed filename parts:
rem echo Drive letter only: %~d1
rem echo Path only: %~p1
rem echo File name only: %~n1
rem echo Extension only: %~x1
rem echo Target file name: E:\TVshows\%~nx1
if /i "%~d1" equ "U:" (
copy "%~f1" "E:\TVshows\%~nx1"
)
But as you can see in the rem'd rows, you can extract most anything!
Take a look at ss64.com: http://ss64.com - especially http://ss64.com/nt/syntax-args.html.
First test your syntax by calling a bat file that only echoes your parsed file name parts so you know when you've got your quotes and other things right.
Then move along to the actual stuff you wanna do (in my case the 'if then copy').
Hope this is some help for you.
/D
Btw, don't you want {file} as it is? It is the complete path with file name and everything...?
Re: Automated Media Center: --def exec option
Hi
I have a synology nas and am very new to filebot etc. But I've been very interested to read this post as I'd love to do some automation on my setup but don't know where to start! If there's any kind soul out there that would be happy to point me in the right direction I would be eternally grateful
Basically, I would like to add TV shows and movies to a downloads folder and from there filebot will automatically rename them accordingly and then sort them into the relevant folders (movies and TV shows - ideally by season) and handbrake will convert them to the mp4 format I need them to be in.
So far I've only managed to get filebot to sort them into folders and rename them in the format I want but I still need to set filebot off manually at the moment and tell it whether its a movie or a tv show. Its a small step in the right direction at least! It certainly sounds possible to achieve what I want from what I've been reading here though.....
So if anyone feels able to help me at all, it would be greatly appreciated!
Many thanks
I have a synology nas and am very new to filebot etc. But I've been very interested to read this post as I'd love to do some automation on my setup but don't know where to start! If there's any kind soul out there that would be happy to point me in the right direction I would be eternally grateful
Basically, I would like to add TV shows and movies to a downloads folder and from there filebot will automatically rename them accordingly and then sort them into the relevant folders (movies and TV shows - ideally by season) and handbrake will convert them to the mp4 format I need them to be in.
So far I've only managed to get filebot to sort them into folders and rename them in the format I want but I still need to set filebot off manually at the moment and tell it whether its a movie or a tv show. Its a small step in the right direction at least! It certainly sounds possible to achieve what I want from what I've been reading here though.....
So if anyone feels able to help me at all, it would be greatly appreciated!
Many thanks