None of these work: replace('AC-3','DD') or replace('AC3','DD') or replace('Dolby Digital','DD')

All about user-defined episode / movie / file name format expressions
Post Reply
CaptainKen
Posts: 7
Joined: 19 Dec 2024, 22:10
Location: Gilbert, AZ
Contact:

None of these work: replace('AC-3','DD') or replace('AC3','DD') or replace('Dolby Digital','DD')

Post by CaptainKen »

Format: Select all

{n.replaceTrailingBrackets()} s{S00}e{E00} - {t} ({source} {vf} {vc.replace('AVC','x264').replace('HEVC','x265')} {aco.replace('AC3','DD').replace('Dolby Digital Plus with Dolby Atmos','DDP Atmos').replace('Dolby Digital Plus','DDP')} {channels} { 'en' in {textlanguages} ? ' subs' :null in {textlanguages} ? ' UNDSUB' : null }{subt})
Original FileName: NCIS s22e08 - Out of Control (HDTV-720p x265 AC3 5.1).mkv

When I use either of these expressions or remove them all: aco.replace('AC-3','DD') or aco.replace('AC3','DD') or aco.replace('Dolby Digital','DD')
I get this: NCIS s22e08 - Out of Control (HDTV 720p x265 Dolby Digital 5.1).mkv

So, unlike the other aco.replace expressions the "Dolby Digital" is being ignored.

Desired FileName" NCIS s22e08 - Out of Control (HDTV 720p x265 DD 5.1).mkv

LOGS:
# C:\Users\capta\AppData\Roaming\FileBot\logs\error.log
Dec 19, 2024 12:16:21 PM net.filebot.DiskStore acquireDiskStore
WARNING: Initialize new disk cache: C:\Users\capta\AppData\Roaming\FileBot\cache\0
Dec 19, 2024 1:05:47 PM net.filebot.License lambda$verifyLicense$2
WARNING: Activate License [PX67913137] on [Thu Dec 19 13:05:47 MST 2024]


https://pastebin.com/5VmdvB7Q

As you can see in this screen shot, all the other replace expressions work.
Screenshot
https://imgur.com/a/iPtINTP
User avatar
rednoah
The Source
Posts: 24026
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: None of these work: replace('AC-3','DD') or replace('AC3','DD') or replace('Dolby Digital','DD')

Post by rednoah »

:idea: {aco} may be based on one of the following audio stream properties:

Groovy: Select all

audio.Codec_Profile

Groovy: Select all

audio.Format_Profile

Groovy: Select all

audio.Format_Commercial

:idea: {aco} gives you Dolby Digital for the file at hand because that's what Format_Commercial says:

Properties: Select all

Format_Commercial          : Dolby Digital

:idea: Your code takes the value of {aco} and then replaces various values. The code notably does not replace Dolby Digital so Dolby Digital is what you get Dolby Digital:

Groovy: Select all

aco.replace('AC3','DD').replace('Dolby Digital Plus with Dolby Atmos','DDP Atmos').replace('Dolby Digital Plus','DDP')

:idea: If you want to replace Dolby Digital with DD for example, then your code would have to specify that:

Groovy: Select all

aco.replace('Dolby Digital','DD')

:idea: You can specify multiple replacement operations like so:

Groovy: Select all

aco.replace(
	'Dolby Digital Plus with Dolby Atmos' : 'DDP Atmos',
	'Dolby Digital Plus' : 'DDP',
	'Dolby Digital' : 'DD',
	'AC3' : 'DD'
)




EDIT:

If you get different results, please post the code that gives you different results. The code in your OP above notably does not include a Dolby Digital replacement.
:idea: Please read the FAQ and How to Request Help.
CaptainKen
Posts: 7
Joined: 19 Dec 2024, 22:10
Location: Gilbert, AZ
Contact:

Re: None of these work: replace('AC-3','DD') or replace('AC3','DD') or replace('Dolby Digital','DD')

Post by CaptainKen »

Thank you for the reply and all the many details!

I was able to get it working by changing the order of the aco expressions as shown here:

Format: Select all

{n.replaceTrailingBrackets()} s{S00}e{E00} - {t} ({source} {vf} {vc.replace('AVC','x264').replace('HEVC','x265')} {aco.replace('Dolby Digital Plus with Dolby Atmos','DDP Atmos').replace('Dolby Digital Plus','DDP').replace('Dolby Digital','DD')} {channels} { 'en' in {textlanguages} ? ' subs' :null in {textlanguages} ? ' UNDSUB' : null }{subt})
I took your advise and used better formatting (Is there an even better way?):

Format: Select all

{n.replaceTrailingBrackets()} s{S00}e{E00} - {t} ({source} {vf}
{vc.replace(
	'AVC' : 'x264',
	'HEVC' : 'x265'
)} 
{aco.replace(
	'Dolby Digital Plus with Dolby Atmos' : 'DDP Atmos',
	'Dolby Digital Plus' : 'DDP',
	'Dolby Digital' : 'DD',
	'AC3' : 'DD'
)} 
{channels}
{ 'en' in {textlanguages} ? ' subs' :null in {textlanguages} ? ' UNDSUB' : null }{subt})
Really loving the power of your program as well as your support. Don't know how you manage to do it all, but thank you.
User avatar
rednoah
The Source
Posts: 24026
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: None of these work: replace('AC-3','DD') or replace('AC3','DD') or replace('Dolby Digital','DD')

Post by rednoah »

CaptainKen wrote: 23 Dec 2024, 22:27 Is there an even better way?
The code looks readable and manageable now. That's what matters. Good job.
:idea: Please read the FAQ and How to Request Help.
Post Reply