What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
nanobot001
Posts: 3
Joined: 21 Feb 2022, 05:30

What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by nanobot001 »

Am trying to make my way through the AMC
viewtopic.php?f=4&t=215

Have zero experience with this stuff.

Regarding this part

Code: Select all

--def unsorted=y music=y artwork=y "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D"
Is there some kind of reference for what ut_label, ut_state, ut_title are all referring to?

I have kind of inferred what they all are from the examples, but have I missed a reference somewhere?

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

Re: super dumb question

Post by rednoah »

:?: Which tool are you using? The details differ depending on the tool you're using, but the gist is always to make it execute some arbitrary command-line tool, which happens to be filebot for our purposes:
rednoah wrote: 01 Aug 2012, 13:04 There's setup instructions for µTorrent, qBittorrent, rTorrent, Deluge, Transmission, Vuze, JDownloader and Automator. Since filebot is a simple command-line tool you can make it work with any software that can run external programs, or just call it every once in a while with cron.


The --def ut_* variables are meant to pass along information from the tool that is executing filebot to the filebot call itself:
rednoah wrote: 01 Aug 2012, 13:04 Troubleshooting
If something is not working, please read the Notes above, then run the command manually in a new console window to see what is happening. You CANNOT run the command without replacing the VARIABLES. The variables have to be replaced with actual values first.

e.g.

Code: Select all

filebot ... --def "ut_dir=D:\Media\Avatar" "ut_file=" "ut_kind=multi" "ut_title=Avatar" "ut_label=" "ut_state=5"

The %variables are specific to the tool that is executing filebot, and different tools may do things in different ways (e.g. replacement patterns, arguments, environment variables, etc) and in this case we assume that %variables are going to be replace with some specific values that filebot is then called with:
Image
:idea: Please read the FAQ and How to Request Help.
nanobot001
Posts: 3
Joined: 21 Feb 2022, 05:30

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by nanobot001 »

I think that makes a lot of sense.

It really helped just trying the CLI and working a few things out on my own

In my fiddling, I am noticing that for Anime the "episode order" is "absolute". How can I change this so it is "air date"

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

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by rednoah »

nanobot001 wrote: 21 Feb 2022, 16:38 In my fiddling, I am noticing that for Anime the "episode order" is "absolute". How can I change this so it is "air date"
You could use --def ut_label=TV to force TV Series mode for all files. This may or may not work well depending on how your files are named and numbered. But [Anime] Convert Absolute to SxE numbers is a completely different topic entirely, and may range from easy to tricky to impossible, depending on the specific use case / series you're dealing with. Best to deal with that manually in the GUI as needed.
:idea: Please read the FAQ and How to Request Help.
nanobot001
Posts: 3
Joined: 21 Feb 2022, 05:30

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by nanobot001 »

changing the --def ut_label=TV worked, in that the order episode date was "airdate", but of course, it changed the output directory to include "TV Shows" and not "Anime".

Is there anyway to force the amc script to output in a way that a) uses the ut_label=TV and then b) forces the output so it does not go to "TV shows"
User avatar
rednoah
The Source
Posts: 23468
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by rednoah »

Yes, you can pass a custom --def seriesFormat. Please read the Change how files will be organized and renamed section for details.


:idea: You'll want to prototype your custom format in the Format Editor GUI:
https://www.filebot.net/naming.html
:idea: Please read the FAQ and How to Request Help.
cheaters
Posts: 221
Joined: 09 Oct 2016, 02:01

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by cheaters »

@rednoah

Hello

Does FileBot need/use/expect the strings as you have written them: ut_label, ut_title, etc. ? Can that nomenclature be changed or will it break FileBot's ability to understand shell scripts.

qBittorrent v4 has changed their parameter names and I see no correlation or complete list in this forum for matching "ut_*" parameters. I don't want to guess what to use for qBittorrent's Category, Tags, and other parameters that you don't appear to have strings for...

:?: I.e. do we use "ut_cat=%L" and "ut_tag=%G"?

