Commentary tracks and more

All about user-defined episode / movie / file name format expressions
Post Reply
TheOneWhoKnocks
Posts: 4
Joined: 30 Nov 2022, 07:54

Commentary tracks and more

Post by TheOneWhoKnocks »

Hi, I need some advice on how to improve my current method of renaming movies:

e.g. The Curse of Frankenstein (1957) 1080p H265 [ENG, 2.0, AAC] [ITA, 2.0, AC3] [SUB ENG ITA][BluRay]


1) First point that i want to address is that many of my files contain an audio commentary that become included in the audio tag. I know that I can tag the audio as commentary, but what I would like to do is to prevent the script from adding it if it finds the commentary/Commentary tag in one of the audio tracks.

Mediainfo sample with multiple normal audio tracks and a commentary track : https://pastebin.com/r2GcGtGZ
Sample : https://www.swisstransfer.com/it-it


2) In many cases I have dual language files, and they may have different codecs and/or channels. With the current script the name can became quite long (e.g. [ENG, 2.0, AAC] [ITA, 2.0, AAC] ) and I would like to shorten it when the two audio tracks have the same codec and channels (e.g. [ENG ITA , 2.0, AAC].)

3) In other files I also have dual language with two different audio codecs , so in the extreme case I could have [ENG, 2.0, DTS][ENG, 2.0, AAC] [ITA, 2.0, DTS] [ITA, 2.0, AAC]. I would like to shorten it to [ENG ITA, 2.0, DTS][ENG ITA, 2.0, AAC].

Mediainfo of a sample (useful also for point 4 because contains also multiple subs tracks) : https://pastebin.com/hJNMYDtG
Sample : https://www.swisstransfer.com/d/7ee72fb ... d519d07146

4) The last point is about the subtitle tag. Usually I have two ore more embedded subs, one for each audio track, e.g. [SUB ENG ITA]. I would like to replace the sub language tag with MULTISUB when the subs >2 . I want also to exclude the subs of the commentary from the tag.
e.g. subtitle 1: ENG subtitle 2: ITA -----> [SUB ENG ITA]
subtitle 1: ENG subtitle 2: ITA subtitle 3: DEU -----> [Multisub]
subtitle 1: ENG subtitle 2: ITA subtitle 3: ENG audio commentary subtitle -----> SUB ENG ITA]

I thank in advance those who want to help me out and I want to apologize for my bad English.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Commentary tracks and more

Post by rednoah »

1. & 2. & 3.

Code: Select all

{
	audio.findAll{
		it.Title != /Commentary/
	}.groupBy{
		[it.Channels.toFloat().round(1), it.Format]
	}.collect{ group, it ->
		[it.LanguageString3.unique().join(' ').upper(), *group]
	}.join(' ')
}
e.g. The Bride of Frankenstein (1935) sample.mkv

Code: Select all

[ITA ENG, 2.0, DTS] [ITA ENG, 2.0, AAC]

4.

Code: Select all

{
	[ textLanguages.size() >= 3 ? 'MULTISUB' : textLanguages.join(', ').upper() ]
}
e.g. The Bride of Frankenstein (1935) sample.mkv

Code: Select all

[ITA, ENG]
:idea: {textLanguages} internally deduplicates language values, so MULTISUB will only appear if the sample file has 3 or more distinct subtitle languages.
:idea: Please read the FAQ and How to Request Help.
TheOneWhoKnocks
Posts: 4
Joined: 30 Nov 2022, 07:54

Re: Commentary tracks and more

Post by TheOneWhoKnocks »

Thank you very much for the fast reply.
I tested the script and works but I noticed that i didn't consider the case where I have only one language but two different codecs :
e.g. Cameriera senza... malizia (1980) 1080p AVC [ITA, 2.0, E-AC-3] [ITA, 2.0, AAC][WEB-DL]

Maybe can be shortened to [ITA, 2.0, E-AC-3 / AAC] or something similar but I think it could be less inuitive to read, at least for me.
TheOneWhoKnocks
Posts: 4
Joined: 30 Nov 2022, 07:54

Re: Commentary tracks and more

Post by TheOneWhoKnocks »

How can I keep the format of the audio channels as before? Now 5.1 channels are displayed as 6.0.

EDIT: Solved
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Commentary tracks and more

Post by rednoah »

TheOneWhoKnocks wrote: 01 Dec 2022, 14:33 EDIT: Solved
How? The next guy might be interested. Please copy & paste & share your final format expression.
:idea: Please read the FAQ and How to Request Help.
TheOneWhoKnocks
Posts: 4
Joined: 30 Nov 2022, 07:54

Re: Commentary tracks and more

Post by TheOneWhoKnocks »

This is the final code, I know it's not perfect but it works.

Code: Select all

{primaryTitle} ({y}) {vf} {vc.replace('x264', 'H.264').replace('ATEME', 'H.265').replace('x265', 'H.265').replace('AVC', 'H.264').replace('MPEG','MPEG2').replace('Microsoft', 'VC-1').replace('x265M', 'H.265').replace('H 265M', 'H.265')} {
	audio.findAll{
		it.Title != /Commentary/
	}.groupBy{
		[Channels.toFloat().round(1), it.Format.replace('MPEG Audio', 'MP3')]
	}.collect{ group, it ->
		[it.LanguageString3.unique().join(' ').upper(), *group]
	}.join('')
}{
	[textLanguages.size() >= 3 ? 'MULTISUB' : 'SUB '+textLanguages.join(', ').upper() ]
}{[vs]}
Post Reply