"HDR" Added to Every Movie Title

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
jrhessey
Posts: 10
Joined: 30 Jun 2021, 14:16

"HDR" Added to Every Movie Title

Post by jrhessey »

For some reason, that I can't seem to figure out, the text HDR gets added to every movie. I want to tag HDR movies with HDR, but even SDR movies get HDR added to the filenames.

Here is the script I am using

Code: Select all

movieFormat=p:/movies/{n.sortName('$2, $1')} ({y})/{n}.{hdr = 'HDR' ? allOf{vf}{channels}{vc}{aco}{bitdepth+'bit'}{'HDR'}.join('.') : allOf{vf}{channels}{vc}{aco}.join('.')}
Here is the chunk from the log

Code: Select all

Run script [fn:amc] at [Fri Feb 04 04:16:09 EST 2022]
Parameter: clean = y
Parameter: deleteafterextract = y
Parameter: emby = *****
Parameter: movieFormat = p:/movies/{n.sortName('$2, $1')} ({y})/{n}.{hdr = 'HDR' ? allOf{vf}{channels}{vc}{aco}{bitdepth+'bit'}{'HDR'}.join('.') : allOf{vf}{channels}{vc}{aco}.join('.')}
Parameter: seriesFormat = p:/TV Shows/{n.sortName('$2, $1')}/{'Season '+s}/{n} - {s00e00} - {t.replaceAll(/[!?:.]+$/).replaceAll(/[`´‘’ʻ]/, "'")}.{hdr = 'HDR' ? allOf{vf}{af}{vc}{aco}{VIDEO[0].HDR_format_commercial}.join('.') : allOf{vf}{af}{vc}{aco}.join('.')}
Invalid usage: input folder [P:\TBOT\American.Underdog.2021.2160p.WEB-DL.x265.10bit.SDR.DDP5.1.Atmos-NOGRP] must not be inside output folder [P:\] and vice versa
Input: P:\TBOT\American.Underdog.2021.2160p.WEB-DL.x265.10bit.SDR.DDP5.1.Atmos-NOGRP\American.Underdog.2021.2160p.WEB-DL.x265.10bit.SDR.DDP5.1.Atmos-NOGRP.mkv
Group: {Movie=American Underdog (2021)} => [American.Underdog.2021.2160p.WEB-DL.x265.10bit.SDR.DDP5.1.Atmos-NOGRP.mkv]
Rename movies using [TheMovieDB]
Auto-detect movie from context [P:\TBOT\American.Underdog.2021.2160p.WEB-DL.x265.10bit.SDR.DDP5.1.Atmos-NOGRP\American.Underdog.2021.2160p.WEB-DL.x265.10bit.SDR.DDP5.1.Atmos-NOGRP.mkv]
[MOVE] from [P:\TBOT\American.Underdog.2021.2160p.WEB-DL.x265.10bit.SDR.DDP5.1.Atmos-NOGRP\American.Underdog.2021.2160p.WEB-DL.x265.10bit.SDR.DDP5.1.Atmos-NOGRP.mkv] to [p:\movies\American Underdog (2021)\American Underdog.2160p.5.1.HEVC.Dolby Digital Plus with Dolby Atmos.10bit.HDR.mkv]
Processed 1 file
Notify Emby [embyserver]
POST: https://embyserver:8920/Library/Refresh?api_key=05ef5cd09bf54b2ea00e8756be8389a2
Connect timed out
Clean clutter files and empty folders
Delete P:\TBOT\American.Underdog.2021.2160p.WEB-DL.x265.10bit.SDR.DDP5.1.Atmos-NOGRP\RARBG.txt
Delete P:\TBOT\American.Underdog.2021.2160p.WEB-DL.x265.10bit.SDR.DDP5.1.Atmos-NOGRP
Here is the screenshot of the filebot bindings where hdr is blank and therefore, the if hdr portion should be false and use the false part of the code.

https://drive.google.com/file/d/1F3UCr6 ... sp=sharing

Thanks for any help!!
kim
Power User
Posts: 1251
Joined: 15 May 2014, 16:17

Re: "HDR" Added to Every Movie Title

Post by kim »

Code: Select all

p:/movies/{n.sortName('$2, $1')} ({y})/{n}{'.'+allOf{vf}{channels}{vc}{aco}{bitdepth+'bit'}{HDR ? 'HDR' : null}.join('.')}
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: "HDR" Added to Every Movie Title

Post by rednoah »

{ 'HDR' } is an expression that will always yield the same constant value.


You'll want to use the hdr binding to get the value of that variable (if any) and then use that:

Code: Select all

{ hdr }
:idea: Note that you cannot set binding values, so any assignment of values to bindings (e.g. hdr = 123) has no effect.

:idea: Note that = is the assignment operator, and == is the equality operator. Hence a = b ? x : y doesn't make sense. It's not entirely clear what you're trying to achieve here, but perhaps the copy & paste solution provided by @kim does what you mean to do.
:idea: Please read the FAQ and How to Request Help.
jrhessey
Posts: 10
Joined: 30 Jun 2021, 14:16

Re: "HDR" Added to Every Movie Title

Post by jrhessey »

All I'm trying to do is put HDR at the end of the filename if it's an HDR movie. I tested Kims code and it appears to be doing that.

I tried the {hdr == 'HDR'} code, thinking exactly what you said rednoah, code but it showed an invalid exception at = when running it in the filebot app.

What does the question mark mean?

is your example a == b ? x : y, if a equals b then x else y?

Thanks for your help, I really appreciate it!
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: "HDR" Added to Every Movie Title

Post by rednoah »

Yes, and no. Syntactically, it's if-then-else but practically, if {hdr} is undefined (i.e. non-HDR files), then the {...} block will error out so any equality checks that you might have there will never actually get executed if HDR doesn't have some value.


:idea: Please read Conditional Structures (if-then-else) and Learn how {expressions} work and useful Helper Functions for details.
:idea: Please read the FAQ and How to Request Help.
Post Reply