Solved Conditional Renaming of ${originalTitle} vs. ${title}
#1
First off, thank you for the great tool.  It allows me to keep my movie database sane, and also satisfies my OCD character.

I'm trying to figure out how to do conditional renaming of the following two kinds:

1. If the original language is in a language I speak (en, fr, hi, ta), keep the original title, otherwise use the English title.
2. If there is more than one director, print the first two directors names, else print only the first director.

Currently, I have something like this:
   ${originalTitle} ${- ,edition,} [${directors[0].name},${ ,directors[1].name,,} ${year}]

... but I need to manually shift between ${originalTitle} and ${title}, and then do the renaming.

I realize there's JMTE and it's conditionals, but all my attempts at getting a "true" out of "${if ${language}='fr'}" failed.  I've tried:
   ${if ${language}='fr'}${originalTitle}${else}${title}${end}

... but I always get a "false".  (And I've checked that the ${language} tag is "fr" and not "French" or "fra".)
#2
I  only have basic knowledge, but let's try....

Bad usage: ${if ${language}='fr'}, you have to use ${if language='fr'} 
${language}  seems to be broken, use ${movie.spokenLanguages} -> ${if movie.spokenLanguages='fr'}
movie.spokenLanguages is a so-called stringified list e.g. "de, en, fr". This condition works if there is only one language
movie.spokenLanguages[n] does not help either, as we only get nth character 

The only way i see is to use first audio language. Something like:

${if movie.mediaInfoAudioLanguage='fra'}${originalTitle}${else}${title}${end}
* You have to use ISO 639 codes. e.g. eng, fra

To clearify:
movie.spokenLanguages is scraped from tmdb
movie.mediaInfoAudioLanguage is audio language tag from your file
#3
I dug into JMTE yesterday (to provide a pull request for this lib to provide comparisons against other fields and not only string) and I saw that there could be done many things with renderers.
let me try a bit in the next days and I will report back what is possible
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab
#4
Thanks, @mdevil.  This is very helpful.  For some reason, many of my files (almost half, I'd guess based on a small random sample) don't seem to contain ${movie.mediaInfoAudioLanguage}, but all (or almost all) of them contain ${movie.spokenLanguages}.  I guess I could manually fix this, but it would be painful task, given my library has > 850 movies.  If there are any automated ways of copying information from ${movie.spokenLanguages} to ${movie.mediaInfoAudioLanguage}, that would be helpful.  Perhaps ${movie.spokenLanguages} should be an array (split TMDB responses at ",") rather than a string?

@mlaggner, it'd be great to see where your investigations lead you!  Thanks for looking into this.  It'd be great to have syntax that enables ${IF x=a OR x=b OR x=c} or something of that kind.  Also, some kind of simple query for number of elements in an array would be helpful.
#5
I've created a pull request for jmte to enable a comparison of two data object rather than only one data object and a string.
but this pull request has not been merged yet - and only if that has been merged and a new version on JMTE has been published we are able to use it in tmm

logical operators like AND/OR will not be able to be implemented in jmte...
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab
#6
@~sol If you are missing some information it is likely that you have interrupted TMM's scraping.
Missing ${movie.mediaInfoAudioLanguage}: To auto-fix that just select all your files and press ctrl+shift+M, or Edit|Update media information of selected movies. mediainfo will now catch the audio language tag, if any present.
Missing ${movie.spokenLanguages}: Online scraping not completed/no online data available. Scrape the file again, or select all files and let TMM scrape them ctrl+shift+F. "Search & scrape - force best match"
Using the "missing metadata" filter might be helpful to limit the amount of files.

That should help but takes some time.
#7
Just for my knowledge... Would if be possible to tell TMM something like:

-  If movie has subtitle, add at the end of the titlle "Subs"
-  If movie doesn't have subtitle, don't add anything

Huh

Thanks in advanced.  I thought it wasn't possible to do anything in the rename field in order to have different options to rename, but reading this post it seemed to me that It might be possible.
#8
(2020-02-07, 16:43)jhoyos Wrote: Just for my knowledge... Would if be possible to tell TMM something like:

-  If movie has subtitle, add at the end of the titlle "Subs"
-  If movie doesn't have subtitle, don't add anything

Huh

Thanks in advanced.  I thought it wasn't possible to do anything in the rename field in order to have different options to rename, but reading this post it seemed to me that It might be possible.

Well, yes to conditions and no to subtitles
Condition examples:
Code:
${title}${_,movie.mediaInfoAudioLanguage,}
Result: IF movie.mediaInfoAudioLanguage has a value, use the value after an "_": Batman Begins_eng.mp4, IF not: Batman Begins.mp4

Code:
${title}${if movie.mediaInfoAudioLanguage}_Subs${end}
Result: IF movie.mediaInfoAudioLanguage has a value, append _Sub: Batman Begins_Subs.mp4, IF not: Batman Begins.mp4

But there is no condition shortcut for subtitles like movie.subtitle or anything else that can be used instead of movie.mediaInfoAudioLanguage in the example above.
#9
there would be an option to check for subtitles: 

Code:
${movie.hasSubtitles}

starting from the next pre-release we can offer the enhancement for IF conditions in JMTE to compare against other properties
tinyMediaManager - THE media manager of your choice - available for Windows, macOS and Linux
Help us translate tinyMediaManager at Weblate | Translations at 66%
Found a bug or want to submit a feature request? Contact us at GitLab

Logout Mark Read Team Forum Stats Members Help
Conditional Renaming of ${originalTitle} vs. ${title}0