• 1
  • 15
  • 16
  • 17(current)
  • 18
  • 19
  • 29
[Release] Language Preference Manager
Hello again,

my ususal case is a bit more simple than yours, but gives me what I expect :
2022-02-09 21:57:31.714 T:2844     INFO <general>: [Language Preference Manager]: Audio: genre/tag preference set() met with intersection set()
2022-02-09 21:57:31.715 T:2844     INFO <general>: [Language Preference Manager]: Selected audio language matches preference 1 (French)
2022-02-09 21:57:31.749 T:2844     INFO <general>: [Language Preference Manager]: Cond Sub: genre/tag preference set() met with intersection set()
2022-02-09 21:57:31.749 T:2844     INFO <general>: [Language Preference Manager]: Selected audio language matches conditional preference 1 (French:French), force tag is true
2022-02-09 21:57:31.749 T:2844     INFO <general>: [Language Preference Manager]: Language of subtitle 0 matches conditional preference 1 (French:French) forced true

Could you try to put as conditions in your settings :
If audio language is Polish then display subtitle with language: Polish, forced YES
If audio language is English then display subtitle with language: Polish, forced NO

And see it this gives you want you want ?
Reply
(2022-02-09, 21:49)rockrider69 Wrote:
(2022-02-09, 20:31)rafikW Wrote: Text #2 is not displayed and this is wrong - subtitles stream with the flag "Forced=Yes" should be displayed.

Thanks a lot for testing !

Looks like  I have to check again the forced subtitles case then...
Can you copy here the few lines from kodi.log at the time you launch the movie : the ones starting with "INFO <general>: [Language Preference Manager] ........."

Will also dig out my own test file to compare our cases...
Here you are the lines from kodi.log:

2022-02-09 22:30:07.291 T:4021     INFO <general>: [Language Preference Manager]: Subtitle: genre/tag preference set() met with intersection set()
2022-02-09 22:30:07.291 T:4021     INFO <general>: [Language Preference Manager]: Selected subtitle language matches preference 1 (Polish)
2022-02-09 22:30:07.291 T:4021     INFO <general>: [Language Preference Manager]: Subtitle: Preferred subtitle is selected but might not be enabled
2022-02-09 22:30:07.332 T:4307     INFO <general>: Python interpreter stopped
2022-02-09 22:30:07.332 T:4021     INFO <general>: [Language Preference Manager]: Cond Sub: genre/tag preference set() met with intersection set()
2022-02-09 22:30:07.333 T:4021     INFO <general>: [Language Preference Manager]: Selected audio language matches conditional preference 1 (Polish:None), force tag is true
2022-02-09 22:30:07.333 T:4021     INFO <general>: [Language Preference Manager]: Conditional subtitle: disabling subs
Reply
(2022-02-09, 23:28)rockrider69 Wrote: Hello again,

my ususal case is a bit more simple than yours, but gives me what I expect :
2022-02-09 21:57:31.714 T:2844     INFO <general>: [Language Preference Manager]: Audio: genre/tag preference set() met with intersection set()
2022-02-09 21:57:31.715 T:2844     INFO <general>: [Language Preference Manager]: Selected audio language matches preference 1 (French)
2022-02-09 21:57:31.749 T:2844     INFO <general>: [Language Preference Manager]: Cond Sub: genre/tag preference set() met with intersection set()
2022-02-09 21:57:31.749 T:2844     INFO <general>: [Language Preference Manager]: Selected audio language matches conditional preference 1 (French:French), force tag is true
2022-02-09 21:57:31.749 T:2844     INFO <general>: [Language Preference Manager]: Language of subtitle 0 matches conditional preference 1 (French:French) forced true

Could you try to put as conditions in your settings :
If audio language is Polish then display subtitle with language: Polish, forced YES
If audio language is English then display subtitle with language: Polish, forced NO

And see it this gives you want you want ?
Yes, with those settings it works as expected but... only after around 15 seconds from start, I mean: if there are lines in first 15 seconds they are not displayed...
My stream with "Forced=Yes" flag looks like this:

1
00:00:05,400 --> 00:00:07,300
[FORCED 1/5]
W POPRZEDNICH ODCINKACH

2
00:00:07,383 --> 00:00:08,676
[FORCED 2/5]
Ma młode.

3
00:00:08,759 --> 00:00:10,469
[FORCED 3/5]
Proszę, pomóżcie jej!

4
00:00:16,976 --> 00:00:18,644
[FORCED 4/5]
Co ze statkami?

