Kodi Community Forum

Full Version: [Release] Language Preference Manager
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
I like the option to ignore 'Signs and Songs'. Why not expose that as a regex field so we can use it as a general ignore option? I think we need separate ones for audio and subtitles?
eg:
subtitles: "signs|songs|lyrics|commentary"
audio: "commentary"
Hi - this addon is working great and has solved an absolutely annoying situation w/ Kodi not remembering my subtitle settings. 

I followed your advice earlier in this thread and set up my conditional rules as follows, as I wanted to have forced english subs always on for english audio, and english subs turned on for any non-english audio:

Code:
- lang eng,  sub none, and tag forced yes
- lang any, sub eng, and tag forced no
- lang any, sub eng, and tag forced yes

The issue I've run into is that I backup a lot of video files from nhl.com using yt-dlp, and it seems that the language is not defined in the default audio stream of downloaded file. Since the language is undefined, kodi now activates english subs since the language is anything other than english. Is there a way to have the addon ignore audio tracks that are 'undefined'?
(2023-09-28, 17:49)badbob001 Wrote: [ -> ]I like the option to ignore 'Signs and Songs'. Why not expose that as a regex field so we can use it as a general ignore option? I think we need separate ones for audio and subtitles?
eg:
subtitles: "signs|songs|lyrics|commentary"
audio: "commentary"
Hello !

The "Signs and Songs" toggle was a first try, but a couple of version after that I introduce a more general "Keywords Blacklist' option, just below the "Signs and Songs" one.
If you activate it,  you should be able do what you suggest for subtitles, based on a list of comma separated keywords.
Let me know if that works for you.

Extended this type of exclusion list to audio tracks is something I did get not get request for so far, but let me think about it.
(2023-10-07, 04:30)feerlessleadr Wrote: [ -> ]....  Since the language is undefined, kodi now activates english subs since the language is anything other than english. Is there a way to have the addon ignore audio tracks that are 'undefined'?
Hello thanks you for the nice comments !

About your nhl files, first and probably cleanest solution is for you to properly redocument/name as English the language track within the files (using for example mkvtoolnix/mkvmerge tools). This is a constraint of course but really simple and quick to do.

Anyway for my understanding could you elaborate a bit on what you would like to achieve in that case of "undefined" language. Do you mean :
-  to ignore/skip completely undefined language audio track during the audio track preference selection process (but then what if there is only one undefined audio track in the file?)
-  to ignore all subtitles preference process and to revert to the default subtitle as defined in the file and activate it (if ever one is defined...)
-  something else ?
@LeVvE, @crawfish, and all users wanting to help in further validation  Smile

I have posted on my github page a new LPM version v1.0.2beta trying to solve 2 issues discussed recentlly here.

--- Version 1.0.2
    - Fix 10sec latency on subs display and possible few lines lost - at video start or when switching audio.
    - Forced sub tracks : check also subtitle field "isforced" in case field "name" is empty or misspelled.


First fix is in fact a workaround of a old known bug in Kodi. Solution based on @crawfish hints. Thanks for that !
About the 2nd change, it is always best to document the "name" field of the forced track  Wink (ex. 'English (forced)' ).

You can found this version here LPM v1.0.2Beta
If you have time please download the zip file and install it manually (addon install from zip file).
Anytime you can revert back to stable release by re-installing the current v1.0.1 from Kodi official repository.

So far my own tests have been positive including non regression, but I'd appreciate your additional feedback before pushing it the the official Kodi repository in a couple of weeks !
(2023-10-18, 13:56)rockrider69 Wrote: [ -> ]
(2023-10-07, 04:30)feerlessleadr Wrote: [ -> ]....  Since the language is undefined, kodi now activates english subs since the language is anything other than english. Is there a way to have the addon ignore audio tracks that are 'undefined'?
Hello thanks you for the nice comments !

About your nhl files, first and probably cleanest solution is for you to properly redocument/name as English the language track within the files (using for example mkvtoolnix/mkvmerge tools). This is a constraint of course but really simple and quick to do.

Anyway for my understanding could you elaborate a bit on what you would like to achieve in that case of "undefined" language. Do you mean :
-  to ignore/skip completely undefined language audio track during the audio track preference selection process (but then what if there is only one undefined audio track in the file?)
-  to ignore all subtitles preference process and to revert to the default subtitle as defined in the file and activate it (if ever one is defined...)
-  something else ?

