Kodi Community Forum
[Release] Language Preference Manager - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Service Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=152)
+---- Thread: [Release] Language Preference Manager (/showthread.php?tid=153783)

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


[Release] Language Preference Manager - Ace - 2013-01-29

This service Add-on automatically sets the audio and/or subtitle according to your language preferences.

Features
  • changes the audio track to the first matching language preference
  • changes the subtitle track to the first matching language preference
  • changes the subtitle track to the first matching language preference depending on the selected audio language
  • changes the audio and/or subtitle track according to the file name

Screenshots

Image

Image

Settings

The addon is listed under programs.
  • Delay: switching an audio track to early after playback has started leads to a restart of the video. If you encounter this, try raising that value.
  • Preference categories: each category can be turn on/off individually. The evaluation order is: audio -> subtitle -> conditional subtitle.
  • Try to set the audio and/or subtitle track from the file name first: the number of the first track is 0!
    This feature works as follows:
    • only audio, only subtitle or both are possible.
    • If the audio track is set successfully the audio preference evaluation is skipped.
    • If the subtitle track is set successfully the subtitle and conditional subtitle preference evaluation is skipped.
    • If nothing is specified in the file name or the track(s) can't be set, the other preferences are evaluated.

    Code:
    The regex is "audiostream[_|.|-]*\d+|subtitle[_|.|-]*\d+"

    For example:

    matrix.audiostream_1.subtitle_2.avi
    or matrix.audiostream.1.subtitle_2.avi
    or matrix.audiostream_1.subtitle-2.avi

    will result in audio track 1 (cf. remark above) and subtitle track 2 (cf. remark above).


  • Custom audio/subtitle preference: you can specify more than 3 languages.
    The syntax is
    Code:
    lang1>lang2>lang3>... for audio and subtitles and lang1:lang2>lang3:lang4>... for conditional subs.

    Example:
    jpn>eng>ger>fin for the audio language or jpn:eng>eng:ger>fin:jpn for the conditional subtitle
  • Custom per genre/tag audio/subtitle preference.If no genre/tag# part is provided the pref gets evaluated for any genre/tag. The syntax is
    Code:
    tag/genre1,tag/genre2...#(custom pref; see above)|tag/genre3,tag/genre4...#(custom pref; see above)

    Example:
    kids,comic#jpn>eng>ger>fin|eng>ger for the audio or sub language or kids,comic#jpn:eng|horro#eng:ger>fin:jpn|eng:non for the conditional subtitle

Current version for Jarvis/Krypton: 0.0.7
Current version for Gotham/Helix/Isengard: 0.0.5
Current version for Frodo: 0.0.4

Sources: github repo

Changelog
Code:
--- Version 0.0.5

- Added support for multiple 3 digit codes per language (thanks to waven!)

--- Version 0.0.4

- Added a language called "None". If set as a conditional subtitle language
subtitles get disabled if the audio language matches.

- Added support for per genre/tag custom preferences. Syntax is
tag/genre1,tag/genre2...#(custom pref; see below)|tag/genre3,tag/genre4...#(custom pref; see below)
If no genre/tag# part is provided the pref gets evaluated for any genre/tag

--- Version 0.0.3

- Custom preferences. Syntax is lang1>lang2>lang3>... for audio and sub
                            and lang1:lang2>lang3:lang4>... for cond. subs
- Wanilton's Portuguese (Brazil) translation, thanks!
- schumi2004's Dutch translation, thanks!



Problems and bugs

The addon is in an early stage of development. In order to improve it, I need your Debug log file if you encounter a bug.

Some ideas for future versions
  • production language with preferred subtitle
  • Advanced preferences using text fields
    • more than 3 languages (done)
    • own preferences per video genre (done)
  • Advanced preferences using a gui
  • Support preferences w.r.t. channels
  • Support preferences w.r.t. codecs



RE: [Release] Language Preference Manager - Ned Scott - 2013-01-29

If audio is Japanese then use English subtitles... dude, this is great :D

At first I wasn't sure what the point was, but the conditional subtitle feature alone is worth downloading this for. Thanks for the great add-on!


RE: [Release] Language Preference Manager - rd1979 - 2013-01-30

Thanks, this really should be a part of XBMC, thats how fundamental this functionality is.


RE: [Release] Language Preference Manager - sialivi - 2013-01-30