5
00:00:18,728 --> 00:00:22,898
[FORCED 5/5]
Z danych wynika,
że sporo ich zaginęło.




And when I started this movie only lines 4 and 5 were displayed but not the first 3.
Seems like kind of delay until addon is start "reading" what to display :-)
Reply
(2022-02-09, 23:41)rafikW Wrote: Yes, with those settings it works as expected but... only after around 15 seconds from start, I mean: if there are lines in first 15 seconds they are not displayed...

About the initial delay, I have seen that myself but it did not bother me so much... 
I believe there is an option in Settings/General : "Pause while evaluating preferences". I have never tried it, maybe you can play with this one ?

Anyway good to read that the main subtitle selection process works as you expect now !
Reply
(2022-02-11, 00:31)rockrider69 Wrote:
(2022-02-09, 23:41)rafikW Wrote: Yes, with those settings it works as expected but... only after around 15 seconds from start, I mean: if there are lines in first 15 seconds they are not displayed...

About the initial delay, I have seen that myself but it did not bother me so much... 
I believe there is an option in Settings/General : "Pause while evaluating preferences". I have never tried it, maybe you can play with this one ?

Anyway good to read that the main subtitle selection process works as you expect now !

No differences with different values in "Pause while evaluating preferences" - forced subtitles in around first 15 seconds are not displayed.
With Language Preference Manager addon disabled, when movie is starting each of those lines in forced subtitles stream are displayed. So apparently this issue is caused by LPR addon itself.
You are right - its rather a small chance such lines would appear in subtitles but anyway interesting result.
It's up to you if you dig into that issue and try to fix. So far many thanks for making it working in the scope of my request.
Reply
Unfortunately I was too optimistic.
With these movie's streams:

---------
Audio #1
Language                                 : Polish
Default                                  : Yes
Forced                                   : Yes
---------
Audio #2
Language                                 : English
Default                                  : No
Forced                                   : No
---------
Text
Language                                 : Polish
Default                                  : No
Forced                                   : No

subtitles are displayed.

The difference when comparing with previous example is that here is only one Text stream with both flags set to "No" and the result is that still these subtitles are displayed but should not be.
I think some redesign of the logic how it should work is needed.
Reply
Another observation.
I have a yellow button on my TV remote configured to cycle Audio streams, so when I have two Audio streams I can quickly switch between them using one button on TV remote.
And now:
when I'm watching a movie with these streams:
Audio #1 Polish
Audio #2 English
Text #1 Polish Forced=No
and with Audio #1 there are no subtitles displayed (as expected) then when I'm switching to Audio #2 I would like to see that LPM addon will cause that Text #1 is starting to be displayed automatically but it isn't.

Of course I have a green button on my TV remote configured to cycle Text streams and I can "switch on or off" needed Text stream but wouldn't be nice if that "switch on/off" is happening automatically by LPM?
Or am I completely wrong and this functionality is not possible to achieve and LPM addon is supposed to only pickup correct Text and Audio streams according to the settings at the start of the movie and is not a kind of "watchdog" service that is able to switch them accordingly if a user is manually changing Audio stream?
Reply
Hello!

you're right, my understanding is also that the addon is called only at the initial start of the movie to make your prefered selections automatic and also somewhat independant of (overide) what the "default" flags of each tracks are.
Having the addon alive while playing and monitoring later changes of audio or text, I am unsure it is would be even feasible, and anyway way beyond my skills  Wink. So I guess we're on our own, to manually readjust streams, when it comes to any late audio or text changes while watching. 

About your previous case, I believe a condition like "Polish : Polish + tag forced yes" is activating the Polish track even is the forced tag is not set on. And if you use "Polish:None" then a possible Polish forced track will be ignored if it exist... Bit of catch 22.
Will have a look at it, but it could be too challenging for me to get into the basic logic of the addon.
Reply
(2022-02-12, 16:34)rockrider69 Wrote: About your previous case, I believe a condition like "Polish : Polish + tag forced yes" is activating the Polish track even is the forced tag is not set on. And if you use "Polish:None" then a possible Polish forced track will be ignored if it exist... Bit of catch 22.
Will have a look at it, but it could be too challenging for me to get into the basic logic of the addon.

I realized I have the same issue with the forced subtitles...

I have now added some logic to handle conditional rules like Lang1:None in this way :
    - if Forced tag is unset than we disable subtitles as usual
    - if Forced tag is set, then we search for a forced subtitles track matching the Lang1 audio, and activate it if found. Else we disable subtitles.
         (reminder: Forced subtitle tracks must be properly named/titled "forced")

