Page 1 of 1
How to detect silent movies
Posted: 08 Jun 2022, 19:40
by Voleure
Hi I have a simple labeling scheme that separates DUBBED from original language movies but I can't find a way to detect silent movies seems to not have a languages entry or at least i can't seem to detect it programmatically
Code: Select all
{drive}/Media/Movies/{plex[1]} - [{if (audioLanguages[0] =~ /eng/) return "ENGLISH" else {if (languages.size() > 0) languages[0].name.upper() else "SILENT" } }]/{plex.tail.tail}
I tried variations checking if languages exists etc but can't seem to get this covered. Testing it with
Code: Select all
The.Circus.1928.REMASTERED.1080p.BluRay.x265-RARBG
Thanks
Re: How to detect silent movies
Posted: 09 Jun 2022, 12:08
by rednoah
{audioLanguages} is never empty, because it would fail if it were to be empty:
viewtopic.php?t=1895
e.g.
Code: Select all
{ any{ audioLanguages.size() > 1 ? 'Multi Audio' : 'Single Audio' }{ 'No Audio' } }
Re: How to detect silent movies
Posted: 09 Jun 2022, 14:28
by kim
you can use
Code: Select all
{'silent film' in info.keywords ? 'SILENT' : ''}
https://www.themoviedb.org/keyword/154802/movie
Re: How to detect silent movies
Posted: 09 Jun 2022, 16:22
by Voleure
Thanks Noah...I tried that but it still doesn't fall through to end on silent movies
I used:
Code: Select all
any{ audioLanguages.size() > 1 ? 'MULTI' : languages[0].name.upper() }{ 'SILENT' }
Result:
Code: Select all
C:\Users\Home>cd /d S:\Media\Movies
Code: Select all
S:\Media\Movies>dir /b
Godzilla vs. Mothra (1992) - [ENGLISH]
Godzilla vs. Mothra (1992) - [JAPANESE]
The Business (2005) - [ENGLISH]
Calculator (2014) - [FRENCH]
The Circus (1928) - []
any way to dump out to see what's happening internally?
I have it working to differentiate between dubbed and undubbed japanese movie etc. Just need to handle these if possible.
Mark
Re: How to detect silent movies
Posted: 09 Jun 2022, 17:45
by rednoah
e.g. just run a few simple expressions on all your files so that you can see the values you're working with:
Code: Select all
filebot -mediainfo -r S:/Media/Movies --format "{ audioLanguages }"
Code: Select all
filebot -mediainfo -r S:/Media/Movies --format "{ audioLanguages.size() }"
Code: Select all
filebot -mediainfo -r S:/Media/Movies --format "{ any{ audioLanguages.size() > 1 ? 'Multi Audio' : 'Single Audio' }{ 'No Audio' } }"
Note that
audioLanguages (audio streams based on MediaInfo) and
languages (spoken languages information provided by your preferred database for the given movie match; may or may not have been entered for the movie at hand) are completely different in meaning and not interchangeable or related.
Re: How to detect silent movies
Posted: 09 Jun 2022, 23:42
by Voleure
Hey thanks yes i did all that and pulled some more silent films into the test area. None of the early films return anything from languages or audioLanguages and the any clause doesn't catch it. Tried all the above on both which is why i asked if there was way to throw out debug or trace logs. I added the Lodger (1927) and Stride (1926) as well to expand the early tests. I have a background in development. Or conversely I can pass my test movies across if your uncomfortable with allowing debug.
Code: Select all
Expression yields empty value: Binding "audioLanguages": undefined
Mark
Re: How to detect silent movies
Posted: 09 Jun 2022, 23:51
by Voleure
Ah so the any clause catches the fail in the command line but not in the gui presets... odd i would have thought that was just a shell above the command version. I've just been pasting it in as a preset for convenience. So if it helps the any clause is not trapping the fail in the gui. I will make sure to use only the command line from now on.
Re: How to detect silent movies
Posted: 10 Jun 2022, 06:05
by Voleure
Appreciate the help Noah! Hope the bug is an easy one to squash.
Mark
Re: How to detect silent movies
Posted: 10 Jun 2022, 10:35
by rednoah
Both GUI and CLI work the same. If you get different results, then you are doing different things. The CLI makes it easy to copy & paste test cases and output, but you're welcome to use the GUI and post lots of screenshots instead. You can show us what you see either way.
Please run the following format on a representative set of test files
(i.e. cover all cases) and show me what you see and point out where the code doesn't work as expected:
Code: Select all
{audioLanguages} | { any{ audioLanguages.size() > 1 ? 'Multi Audio' : 'Single Audio' }{ 'No Audio' } }
Code: Select all
$ filebot -mediainfo . --format "{ audioLanguages } | { any{ audioLanguages.size() > 1 ? 'Multi Audio' : 'Single Audio' }{ 'No Audio' } }"
[eng, jpn] | Multi Audio
| No Audio
[eng] | Single Audio
[eng] | Single Audio
[eng, fra, ita, spa, nld, cat] | Multi Audio
[eng, fra, ita, spa, nld, cat] | Multi Audio
[eng, fra, ita, spa, nld, cat] | Multi Audio
| No Audio
| No Audio
| No Audio
| No Audio
[eng] | Single Audio
| No Audio
[eng, fra, ita, spa, nld, cat] | Multi Audio
| No Audio
0 audio => No Audio
1 audio => Single Audio
2+ audio => Multi Audio
This code assumes that "silent movies" don't have audio streams, and that non-silent movies always have audio streams. If there was a "directors commentary" audio stream or something like that, that would break things.
Re: How to detect silent movies
Posted: 10 Jun 2022, 14:33
by Voleure
Sure I will run that for you guys. Just looking through things for a full representation. My guess this is an edge case involving the PLEX macro/expansion with groovy Any in the gui presets. Have a lot on today with the systems will report back later.
Cheers,
Mark
Re: How to detect silent movies
Posted: 11 Jun 2022, 16:52
by Voleure
Code: Select all
The.Business.2005.1080p.BluRay.x265-RARBG
The.Calculator.2014.RUSSIAN.1080p.BluRay.x265-VXT
Godzilla.And.Mothra.The.Battle.For.Earth.1992.JAPANESE.1080p.BluRay.x265-VXT
Godzilla.And.Mothra.The.Battle.For.Earth.1992.DUBBED.1080p.BluRay.x265-RARBG
The.Circus.1928.REMASTERED.1080p.BluRay.x265-RARBG
Stride.Soviet.1926.1080p.WEBRip.x265-RARBG
The.Lodger.1927.1080p.BluRay.x265-RARBG
Sharks Kings of the Ocean (2012) 1080p 3d SBS
filebot cmd line
Code: Select all
S:\Movies>filebot -mediainfo -r S:/Movies --format "{audioLanguages} | { any{ audioLanguages.size() > 1 ? 'Multi Audio' : 'Single Audio' }{ 'No Audio' } }"
Low Disk Space (1.6 GB) on (C:)
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
| No Audio
[jpn] | Single Audio
[jpn] | Single Audio
[jpn] | Single Audio
[jpn] | Single Audio
[jpn] | Single Audio
| No Audio
[eng, deu, fra, spa] | Multi Audio
| No Audio
| No Audio
| No Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
| No Audio
[eng] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
| No Audio
| No Audio
| No Audio
| No Audio
| No Audio
| No Audio
| No Audio
works!
Inside an else the any fall through clause does not
Code: Select all
C:\Users\Home>filebot -mediainfo -r S:/Movies --format "{audioLanguages} | {if (audioLanguages.size() > 7) {"Many"} else {any{ audioLanguages.size() >
1 ? 'Multi Audio' : 'Single Audio' }{ 'No Audio' } }}"
Low Disk Space (2.3 GB) on (C:)
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
|
[jpn] | Single Audio
[jpn] | Single Audio
[jpn] | Single Audio
[jpn] | Single Audio
[jpn] | Single Audio
|
[eng, deu, fra, spa] | Multi Audio
|
|
|
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
[eng] | Single Audio
|
[eng] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
[rus] | Single Audio
|
|
|
|
|
|
|
|
Hope that helps!
Thanks again,
Mark
Re: How to detect silent movies
Posted: 12 Jun 2022, 08:19
by rednoah
Voleure wrote: ↑11 Jun 2022, 16:52
Code: Select all
{if (audioLanguages.size() > 7) {"Many"} else {any{ audioLanguages.size() > 1 ? 'Multi Audio' : 'Single Audio' }{ 'No Audio' } }}
audioLanguages.size() > 7 immediately fails and breaks the expression if
audioLanguages is undefined, i.e. in cases where there is no audio. Neither then-block nor else-block is ever reached.
e.g. you can express the code you want like so:
Code: Select all
{ any{ audioLanguages.size() > 7 ? 'Many Audio' : audioLanguages.size() > 1 ? 'Multi Audio' : 'Single Audio' }{ 'No Audio' } }