Great work, and as rd1979 said; It really ought to be part of XBMC.

What happens if there are multiple audio tracks with the same language but different formats?


RE: [Release] Language Preference Manager - Ace - 2013-01-30

The first matching track gets chosen at the moment. I already have something in my mind, maybe in the next version Wink


RE: [Release] Language Preference Manager - sialivi - 2013-01-30

-deleted-


RE: [Release] Language Preference Manager - Wimpie - 2013-02-05

Hi,

Really love this...

A suggestion/feature request:

I would like to be able to select on a per movie basis another audiotrack/subtitlelanguage

This could be done in the following way.

I would name my videofiles as follows;
Annie (1982).BluRay.Audiostream_12.Subtitle_23.iso

The Language Preference Manager (LPM) would parse the filename and look for "Audiostream_x" and "Subtitle_x" strings. It would select these then.


Why in this way? Several reasons:
- Sometimes I get blu-ray images where some audiotrack has no language. I can select this adiotrack in this way (track number "x")

Image

- I like to see a movie in it's original audio language. Subtitles are for me always dutch (unless audio is also dutch). I live in Belgium and the blurays have here sometimes 15 audiotracks (only 1 or 2 commentary tracks and thus 13 different language tracks). This gives following problems ( "Audio preferences" are prim: eng; sec; jap: third: chinese):

------ a native english movie would be correct with dutch subtitles
-------a native japanese movie would still have an english audiotrack, I would like this movie with the japanese audiotrack
------ a native chinese movie would still have an englisch audiotrack, I would like this movie with the chinese audiotrack
Putting japanese and chinese before english is also no good solution. First movies are also made in other languages (french/german/italian/....), second, most movies have a japanese/german/french/... audiotrack (dubbed) while the original language could be any language.

- My wife is from russia and we raise our children bi-lingual. Some movies for the kids/wife need to be with the russian audiotrack, even if there are english/dutch/other languages.

- I have some original russian movies (eg "9 ротa" ) that are no kids movies, I would like here dutch subtitles.

- Sometimes there are 2 correct dutch audiotracks with a movie. This is usually only with kids movies. One is the dubbed "dutch dutch" track, the other is the dubbed "flemisch dutch" track (is a little bit like US english and UK english (trunk or boot)). Flemish is not always a menu-choice, sometimes those audiotracks are both called "dutch".



If this would be implemented, then it would need to override the "audio preferences" and "subtitle preferences".
If no "Audiostream_x" and "Subtitle_x" are found in the filename, then the "audio preferences" and "subtitle preferences" select the correct language.
If only a "Audiostream_x" is found in the filename, then the subtittlelanguage could be selected with "subtitle preferences".
If only a "Subtitle_x" is found in the filename, then the audiolanguage could be selected with "Audio preferences".
If the file is named "Annie (1982).BluRay.Audiostream_12.Subtitle_23.iso" and there are only 4 audio/subtitlestreams (thus: user error), then it would fall back to the "audio preferences" and "subtitle preferences".


I would probably always put both "Audiostream_x" and "Subtitle_x" in the filename.




This could also be implemeted with the "Audiostream_x" and "Subtitle_x" as video library tags, but the wiki seems to imply that the addon would not be able to access those yet. So this would be for XBMC v13...

Probably some work, but this would make XBMC complete and perfect for me...

Thanks



RE: [Release] Language Preference Manager - N3MIS15 - 2013-02-05

The conditional subtitles intrigues me. I have all my 1:1 BR rips with subs included, but only need subs when watching foreign films. I have enable subs disabled by default and enable when needed. Will conditional subs override XBMC's "enable subtitles" feature?


RE: [Release] Language Preference Manager - Ace - 2013-02-05

@Wimpie: Thanks for your comments! I have to think about it and the best way to do so, if possible.

Quote:Sometimes I get blu-ray images where some audiotrack has no language

Could be a bug/misbehaviour, I'm working on that (#2162) but haven't tested blurays yet.

Quote:------ a native english movie would be correct with dutch subtitles ...

I already thought about a language "production language", but afaik xbmc does not store this info. Maybe I can use a hand-made map like "USA - English".

Quote:Some movies for the kids/wife need to be with the russian audiotrack, even if there are english/dutch/other languages.

Here I already thought about per genre preferences.

Quote:I would like to be able to select on a per movie basis another audiotrack/subtitlelanguage