thanks for the response. I've actually gone down the path of proactively adding the eng language tag to the audio track for all of the files, so for the most part, this is solved for me. I have noticed though that apprently I do have a number of TV/Movies that also have their default audio track as undefined, which is causing the same issue. I'm reactively going into those files and adding the language tag to the audio track, but I can't do that for all of my files at once, as it causes my main machine to freeze up for some reason. 

What I'm envisioning is that if the language is undefined, then treat it similary to my first rule, where if the audio is english, only turn on forced subs. I realize this is a really edge case though, so no worries if this is something you do not want to implement.
(2023-10-19, 11:45)rockrider69 Wrote: [ -> ]@LeVvE, @crawfish, and all users wanting to help in further validation  Smile

I have posted on my github page a new LPM version v1.0.2beta trying to solve 2 issues discussed recentlly here.

--- Version 1.0.2
    - Fix 10sec latency on subs display and possible few lines lost - at video start or when switching audio.
    - Forced sub tracks : check also subtitle field "isforced" in case field "name" is empty or misspelled.


First fix is in fact a workaround of a old known bug in Kodi. Solution based on @crawfish hints. Thanks for that !

I only try one, but the first fix seems to be working very at well, at least at video start. Well done!

By curiosity, how do you manage to fix it ? I can't find the commit on your github.
@Dklktn_Dklktn
thanks for confirming the first part !

Based on info shared by @crawfish, I just used a seekTime(0) right after the preferences analysis if it is the initial start of the video
  or a seekTime(getTime()-1) if it looks more like a resume (more than 10sec into the movie)
Not very elegant, but a useful workaround hopefully  Wink
(2023-10-19, 11:45)rockrider69 Wrote: [ -> ]@LeVvE, @crawfish, and all users wanting to help in further validation  Smile

I have posted on my github page a new LPM version v1.0.2beta trying to solve 2 issues discussed recentlly here.

--- Version 1.0.2
    - Fix 10sec latency on subs display and possible few lines lost - at video start or when switching audio.
    - Forced sub tracks : check also subtitle field "isforced" in case field "name" is empty or misspelled.


First fix is in fact a workaround of a old known bug in Kodi. Solution based on @crawfish hints. Thanks for that !
About the 2nd change, it is always best to document the "name" field of the forced track  Wink (ex. 'English (forced)' ).

You can found this version here LPM v1.0.2Beta
If you have time please download the zip file and install it manually (addon install from zip file).
Anytime you can revert back to stable release by re-installing the current v1.0.1 from Kodi official repository.

So far my own tests have been positive including non regression, but I'd appreciate your additional feedback before pushing it the the official Kodi repository in a couple of weeks !
I tested it quickly and my two issues seemed fixed. Subtitles that were early in a video are now showing without having to rewind and my unnamed forced subtitles are loaded.

Thank you Smile
With 1.0.2Beta version when changing audio stream it is observed a permanent movie freeze, sometimes movie is starting from the beginning.
Later I can deliver kodi log with exact timestamps when I changed audio stream and what the result is.
BTW. I'm using TV remote yellow button to change audio stream.

<keymap>
    <fullscreenvideo>
        <keyboard>
            <key id="253">audionextlanguage</key>
        </keyboard>
    </fullscreenvideo>
</keymap>




So far I can paste this part of the log:

