TVDB Episode ID, Language, HDR, Atmos, DD detetctions?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

TVDB Episode ID, Language, HDR, Atmos, DD detetctions?

Post by DevXen »

1. is there a binding for the episode id from TheTVDB? - I.E. 297989 from it's direct address: https://thetvdb.com/series/firefly/episodes/297989.
1a. if so is there any reason to add that? will FileBot detect to match it to find the correct episode.
If not, it would be useful for times when FileBot keeps pulling the incorrect episode at times.)

2. Is it possible to detect if the file has HDR, Atmos, or Dolby Digital?


3. What is the best way to detect the language in the file?

I currently have:

Code: Select all

{if (audio.LanguageString[2]) '[Triple Audio]' }{if (audio.LanguageString[1]) '[Dual Audio]' }} {any{if (audio.LanguageString[1]) {audio.LanguageString.unique().join(', ')}}{file.path.lower().replaceAll(/cn/,'Chinese').matchAll(/afrikaans[\. ]|albanian[\. ]|arabic[\. ]|burmese[\. ]|danish[\. ]|deutsch[\. ]|dutch[\. ]|english[\. ]|finnish[\. ]|french[\., ]|hebrew[\. ]|hindi[\. ]|hungarian[\. ]|icelandic[\. ]|indonesian[\. ]|italiano[\. ]|italian[\. ]|italian[\. ]|japanese[\. ]|korean[\. ]|navajo[\. ]|norwegian[\. ]|polish[\. ]|portuguese[\. ]|punjabi[\. ]|romanian[\. ]|scottish gaelic[\. ]|scottish[\. ]|spanish[\. ]|swahili[\. ]|swedish[\. ]|tagalog[\. ]|thai[\. ]|tibetan[\. ]|vietnamese[\. ]|yiddish[\. ]|slovak[\. ]|greek[\. ]|chinese[\. ]|czech[\. ]|german[\. ]|latvian[\. ]|russian[\. ]|serbian /).unique()*.upperInitial()*.lowerTrail().sort().join(', ')}{any{file.path.match(/dual.audio/)+' '}{info.SpokenLanguages.displayLanguage =~ /eng|en|English|Unknown|Unspecified/ ? 'English' : info.SpokenLanguages.displayLanguage.unique().join(', ').replace('cn','Chinese')}{'Unspecified Language'}}}