See the new in-progress version v0.1.3   HERE 

For my own usage it is ok, but @rafikW let me know if this works for you as well !
Reply
(2022-02-15, 15:11)rockrider69 Wrote:
(2022-02-12, 16:34)rockrider69 Wrote: About your previous case, I believe a condition like "Polish : Polish + tag forced yes" is activating the Polish track even is the forced tag is not set on. And if you use "Polish:None" then a possible Polish forced track will be ignored if it exist... Bit of catch 22.
Will have a look at it, but it could be too challenging for me to get into the basic logic of the addon.

I realized I have the same issue with the forced subtitles...

I have now added some logic to handle conditional rules like Lang1:None in this way :
    - if Forced tag is unset than we disable subtitles as usual
    - if Forced tag is set, then we search for a forced subtitles track matching the Lang1 audio, and activate it if found. Else we disable subtitles.
         (reminder: Forced subtitle tracks must be properly named/titled "forced")

See the new in-progress version v0.1.3   HERE 

For my own usage it is ok, but @rafikW let me know if this works for you as well !
When installing 1.3 version:

2022-02-15 20:15:10.789 T:4677     INFO <general>: CAddonMgr::FindAddon: service.languagepreferencemanager v0.1.3 installed
2022-02-15 20:15:10.811 T:4698     INFO <general>: initializing python engine.
2022-02-15 20:15:11.059 T:4698    ERROR <general>: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
                                                    - NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
                                                   Error Type: <class 'IndentationError'>
                                                   Error Contents: expected an indented block (default.py, line 270)
                                                     File "/storage/.kodi/addons/service.languagepreferencemanager/default.py", line 270
                                                       log(LOG_INFO, 'Subtitle condition is None but forced is true, searching a forced subtitle matching selected audio...')
                                                       ^
                                                   IndentationError: expected an indented block
                                                   -->End of Python script error report<--
                                                   
2022-02-15 20:15:11.607 T:4698     INFO <general>: Python interpreter stopped

Despite of this error addon seems to be installed but "it doesn't work" - when starting a movie nothing in the log is recorded and of course subtitles preferences are ignored.
Reply
Sorry, some bad typo when inserting changes on github. I am still learning...
It should be fixed now.
Please download again  HERE
Reply
(2022-02-16, 00:30)rockrider69 Wrote: Sorry, some bad typo when inserting changes on github. I am still learning...
It should be fixed now.
Please download again  HERE
Downloaded, installed, configured.
Seems to be working as expected. At least for these two scenarios I have described.
Thanks a lot.
Reply
(2022-02-16, 19:18)rafikW Wrote: Downloaded, installed, configured.
Seems to be working as expected. At least for these two scenarios I have described.
Thanks a lot.

Many thanks for testing and feedback !
Reply
@rockrider69 Thank you for taking the time to update this addon!
Reply
(2022-02-12, 12:40)rafikW Wrote: Another observation.
I have a yellow button on my TV remote configured to cycle Audio streams, so when I have two Audio streams I can quickly switch between them using one button on TV remote.
And now:
when I'm watching a movie with these streams:
Audio #1 Polish
Audio #2 English
Text #1 Polish Forced=No
and with Audio #1 there are no subtitles displayed (as expected) then when I'm switching to Audio #2 I would like to see that LPM addon will cause that Text #1 is starting to be displayed automatically but it isn't.

Of course I have a green button on my TV remote configured to cycle Text streams and I can "switch on or off" needed Text stream but wouldn't be nice if that "switch on/off" is happening automatically by LPM?
Or am I completely wrong and this functionality is not possible to achieve and LPM addon is supposed to only pickup correct Text and Audio streams according to the settings at the start of the movie and is not a kind of "watchdog" service that is able to switch them accordingly if a user is manually changing Audio stream?

I have started to look into that idea : i.e "re evaluating conditional subtitles rules whenever the audio track is changed during watching".
In fact the LPM addon does remain active, so yes it is possible to have such a watchdog approach, and I have now made some good progress.

The trigger is a change of audio track initiated from KODI video player/OSD menu via my Kodi Box remote; and it then re runs part of the appropriate part of the CondSub preferences evaluation process.

Could you just explain what your TV Remote "yellow button" does exactly : is it just calling the same standard KODI menu as in my case to circle / toggle the audio tracks ?
Reply
  • 1
  • 15
  • 16
  • 17(current)
  • 18
  • 19
  • 29

Logout Mark Read Team Forum Stats Members Help
[Release] Language Preference Manager2