{languages} VS {info.spokenLanguages}

Any questions? Need some help?
Post Reply
KRONZO
Posts: 30
Joined: 31 Dec 2017, 23:20

{languages} VS {info.spokenLanguages}

Post by KRONZO » 08 Mar 2020, 01:34

Hi I've been using the same format for a long time it used to work and i've had no reason to change it, but now once in a while it fails and do not produce a title for some movies.

Code: Select all

W:/{genres.contains('Animation') ? 'Cartoons' : languages =~ /(no|da|sv|nb)/ ? 'Nordic Movies' :  'New Movies'}/{languages =~ /(no|da|sv|nb)/ ? primaryTitle.upperInitial().replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!") : n.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!")} ({y}){' '+tags}/{languages =~ /(no|da|sv|nb)/ ? primaryTitle.upperInitial().replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!") : n.replaceAll(/[:|]/, " - ").replaceAll(/[?]/, "!")} ({y}){' '+tags}{' ['+"${self.source ?: 'Web-DL'}"+']'}{' ['+vf.replace(/2160p/, "4K")+']'}{fn =~ /AMZN|AMAZON|amzn/ ? ' [AMAZON]' : fn =~ /NF|nf|NETFLIX/ ? ' [NETFLIX]' : fn =~ /dsnp|DSNP|Disney+|DISNEY+/ ? ' [DISNEY+]' : null}{boolean isHDR = false;def mHDRCol = ["BT.709" : "NO", "BT.2020" : "YES"];if(self.video[0].bitdepth != null && self.bitdepth >= 10 && self.video[0].colourprimaries != null &&  mHDRCol.get(self.video[0].colourprimaries) == "YES") ' [HDR]' else null;}{video[0].CodecID =~ /HEVC/ ? ' [HEVC] '+' ' : null}{if (bitdepth == 10) ' [10bit]'+' '}{' '+"[$ac "+af.replace('8ch', '7.1ch').replace('7ch', '6.1ch').replace('6ch', '5.1ch').replace('3ch', '2.1ch').replace('2ch','2.0ch')+']'}{' ['+fn.matchAll(/repack|proper/).join('] [').toUpperCase()+']'}{'-'+group}{'.'+lang.ISO2}{fn.match(/-thumb|[.]nfo/)}
latest movie that failed is PandaMonium (2020).

tank you

kim
Power User
Posts: 898
Joined: 15 May 2014, 16:17

Re: format started to fail

Post by kim » 08 Mar 2020, 02:26

No "Spoken Languages"... add it ;)
https://www.themoviedb.org/movie/645519 ... mary_facts

yes:

Code: Select all

info.spokenLanguages =~ /(no|da|sv|nb)/
no:

Code: Select all

languages =~ /(no|da|sv|nb)/

KRONZO
Posts: 30
Joined: 31 Dec 2017, 23:20

Re: format started to fail

Post by KRONZO » 08 Mar 2020, 03:50

Thank you

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

Re: format started to fail

Post by rednoah » 08 Mar 2020, 06:18

When talking about movie formats, then {languages} is based on {info.spokenLanguages} so both bindings will be based on the same raw data.


Notably, {languages} will fail if empty, and not return an empty list, and so that part of the format bails out if {languages} is undefined:

Code: Select all

Binding "languages": undefined
You can use any{}{}... to catch errors from failed bindings:

Code: Select all

{any{languages}{'No Language'}}
:arrow: viewtopic.php?t=1895


:idea: {info.spokenLanguages} being a property of non-null top-level binding {info} works too because in this case you will get [] as return value, rather than an error that breaks the {...} expression.


:idea: You can always revert to something simple that is known to work, e.g. {plex}, and then rebuild your format step by step so you can narrow down exactly which bit & piece doesn't work as expected.
:idea: Please read the FAQ and How to Request Help.

Post Reply