How does you know which number your preferred audio/subtitle has? If you tested/found it via xbmc isn't it saved for that movie (in xbmc's db)?












(2013-02-05, 12:53)N3MIS15 Wrote: The conditional subtitles intrigues me. I have all my 1:1 BR rips with subs included, but only need subs when watching foreign films. I have enable subs disabled by default and enable when needed. Will conditional subs override XBMC's "enable subtitles" feature?

At the moment there is no overriding. I will add a switch in the next version.



RE: [Release] Language Preference Manager - Wimpie - 2013-02-06

(2013-02-05, 15:40)ace20022 Wrote: @Wimpie: Thanks for your comments! I have to think about it and the best way to do so, if possible.

Quote:Sometimes I get blu-ray images where some audiotrack has no language

Could be a bug/misbehaviour, I'm working on that (#2162) but haven't tested blurays yet.


It's a XBMC bug. Not a Language Preference Manager bug.



(2013-02-05, 15:40)ace20022 Wrote:
Quote:------ a native english movie would be correct with dutch subtitles ...

I already thought about a language "production language", but afaik xbmc does not store this info. Maybe I can use a hand-made map like "USA - English".

I have already sorted in directories, by other criteria, my movies. It's (nearly) impossible to re-arrange them for "production language".

If you mean you would like to make a map/list with movienames/production languages, then I would preffer to tag the filename with a "Audiostream_x" tag. Can not get lost and is always for the correct movie (different version of the same movie (uncut/ dir cut/....)).


(2013-02-05, 15:40)ace20022 Wrote:
Quote:I would like to be able to select on a per movie basis another audiotrack/subtitlelanguage

How does you know which number your preferred audio/subtitle has? If you tested/found it via xbmc isn't it saved for that movie (in xbmc's db)?

I have a seperate computer with a stock XBMC to rip my blu-ray iso's. My HTPC is another computer/XBMC. I don't have a central SQL database.

The ripping is done with AnyDVD HD, to generate a full rip iso. After the rip, the iso file is put in its own directory "movie (year)" so I can start scraping with Ember media manager.

I then launch my XBMC on that computer to see what languages this movie has and if I need an external player or not (TMT). Finally I adjust the filename of the iso to whatever is needed (.Rus./.Ext_Player./.Ned./.Kiddie./....) and copy the whole dir over to my unraid server.


I like to have full control over what XMBC displays and how. Thats why I use Ember, and I would like to have this work via filename tags or, if possible, video library tags (Has my prefference, but is not yet possible, I think. I would put these video library tags also in the .nfo file).

The level of control you get is so much, much , much better than any other (programmed/conditional) way.
e.g. Without you adjusting LPM, people could use this method to select the english AC3 track instead of the english DTS-HD track. They could need it because their HTPC isn't powerfull enough to (trans/de)code DTS-HD.

And by putting this info in the filename/.nfo tag, you only have to do this once. No problem to 'lose' the XBMC DB (HD crash/...)...


Offcourse, this methods only works if an app can get the filename to parse for tags. I assume this would work. Otherwise we will have to wait until video library tags are available to apps.

Awaiting your comments....
Wimpie


RE: [Release] Language Preference Manager - stockloanban - 2013-02-08

Snapshot is helpful thanks


RE: [Release] Language Preference Manager - tevi - 2013-02-11

Could you please add the option to disable subtitles?

For my native language, I prefer subtitles off, but for Japanese, I pretty much need the subtitles on.


RE: [Release] Language Preference Manager - Ace - 2013-02-11

Hi tevi,

I will add a switch to enable subtitles only if a preference is met in the next version. This way you can disabling subtitles by default
(play a video -> open audio settings -> disable subtitles -> set as default for all videos).


RE: [Release] Language Preference Manager - tevi - 2013-02-11

That's great.

I looked through your code to try and help, but I don't know python.

Depending on if you make the enable subtitles button require two conditions (both audio language and sub language match) you might want to add an unknown language option.

I have several shows that list the subtitle as "Unknown".


RE: [Release] Language Preference Manager - Ace - 2013-02-11

The switch will only enable subs if a subs preference or a conditional subs preference is met.
Do your videos only have one sub (the unknown one) ? Then I could add a switch to enable subs if there is just a single one available, but I'm not sure if this is useful.

Btw don't look at my code too closely, it's my first contact with python Wink