Copy movie to folder based on label

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
noid
Posts: 5
Joined: 14 Apr 2013, 05:49

Copy movie to folder based on label

Post by noid »

Hi there, I was wondering if anyone could direct me how I might alter the amc script to make it copy movies to a specific folder based on the label from utorrent? Ie. if labelled "kids" it will copy it to the folder D:/Kids movies/

Thanks for your help.
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Copy movie to folder based on label

Post by rednoah »

You'll have to modify the script for that. Find the movieFormat variable and insert the value of the ut_label variable that is passed in somewhere.
:idea: Please read the FAQ and How to Request Help.
noid
Posts: 5
Joined: 14 Apr 2013, 05:49

Re: Copy movie to folder based on label

Post by noid »

Thanks for the hint. I'm not familiar with Java or Groovy so not sure how to insert a variable into a string. I tried a few things like this below, based on what I could find on the web, but its not passing on the variable:

mov: tryQuietly{ movieFormat } ?: '''$ut_label/{n} ({y})/{n} ({y}){" CD$pi"}{".$lang"}''',
mov: tryQuietly{ movieFormat } ?: '''${ ut_label }/{n} ({y})/{n} ({y}){" CD$pi"}{".$lang"}''',
mov: tryQuietly{ movieFormat } ?: ''''$ut_label'/{n} ({y})/{n} ({y}){" CD$pi"}{".$lang"}''',

Ideally I'd like to use if statements to make it more flexible, but it didn't work either:

if {ut_label = "Kids"} {
mov: tryQuietly{ movieFormat } ?: '''Kids Movies/{n} ({y})/{n} ({y}){" CD$pi"}{".$lang"}''',
}

I'm sure this is trivial for someone who knows java. Any suggestions would be much appreciated.

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

Re: Copy movie to folder based on label

Post by rednoah »

Change this:

Code: Select all

'''Movies/{n} ({y})/{n} ({y}){" CD$pi"}{".$lang"}'''
To:

Code: Select all

ut_dir + '''Movies/{n} ({y})/{n} ({y}){" CD$pi"}{".$lang"}'''
:idea: Please read the FAQ and How to Request Help.
noid
Posts: 5
Joined: 14 Apr 2013, 05:49

Re: Copy movie to folder based on label

Post by noid »

Perfect - thanks so much!
jbalsor
Posts: 8
Joined: 18 Nov 2015, 20:33

Re: Copy movie to folder based on label

Post by jbalsor »

sorry to resurrect such an old post but I am trying to do exactly this in utorrent.

I have Labels set up like "New Releases" and "Kid Friendly"

Ho would I add to the script to put my movies in these folders?

this is the script i am running now. Works awesome by the way.

Code: Select all

filebot -script fn:amc --output "K:\Media" --log-file amc.log --action copy --conflict override -non-strict --def music=y subtitles=en artwork=y "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" --def clean=y
jbalsor
Posts: 8
Joined: 18 Nov 2015, 20:33

Re: Copy movie to folder based on label

Post by jbalsor »

I realize now that I have to modify the amc script, where is it located on my PC?
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Copy movie to folder based on label

Post by rednoah »

1.
It's not. It's on GitHub.

2.
No, you don't. You just need to pass in custom format expressions. If you pass in a label to the amc script, then you'll be able to access it with {label} in your format expression.
:idea: Please read the FAQ and How to Request Help.
jbalsor
Posts: 8
Joined: 18 Nov 2015, 20:33

Re: Copy movie to folder based on label

Post by jbalsor »

ok thank you! I am new to this where would I access the format expression?

would I somehow modify this code:

Code: Select all

--def "seriesFormat=X:/TV/{n}/{'S'+s}/{fn}" "animeFormat=X:/Anime/{n}/{fn}" "movieFormat=Z:/Movies/{n} {y}/{fn}" "musicFormat=Z:/Music/{n}/{fn}"
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Copy movie to folder based on label

Post by rednoah »

You can try with something like this:

Code: Select all

Z:/{label}/Movies/{n} {y}/{fn}
And then move on to conditions based on the label value if that's what you want.
:idea: Please read the FAQ and How to Request Help.
jbalsor
Posts: 8
Joined: 18 Nov 2015, 20:33

Re: Copy movie to folder based on label

Post by jbalsor »

Awesome ill try that when i get home.

Code: Select all

--def "movieFormat=Z:/{label}/Movies/{n} {y}/{fn}
something like that, I only use labels with movies.
jbalsor
Posts: 8
Joined: 18 Nov 2015, 20:33

Re: Copy movie to folder based on label

Post by jbalsor »