2023-11-05 19:11:54.866 T:4023     info <general>: [Language Preference Manager]: Audio track changed from eng to pol. Reviewing Conditional Subtitles rules...
2023-11-05 19:11:54.868 T:4023     info <general>: [Language Preference Manager]: Cond Sub: genre/tag preference set() met with intersection set()
2023-11-05 19:11:54.868 T:4023     info <general>: [Language Preference Manager]: Selected audio language matches conditional preference 1 (Polish:None), force tag is true
2023-11-05 19:11:54.868 T:4023     info <general>: [Language Preference Manager]: Subtitle condition is None but forced is true, searching a forced subtitle matching selected audio...
2023-11-05 19:11:54.868 T:4023     info <general>: [Language Preference Manager]: Conditional subtitle: no match found for preference 1 (Polish:None) with forced overriding rule true
2023-11-05 19:11:54.868 T:4023     info <general>: [Language Preference Manager]: Conditional subtitle: disabling subs
2023-11-05 19:11:54.907 T:3976  warning <general>: ActiveAE - large audio sync error: 5911.413833
2023-11-05 19:11:54.907 T:3976  warning <general>: ActiveAE - large audio sync error: 5879.643000
2023-11-05 19:11:54.957 T:3976  warning <general>: ActiveAE - large audio sync error: 5897.439125
2023-11-05 19:11:55.007 T:3976  warning <general>: ActiveAE - large audio sync error: 5915.416375
2023-11-05 19:11:55.007 T:3976  warning <general>: ActiveAE - large audio sync error: 5883.672958
2023-11-05 19:11:55.057 T:3976  warning <general>: ActiveAE - large audio sync error: 5901.410333
2023-11-05 19:11:55.057 T:3976  warning <general>: ActiveAE - large audio sync error: 5869.666833
2023-11-05 19:11:55.138 T:7410     info <general>: CAEStreamParser::TrySyncAC3 - E-AC3 stream detected (6 channels, 48000Hz)
2023-11-05 19:11:57.269 T:7410    error <general>: CDVDAudio::AddPacketsRenderer - timeout adding data to renderer
2023-11-05 19:15:17.823 T:6632     info <general>: Closing stream player 1
2023-11-05 19:15:17.823 T:6632     info <general>: Waiting for audio thread to exit
2023-11-05 19:15:17.869 T:7410     info <general>: thread end: CVideoPlayerAudio::OnExit()
2023-11-05 19:15:17.869 T:6632     info <general>: Closing audio device
2023-11-05 19:15:17.919 T:6632     info <general>: Deleting audio codec
2023-11-05 19:15:17.920 T:6632     info <general>: Opening stream: 2 source: 256
2023-11-05 19:15:17.920 T:6632     info <general>: Finding audio codec for: 86018
2023-11-05 19:15:17.923 T:6632     info <general>: CDVDAudioCodecFFmpeg::Open() Successful opened audio decoder aac
2023-11-05 19:15:17.923 T:6632     info <general>: OpenStream: Allowing max Out-Of-Sync Value of 37 ms
2023-11-05 19:15:17.923 T:6632     info <general>: Creating audio thread
(2023-11-06, 18:37)rafikW Wrote: [ -> ]With 1.0.2Beta version when changing audio stream it is observed a permanent movie freeze, sometimes movie is starting from the beginning.
.....

Thanks for reporting !
Do you get these freeze or restart on one specific movie or all time ?
Do you get them also when switching via the Kodi OSD player menu ?

From this first simple log, nothing looks strange to me, even the audio sync error are expected when switching audio.
If you can turn debug on (both LPM and KODI) and paste a link to the full log here, that would be nice.

BTW I am also using a keymapped button on my Harmony remote to switch audio, and so far no freeze nor restart from beginning of movies. Of course the keyid is different. But let's investigate...
False positive alarm.
Once I restarted my device I was not able to reproduce this issue for few days.
So it looks OK.
A fix for removing delay until subs start appearing when criteria to show subs is met is really big achievement.
Thanks.
Thank you all for your help and feedback  Smile
I'll now submit LPM Version 1.0.2 to Kodi main repository.
(2023-10-18, 13:40)rockrider69 Wrote: [ -> ]
(2023-09-28, 17:49)badbob001 Wrote: [ -> ]I like the option to ignore 'Signs and Songs'. Why not expose that as a regex field so we can use it as a general ignore option? I think we need separate ones for audio and subtitles?
eg:
subtitles: "signs|songs|lyrics|commentary"
audio: "commentary"
Hello !

The "Signs and Songs" toggle was a first try, but a couple of version after that I introduce a more general "Keywords Blacklist' option, just below the "Signs and Songs" one.
If you activate it,  you should be able do what you suggest for subtitles, based on a list of comma separated keywords.
Let me know if that works for you.

Extended this type of exclusion list to audio tracks is something I did get not get request for so far, but let me think about it.

@badbob001 and all
I have worked on this idea and revisited the Keywords Blacklist feature to propose it for Audio in addition to Subtitles, in separate lists.

If you have time and interest in this, please try the 1.0.3BETA2 version available on my Github and give me feedback !
https://github.com/rockrider69/service.L...1.0.3BETA2

Note this Beta version includes also another new feature to reprioritize Signs&Songs tracks in specific cases.
Available in Custom Conditional Subtitles Preferences via the syntax:     ....>Eng:Eng-ss>....
I was wondering if you could correct the misspelled word "prefrence" in this addon.
In the settings of this addon there are 4 tabs
General
Audio Preferences
Subtitle Preferences and finally
Conditional Subtitle Preferences
The error is under the General' tab, and then "Advanced/Custom Settings"
"Turn on subtitles if a subtitle prefrence matched" and below
"Turn off subtitles if no subtitle prefrence matched"
Both instances should be spelled, "preference" not "pefrence"
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27