Issues with conditional folder naming based on {languages} and {audioLanguages}

Support for Ubuntu and other Desktop Linux distributions
Post Reply
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Issues with conditional folder naming based on {languages} and {audioLanguages}

Post by XeelosDK »

Hi again
Now ive sorted filebot to be called when downloads are finished in rtorrent, now im strugeling with the naming, if i use the gui it works but when i run it trough the .sh script it's getting mixmatched.

output from cli script:

Code: Select all

[TEST] from [/home/c0de/downloads/Supergirl.S05E07.Tremors.720p.Amazon.WEB-DL.DD+5.1.H.264-QOQ.mkv] to [/home/c0de/mnt/move/tv/Dansk/Supergirl/Season 5/Supergirl - S05E07 - Tremors.mkv]
output from gui:
Image

edit: picture link editted
User avatar
rednoah
The Source
Posts: 23928
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Renaming issues in cli

Post by rednoah »

1.
Matching and Formatting is completely separate. One does not affect the other. The format is applied on a match, so the match precedes any application of the format.


2.
The log line shows a correct match. The destination path is presumably correct given the matched file at hand. A format is a template, that will give different results for different file/episode matches. You get different results in GUI and CLI, because you're working with different file/episode matches.

If you're unhappy with the destination path your format came up with for a given file/episode match (e.g. Supergirl S05E07) then you'll want to test your custom format on the same file/episode object in the GUI, i.e. load the same file, match the same episode, then double-click and test your format on that specific file/episode match, and figure out what specific values are different from expectation.
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: Renaming issues in cli

Post by XeelosDK »

It was the same file, dont know why it keeps calling it firefly but heres a screenshot where i macthed it up againt the right show

Image

So as you can see, if i run it trough the gui it renames and moves the files propperly but not when i do it trought cli
User avatar
rednoah
The Source
Posts: 23928
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Renaming issues in cli

Post by rednoah »

Firefly is sample data. You click "Edit Format" via the right-click menu to open the Format Editor in generic mode with generic sample data.

If you double-left-click an item, you will open the Format Editor locked to to the specific selected match.

Now you can analyze the format, investigate all the values, check the values that lead to the final result.

Based on which information are you deciding between English and Danish? I'd start debugging there.
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: Renaming issues in cli

Post by XeelosDK »

Okay i will give it a try it's just odd that it works in the gui but not cli with the same arguments
User avatar
rednoah
The Source
Posts: 23928
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Renaming issues in cli

Post by rednoah »

XeelosDK wrote: 07 Jan 2020, 14:59 Okay i will give it a try it's just odd that it works in the gui but not cli with the same arguments
That is odd, but easily explained by looking at the data we're working with.

:arrow: Just add {languages} and {audioLanguages} to the end of your format, and then run tests on both of your machines, so we can see the data the format is working with in each case.
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: Renaming issues in cli

Post by XeelosDK »

The info given here is from the same machine
User avatar
rednoah
The Source
Posts: 23928
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Renaming issues in cli

Post by rednoah »

If you have a condition that is based on {languages} and {audioLanguages} but doesn't yield the expected value, then we add {languages} and {audioLanguages} to the format so that we can see what values our conditions are working with.


So to continue this thread, we need the following:
* the format you're using
* the destination path you're getting for a given Episode/File match
* the part of the format that is seemingly working incorrectly
* all the values for all the bindings that are used in this part of the format
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23928
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Renaming issues in cli

Post by rednoah »

A systematic approach:
* Check the values
* Check the condition
* Check the result
Image

Code: Select all

{languages} | {audioLanguages} => {languages =~ /jpn/ || audioLanguages =~ /jpn/ ? ' Japanese' : 'English'}
:idea: I'm using a sample file that has [eng, jpn] audio, and so audioLanguages =~ /jpn/ is true, and so Japanese is the result.

:idea: If you approach your problem systematically as shown above, all will become clear in no time. ;)
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: Renaming issues in cli

Post by XeelosDK »

Okay here ive added screenshot from filebot linux gui where the path is correct.
Image

the code in the gui to rename/copy content:

Code: Select all

/home/c0de/mnt/move/{vf =~ /1080p|720p/ ? 'tv' : 'tv'}/{Languages.toString().contains('da') || audioLanguages.toString().contains('da')? 'Dansk' : 'Engelsk'}/{n}/{'Season '+s}/{n} - {s00e00} - {t}
command using the cli:

Code: Select all

filebot -script fn:amc --lang da --output "/home/c0de/mnt/move/" --action test --conflict auto -non-strict --log-file "/home/c0de/scripts/logs/filebot-amc.log" --def unsorted=y music=y artwork=n plex=127.0.0.1:RT4ryoRKVh7Wxest4d6A ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" --def @/home/c0de/scripts/format.txt Supergirl.S05E07.Tremors.720p.Amazon.WEB-DL.DD+5.1.H.264-QOQ.mkv
output from the cli:

Code: Select all

[TEST] from [/home/c0de/downloads/Supergirl.S05E07.Tremors.720p.Amazon.WEB-DL.DD+5.1.H.264-QOQ.mkv] to [/home/c0de/mnt/move/tv/Dansk/Supergirl/Season 5/Supergirl - S05E07 - Tremors.mkv]
format.txt

Code: Select all