would I have to change Z: to my K: or is the Z a constant?
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Copy movie to folder based on label

Post by rednoah »

Neither? Z, K, A, B, C, etc are Windows Drive letters? You know?

Just checking:
* You know what Z:/ means, right?
* You know what {fn} means, right?

You may want to figure out how format expressions work first (using the FileBot Format Editor) before you move on using custom formats in the amc script.
:idea: Please read the FAQ and How to Request Help.
jbalsor
Posts: 8
Joined: 18 Nov 2015, 20:33

Re: Copy movie to folder based on label

Post by jbalsor »

Yes i thought they were drive letters, my Drive is K: and a folder called Media to store everything, so I would change to Z to K, thank you.

So I will add this line to my utorrent amc line and if im not mistaken it will add the utorrent Label to the path when it copies.

Code: Select all

--def "movieFormat=K:/Media/{label}/Movies/{n} {y}/{fn}
I dont really know what im doing but I would love to learn.
User avatar
rednoah
The Source
Posts: 23930
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Copy movie to folder based on label

Post by rednoah »

Since you already have --output "K:/Media" you can just do --def "movieFormat={label}/Movies/{n} {y}/{fn}" since the format is relative to the --output folder.

Also, {fn} means original filename.

You can learn from the Automated Media Center Defaults here: viewtopic.php?f=5&t=2
:idea: Please read the FAQ and How to Request Help.
jbalsor
Posts: 8
Joined: 18 Nov 2015, 20:33

Re: Copy movie to folder based on label

Post by jbalsor »

This is great! thank you! I will definitely read through that thread.

One more thing if my folder structure is this:

K:\Media\Movies\New Releases

And my utorrent label is "New Releases" should I move the {label} to this spot:?


Code: Select all

--def "movieFormat=Movies/{label}/{n} {y}/{fn}"
jbalsor
Posts: 8
Joined: 18 Nov 2015, 20:33

Re: Copy movie to folder based on label

Post by jbalsor »

It worked great! Many thanks, I hit the donate button, I have no issue paying for such great service
ronniehd
Posts: 10
Joined: 29 Dec 2015, 17:01

Re: Copy movie to folder based on label

Post by ronniehd »

Hello, this is my first post and been searching and reading for few days now to find a way to move and rename downloaded media with utorrent based on labels. I was looking for an automated single solution for renaming different media type/categories and after sans google showed me filebot as a potential winner i started to check out it's CLI capabilities (i've used filebot GUI before but didn't know about the CLI feature).

Ok, so tested AMC script and it works!, but soon i realized how basic it was and that i needed to modify it in order to fit my needs. I'm new to this and i find it a bit complex but i've been doing ok so far.

Here's my case scenario (Win 10 x64bits):

I created labels that contain subfolders in uTorrent (Preferences>UI Extras>Persistent Labels), these labels match my current file media structure as you can see in the images below but i keep "Append the torren't label" option unchecked.
The goal is to make AMC script use these labels as directories guided by --output path in order to have a fully organized media.

Image
Image
Image

e.g: I download a Concert, a Documentary Series, a TV Show episode, a Web-DL Movie and a Kid's Movie; i have different folders/subfolders for them but all these folders are inside S:/myMedia

Facts:
* Concerts, Web-DL Movie and Kid's Movie are scanned by TheMoveDB
* Documetary Series and the TV Show episode are scanned by TheTVDB

Code: Select all

"C:/Program Files/FileBot/filebot.launcher.exe" -script fn:amc --output "S:/myMedia" --log-file amc.log --action move --conflict override -non-strict --def excludeList=amc.txt "movieFormat={label}/{n} {y}/{n} {y}" "seriesFormat={label}/{n}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{n} - {s00e00} - {t.replaceAll(/[`´‘’ʻ]/, /'/).replaceAll(/[!?.]+$/).replacePart(', Part $1')}{'.'+lang}" unsorted=y music=y "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" --def clean=y xbmc=localhost
If i use that code based on my labels setup and my example, are the downloads going to be moved to it's respective folder? ... i want to be sure

Edit: Success!

Concerts go to S:/myMedia/Concerts,
Documentary Series go to S:/myMedia/Documentaries/Series,
WEB-DL Movies go to S:/myMedia/Movies/WEB-DL,
Kid's Movies go to S:/myMedia/Kid's Movies (that one has a space, don't know if it will cause conflict?)
... and so on

PS: Movies naming is basic and applies for all the different categories (concerts, documentary films, etc), i like it that way but with TV Shows the naming had to be more advanced because of specials, seasons, parts so i took the default one from github.
Post Reply