Commentary track
Posted: 17 Nov 2020, 19:24
I use the GUI interface and I'm trying to rename my files that have multiple audio tracks and also have a Commentary track per the MediaInfo data.
I realize that if the track is not named as "Commentary" in the MediaInfo data then the renaming will be null. For those files with a Commentary track but not tagged as such in MediaInfo I'll have to go through each file that is listed with multiple audio tracks and check manually. For those, I will use mkvtools to fix the metadata and rerun the file naming code I have created with the help of these forums.
Nevertheless, here is the test code I have that seems to work (assuming 5 audio tracks max), but I'm thinking there is an easier code that works for the part to tag the filename with 'Commentary'.
{(audio.size() > 1) ? audio.size() + 'AUD.' : ""}
{audio[0].title.contains('Commentary') ? 'Commentary.' :
audio[1].title.contains('Commentary') ? 'Commentary.' :
audio[2].title.contains('Commentary') ? 'Commentary.' :
audio[3].title.contains('Commentary') ? 'Commentary.' :
audio[4].title.contains('Commentary') ? 'Commentary.' : ''}
I thought one of these might work but I was wrong.
{audio().title.contains =~ /Commentary/ ? 'COMMENTARY' : ''}
{audio.title().contains =~ /Commentary/ ? 'COMMENTARY' : ''}
{audio.title.contains() =~ /Commentary/ ? 'COMMENTARY' : ''}
I have tried various other alternatives that were not a if then else statement but none of those worked either.
I'm hoping that a more simple code will help me not only in this example but to also understand better how the coding works and that might help me with other similar examples I have in my coding for nested if then else. I apologize in advance if there is a simple answer that I'm not seeing but I'm not a programmer.
TIA
J
I realize that if the track is not named as "Commentary" in the MediaInfo data then the renaming will be null. For those files with a Commentary track but not tagged as such in MediaInfo I'll have to go through each file that is listed with multiple audio tracks and check manually. For those, I will use mkvtools to fix the metadata and rerun the file naming code I have created with the help of these forums.
Nevertheless, here is the test code I have that seems to work (assuming 5 audio tracks max), but I'm thinking there is an easier code that works for the part to tag the filename with 'Commentary'.
{(audio.size() > 1) ? audio.size() + 'AUD.' : ""}
{audio[0].title.contains('Commentary') ? 'Commentary.' :
audio[1].title.contains('Commentary') ? 'Commentary.' :
audio[2].title.contains('Commentary') ? 'Commentary.' :
audio[3].title.contains('Commentary') ? 'Commentary.' :
audio[4].title.contains('Commentary') ? 'Commentary.' : ''}
I thought one of these might work but I was wrong.
{audio().title.contains =~ /Commentary/ ? 'COMMENTARY' : ''}
{audio.title().contains =~ /Commentary/ ? 'COMMENTARY' : ''}
{audio.title.contains() =~ /Commentary/ ? 'COMMENTARY' : ''}
I have tried various other alternatives that were not a if then else statement but none of those worked either.
I'm hoping that a more simple code will help me not only in this example but to also understand better how the coding works and that might help me with other similar examples I have in my coding for nested if then else. I apologize in advance if there is a simple answer that I'm not seeing but I'm not a programmer.
TIA
J