but that doesn't seem efficient. as you can see it's looking in the filename. then it'll look for the spoken language. and if not listed it'll put it as unknown. but that usually is English, i've found.
So i was wondering if there is a better way to detect the audio language then add the language to the filename. (unless it's got multiple tracks then just have it add dual audio, triple audio, etc.

Any help or suggestions would be appreciated.
Thanks
-Dev
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: TVDB Episode ID, Language, HDR, Atmos, DD detetctions?

Post by rednoah »

1.
You can add the numeric Episode ID via { episode.id } but there is no reason to add it. FileBot does not use it. AFAIK, nobody (except the database itself) uses it.


:idea: Note that depending on how the episode was added, it's possible for the "same" episode to be listed with different IDs. Presumably, it's also possible for IDs to become "orphaned" when episodes are removed and then added again.


:?: Can you provide an example of FileBot pulling an incorrect episode? You mean renaming an episode correctly at first, but then getting a bad match the second time around because someone changed the SxE numbers in the database?



2.
{hdr} and {aco} audio channels object might work? What have you tried so far?


:?: What does the MediaInfo Inspector say for the file at hand?

Image



3.
I'd just use {audioLanguages} if I want to see the audio stream languages media information, or {languages} for the spoken languages movie / series information. But you wrote some very complicated code there. Can you specify your requirements?



EDIT:

:!: Feel free to create separate forum topics for separate topics / questions in the future.
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: TVDB Episode ID, Language, HDR, Atmos, DD detetctions?

Post by DevXen »

thanks for the info on the episode id. - often times when i go to rename full seasons it'll pull up a one or more incorrect episodes of the show. usually from a different season. even though the whole season is named the same. with nfo file, or metadata to tell it it's a different episode. i'm guessing it's from trying to guess from the episode name. i'm not sure. i'll take a screen shot the next time it happens and post it.

i'll mess with the {hdr} and {aco} and see whgt i can get worked out.

my code snipplet is pretty complicated. so first it checks to see if there is more than 1 audio track. if so it'll add Dual Audio, Tripple Audio, to the file name. if it only has 1 audio track then it looks in the file name for a language tag. Japanese, russian, etc, and if it finds one. it'll add it to the file name. if it doesn't find one, then it tries to check the label of the audio track its self to determine the language. if still none is listed. it'll just put: Unspecified Language. As shown below:

Taken from my actual filenames:

Multiple Audio tracks with at least one of them identified as English:
[Quadruple Audio] [BDRip 2160p English 7.1ch MLP x265]
[Triple Audio] [WEB-DL 2160p English 5.1ch DTS HEVC]

Single English Audio track:
[AMZN.WEB-DL 2160p English 5.1ch EAC3 HEVC]

Single Foreign audio tracks:
[BDRip 720p Czech. 5.1ch AAC x264]
[BDRip 576p French 5.1ch AC3 x264]


i'm doing this to not only label them correctly but also to separate the videos with at least 1 English track from the ones with no English track for my libraries.
so i thought as i was asking about HDR. i would see if there might be an easier/better way to do it vs what i am currently doing.

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

Episode ID, Multiple Audio

Post by rednoah »

Re: Episode ID

If you already know the episode ID then that suggests that you have already processed the files with FileBot. If you re-process files again later, then you'll want to use xattr metadata instead of processing files again from scratch. See Re-organize previously organized files using local xattr metadata for details.



Re: ATMOS and DD

Please post the MediaInfo table here or on Pastebin. At some point someone will find this thread, and wonder what the MediaInfo table looked like for the files in question.



Re: Multiple Audio

I'd start by making the code more readable:

Code: Select all

{
	switch(audioLanguages.size()) {
		case 1: audioLanguages[0].name
		case 2: 'Dual Audio'
		case 3: 'Triple Audio'
		case 3: 'Triple Audio'
		case 4: 'Quadruple Audio'
		default: 'Multi Audio'
	}
}

Code: Select all

{
	audioLanguages =~ /eng/ ? 'English Audio' : 'No English Audio'
}
:idea: Please read the FAQ and How to Request Help.
DevXen
Power User
Posts: 164
Joined: 12 Oct 2014, 21:15

Re: TVDB Episode ID, Language, HDR, Atmos, DD detetctions?

Post by DevXen »

Here's some pics of it finding the incorrect episode number. this is the filename: Camp Candy - s02e14 - Scare Package.mkv
it has'nt been named yet.

here is the filebot screen shot:
Image

here it is scrolled to the right:
Image

and here's the MediaInfo:
Image
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: TVDB Episode ID, Language, HDR, Atmos, DD detetctions?

Post by rednoah »

Re: Episode Mismatch

You need to use the database that matches your files. If you get a "stupid match" then that typically means there is no "correct match" (i.e. Episode 2x14 does not exist, and Episode 2x13 is already taken by another file) in the first place, and things go random from there:
viewtopic.php?t=4695


The files you have seem to be numbered according to TheMovieDB::TV and so matching against TheMovieDB::TV will work best:

Code: Select all

$ filebot -list --db TheMovieDB::TV --q "Camp Candy" --filter "t =~ /Scare/" --log INFO
Camp Candy - 2x14 - Scare Package

However, 2x14 does not exist according to TheTVDB and so things go awry from there if you select TheTVDB to process this set of files. Your files are off-by-one and so all your matches are wrong, not just the one highlighted in red, because of some discrepancy between how files are named and how episodes have been organised in your chosen database:

Code: Select all

$ filebot -list --db TheTVDB --q "Camp Candy" --filter "t =~ /Scare/" --log INFO
Camp Candy - 2x13 - Scare Package

:idea: SxE numbers take precedence by default, but you can match-by-title if you need to translate SxE numbers from one database to another, i.e. use the episode title as identifying piece of information instead of the SxE numbers for the use case at hand.


:!: Adding an Episode ID wouldn't help in this case, because the person renaming with 2x14 numbers would be using the TheMovieDB/TV Episode ID as well, and interpreting those as TheTVDB Episode ID would lead to completely random behaviour. At best, a scoped tag like {tmdb-episode-1234} would suggest that we need to use TheMovieDB/TV to match the file, though the ID number itself wouldn't be very useful.
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22999
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: TVDB Episode ID, Language, HDR, Atmos, DD detetctions?

Post by rednoah »

Re: MediaInfo

:idea: The MediaInfo summary you have posted seems to be for a file without HDR / ATMOS / DD. If you want to detect HDR / ATMOS / DD then you'll want to compare the MediaInfo table from files with HDR / ATMOS / DD to the MediaInfo table from files without, and see if there's some notably difference that we can use for HDR / ATMOS / DD detection.


Next Time: Please use the FileBot Desktop application (and not the MediaInfo Desktop application) to copy the raw MediaInfo properties into the clipboard for sharing:
rednoah wrote: 05 Nov 2016, 14:58 Image Open FileBot ➔ Image Edit Format ➔ Image Change Sample ➔ Image Open MediaInfo

Image
:idea: Please read the FAQ and How to Request Help.
Post Reply