I also never understood what "ut_kind=multi" does or if it's required?

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

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by rednoah »

The %variables used in the examples are used, and all other variables are not used. Automated Media Center › Troubleshooting has an example command-line call with all variables filled in.


:idea: "ut_kind=%K" is used for uT because uT has a %K variable that can be either single or multi. qBT does not have a %K variable (EDIT: looks like it has a %K variable now but it's got a completely different meaning) so we pass in a fixed value instead. Different torrent clients work in different ways, but the goal is always a uniform amc script call with the completed download information passed along via command-line arguments. Please compare & contrast Automated Media Center › Setup Instructions for details.


:idea: The qBT setup instructions in the manual apply to qBT 4 and not qBT 3 so you can just copy & paste from the instructions. --def "ut_label=%L" "ut_title=%N" "ut_kind=multi" "ut_dir=%F" is indeed expected / required according to the qBT instructions.
:idea: Please read the FAQ and How to Request Help.
User avatar
Wolfie
Posts: 128
Joined: 27 Oct 2015, 02:59

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by Wolfie »

Would it be possible to add in tag support, where tags (comma separated) would be put into two arrays?

{tags[0]} returns returns the first tag, etc.
{tag['name']} returns true if the tag has been set (but false otherwise vs an error)

So if I use a tag like "TD," then {tag['TD']} will return true, but {tag['notTD']} will return false. Likewise, {tags[0]} would return "TD."

This would allow the use of expected tags (via "tag") and unexpected tags (via "tags") in scripts.

Either that, or is there a way that I can create/pass a variable from command line that could be used in my format script?
User avatar
rednoah
The Source
Posts: 23468
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by rednoah »

{tags} is a List so you can easily check if that List contains a certain value in a variety of ways.

e.g. Operators › Find

Groovy: Select all

tags =~ /REMASTERED/
e.g. Operators › Membership

Groovy: Select all

'REMASTERED' in tags
e.g. List.contains(Object)

Groovy: Select all

tags.contains('REMASTERED')



:!: Note that {tags} is unrelated to qBT. Please read The movie {tags} and movie {edition} bindings for details.



:idea: You can use {label} and {defines} to access --def ut_label specifically or the all --def name=value parameters.
:idea: Please read the FAQ and How to Request Help.
User avatar
Wolfie
Posts: 128
Joined: 27 Oct 2015, 02:59

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by Wolfie »

rednoah wrote: 01 Dec 2023, 06:58 :idea: You can use {label} and {defines} to access --def ut_label specifically or the all --def name=value parameters.
So something like --def qtags="%1" would let me use {qtags}?

Would it already be in an array, or would I need to split it? If so, would splits honor quote marks (if separating by commas)? And any way to have it create keys from the values?
User avatar
rednoah
The Source
Posts: 23468
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by rednoah »

Wolfie wrote: 01 Dec 2023, 07:16 So something like --def qtags="%1" would let me use {qtags}?
No. The binding is {defines} and it will give you a Map of all the --def name=value pairs:

Groovy: Select all

defines.qtags

Groovy: Select all

defines['qtags']
e.g.

Console Output: Select all

$ filebot -mediainfo . --format "{defines} | {defines.x} | {fn}" --def x=1 y=2 z=3
{x=1, y=2, z=3} | 1 | doctor.who.2005.s01e01


Wolfie wrote: 01 Dec 2023, 07:16 Would it already be in an array, or would I need to split it? If so, would splits honor quote marks (if separating by commas)? And any way to have it create keys from the values?
Please post an example file path and desired output value so that we have something to talk about. "quote mark" does not make sense in the context of using a List object in Groovy code. The command-line interpreter takes care of splitting by space and honouring quote marks before filebot is even called.
:idea: Please read the FAQ and How to Request Help.
User avatar
Wolfie
Posts: 128
Joined: 27 Oct 2015, 02:59

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by Wolfie »

Let's say that I have tags of TD,IPT, and "One Two," and all three are in a define.

--def qtags="%1" translates to --def qtags="TD,IPT,One Two"

How would I access it in the format file?
User avatar
rednoah
The Source
Posts: 23468
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by rednoah »

defines.qtags will give you a single String value, hence:

Console Output: Select all

$ filebot -mediainfo . \
  --format "{defines} | {defines.qtags} | C1={ defines.qtags.contains('One') } | { defines.qtags.tokenize(',') } | C2={ defines.qtags.tokenize(',').contains('One') } | C3={ defines.qtags.tokenize(',').contains('One Two') } | {fn}" \
  --def qtags="TD,IPT,One Two"
{qtags=TD,IPT,One Two} | TD,IPT,One Two | C1=true | [TD, IPT, One Two] | C2=false | C3=true | doctor.who.2005.s01e01
:idea: Please read the FAQ and How to Request Help.
User avatar
Wolfie
Posts: 128
Joined: 27 Oct 2015, 02:59

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by Wolfie »

Either I'm encountering a bug or I'm doing something wrong. I recall trying it when you initially showed it to me it worked. Now, when doing that same command, no matter what I try to use, it tells me that "

Code: Select all

This is not a -script call.  The script parameter --def (name) has no effect.
"

Be it qtags, or even music. Calling on it from within a bat file, some tags are accepted (music, unsorted, ut_label, etc.), but custom tags are not. Any ideas?
User avatar
rednoah
The Source
Posts: 23468
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by rednoah »

If you're manually passing in --def name=value parameters so you can then use them in your custom format for simple -rename calls, then the warning above is indeed a false positive. If your code works for you, then ignore the warnings.


:idea: The This is not a -script call. warning is meant for users that do simple filebot -rename calls but then add random amc script options expecting those options to do something. The simple filebot -rename never use any --def name=value options, except for the rare corner case (you're probably the only one in the world) where your custom format code (NOTE: filebot does not know what your format code does or does not do) actually does use them.


:?: Note that this thread is about amc script options, so if you get the This is not a -script call. warning then you are notably not using the amc script script. What are you trying to do anyway? What's your command-line call?
:idea: Please read the FAQ and How to Request Help.
User avatar
Wolfie
Posts: 128
Joined: 27 Oct 2015, 02:59

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by Wolfie »

When doing it in a script, I'm trying to pass "ttags" and get

Console Output: Select all

Invalid usage: --def ttags is not used and has no effect
as a result.

Using the command prompt directly, I get this:

Console Output: Select all

P:\FileBot>filebot -mediainfo   --format "{defines} | {defines.qtags} | {fn}" --def "music=n" qtags="TD,IPT,One Two"
* This is not a -script call. The script parameter --def music has no effect.
* This is not a -script call. The script parameter --def qtags has no effect.
No input arguments
The script processes the "ut_label" and other suggested items (ut_title for example) just fine, but a custom one, no go.

ETA: Nevermind on the command line one, I realized that I forgot the "." for the file. 🤦‍♂️
User avatar
rednoah
The Source
Posts: 23468
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by rednoah »

Yep, in your specific case these warnings don't make sense, so you can ignore them. The warnings are there for users who accidentally make up their own parameters, mistype parameters, etc, and thus mistakenly end up with options that don't actually do anything.


:arrow: Adding --log FINEST to the command will make these "help" messages go away.
:idea: Please read the FAQ and How to Request Help.
User avatar
Wolfie
Posts: 128
Joined: 27 Oct 2015, 02:59

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by Wolfie »

So then in the script, "ttags=(whatever)" still works, just Fb is throwing the warning as a precaution?
User avatar
rednoah
The Source
Posts: 23468
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: What does "ut_label=%L" "ut_state=%S" "ut_title=%N" "ut_kind=%K" "ut_file=%F" "ut_dir=%D" mean?

Post by rednoah »

Pretty much. It usually indicates a user error. Except in your specific use case. FileBot itself indeed does not use your custom variables, though you might in your specific custom code.
:idea: Please read the FAQ and How to Request Help.
Post Reply