movieFormat="{vf =~ /1080p|720p/ ? 'movies' : 'movies'}/{info.spokenLanguages.toString().contains('da') || audioLanguages.toString().contains('da')? 'Dansk' : 'Engelsk'}/{n}/{n.space('.')}.{y}{'.'+source}.{vc}"
seriesFormat="{vf =~ /1080p|720p/ ? 'tv' : 'tv'}/{Languages.toString().contains('da') || audioLanguages.toString().contains('da')? 'Dansk' : 'Engelsk'}/{n}/{'Season '+s}/{n} - {s00e00} - {t}"
complete logfile here:
https://pastebin.com/DTivJtwg

as you can see its the same code added when i run it tru cli or gui, so i really dont know why it makes it right when i use the gui.
User avatar
rednoah
The Source
Posts: 23928
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Renaming issues in cli

Post by rednoah »

So this expression:

Code: Select all

{Languages.toString().contains('da') || audioLanguages.toString().contains('da')? 'Dansk' : 'Engelsk'}
Yield this result:

Code: Select all

Dansk
:idea: We know that either {languages} or {audioLanguages} contains 'da'

:idea: Why? We won't know until we know the values of {languages} and {audioLanguages} ;)
rednoah wrote: 07 Jan 2020, 15:34 Just add {languages} and {audioLanguages} to the end of your format, and then run tests on both of your machines, so we can see the data the format is working with in each case.

:arrow: You've got all the tools and knowledge you need. The rest is up to you. You'll figure it out. ;)
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: Issues with conditional folder naming based on {languages} and {audioLanguages}

Post by XeelosDK »

I only got one mashine as ive said before.

format:

Code: Select all

movieFormat="{vf =~ /1080p|720p/ ? 'movies' : 'movies'}/{info.spokenLanguages.toString().contains('da') || audioLanguages.toString().contains('da')? 'Dansk' : 'Engelsk'}/{n}/{n.space('.')}.{y}{'.'+source}.{vc}"
seriesFormat="{vf =~ /1080p|720p/ ? 'tv' : 'tv'}/{Languages.toString().contains('da') || audioLanguages.toString().contains('da')? 'Dansk' : 'Engelsk'}/{n}/{'Season '+s}/{n} - {s00e00} - {t} - {language} - {audioLanguage}"
output from cli:

Code: Select all

[TEST] from [/home/c0de/downloads/Supergirl.S05E07.Tremors.720p.Amazon.WEB-DL.DD+5.1.H.264-QOQ.mkv] to [/home/c0de/mnt/move/tv/Dansk/Supergirl/Season 5/Supergirl - S05E07 - Tremors - - .mkv]
so the language and audioLanguage is only given - to the filename!

info on the mkv container is here - https://pastebin.com/feJ4sWhr
User avatar
rednoah
The Source
Posts: 23928
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Issues with conditional folder naming based on {languages} and {audioLanguages}

Post by rednoah »

So I slept on it, and I guess now I know your misconception.


Movie Format:

:idea: You're using {info.spokenLanguages} for movies. This works. TheMovieDB has information about spoken languages for each movie. {languages} works too, as it is also based on {info.spokenLanguages} in the context of TheMovieDB movie objects. Either one will work as expected.


Episode Format:

:idea: You're using {languages} for TV episodes. This does not work. TheTVDB does not have information about spoken languages for each series or episode. {languages} defaults to the language of the TheTVDB response data, i.e. if you do --lang Danish then series name / episode titles will be Danish, and {languages} will also be Danish, thus completely unrelated to "languages spoken in the given TV series or episode" contrary to your expectation. You get different results in GUI and CLI, because you use different language preferences in each, and thus {languages} yields different values.
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: Issues with conditional folder naming based on {languages} and {audioLanguages}

Post by XeelosDK »

Ahh okay that makes sense, but i got a setup for qbittorrent from a friend where (he) said it took the sound from the mkv container via mediainfo and then passed it tru filebot, to tell it if it where danish or english.

Is there a way to get filebot recognize on spoken language in the mkv container ?

EDIT:
But t´why cant i get the right match when using the GUI and not when i use the cli?
User avatar
rednoah
The Source
Posts: 23928
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Issues with conditional folder naming based on {languages} and {audioLanguages}

Post by rednoah »

1.
XeelosDK wrote: 09 Jan 2020, 07:34 Is there a way to get filebot recognize on spoken language in the mkv container ?
{audioLanguages} will give you the language property for each audio stream in the media file:
viewtopic.php?t=4285

{audioLanguages} is based on locally available information, so you can easily test it yourself on all your files:

Code: Select all

filebot -mediainfo -r /path/to/files --format "{f} => {audioLanguages}"


2.
XeelosDK wrote: 09 Jan 2020, 07:34 But t´why cant i get the right match when using the GUI and not when i use the cli?
That would be a topic for another thread. Please include file paths & logs as text. You may post large swaths of logs via pastebin, but if it's more than ~20 lines, then it'd be nice if you could also point out the specific line that shows the malfunction in your post. ;)
:idea: Please read the FAQ and How to Request Help.
XeelosDK
Posts: 15
Joined: 28 Dec 2019, 18:34

Re: Issues with conditional folder naming based on {languages} and {audioLanguages}

Post by XeelosDK »

solved seems like the script was running with --lang da and that made it change the tv shows to danish
Post Reply