[split] Help displaying flags for audio & subtitle streams
#1
Question 
Hi,

I 've been reading about this issue for a long while. So my question is simple to put - do not know if simple to implement:

Is it possible that the audio/sub language icon displayed in video info while playing the media file (in this case Spanish audio icon)

Image

can also be displayed in any of the the video Poster wrap, Fanart, Media Info1,2,3, views in the default Kodi skin Confluence? As in here:

Image

Image

The rationale being able to see what audio/subs are available BEFORE having to play the media file.

For your info, I have successfully installed the script in Kodi 15.2 Isengard and vould like to volunteer for any testing you may need.
Reply
#2
This is no longer needed as they're now info labels -

Code:
ListItem.AudioLanguage[.n]    Shows the audio language of the currently selected video, optionally 'n' defines the number of the audiostream (returns an ISO 639-2 three character code, e.g. eng, epo, deu)
ListItem.SubtitleLanguage[.n]    Shows the subtitle language of the currently selected video, optionally 'n' defines the number of the subtitle (returns an ISO 639-2 three character code, e.g. eng, epo, deu)

So you'll just need to add them in the views you want.
Reply
#3
Hitcher, thank you very much for your advice. It is appreciated. I can see the point now: Media flags read InfoLabels. But from the media file? Or the .nfo if it has already been created say by 3rd party app? I'm not a coder but I focus on languages.

To make thigs simpler, I will consider on the default Confluence skin and default list view.

File ViewsFileMode.xml is to be edited where within <itemlayout height="40" width="580"> and <focusedlayout height="40" width="580"> the following code should be added (Code from Balrok's blog for skin Aeon Nox 5):


Code:
<control type="image">
                        <width>78</width>
                        <height>78</height>
                        <aspectratio>keep</aspectratio>
                        <texture background="true" fallback="flags/studios/default-studio.png">$INFO[ListItem.AudioLanguage,flags/language/,.png]</texture>
                    </control>
                    <control type="image">
                        <width>78</width>
                        <height>78</height>
                        <aspectratio>keep</aspectratio>
                        <texture background="true" fallback="flags/studios/default-studio.png">$INFO[ListItem.SubtitleLanguage,flags/language/,.png]</texture>
                        <visible>!IsEmpty(ListItem.SubtitleLanguage)</visible>
                    </control>


I assume the code above would read the meta-information from the media file (not the .nfo) and display the related language/subtitle icon. I should check relative paths and width/height dimensions for the icons to look good.

This approach seems to be adequate when dealing with media files with meta-information capabilities (mkv, mp4...). But, what to do with media containers that do not keep such meta information?

Balrok points to a post in German in a Kodi-related forum where the user freaks worth seems to grab the audio language informatiom from the folder or filename. The user is considering MediaListView3 in ViewsVideoLibrary.xml


Code:
<control type = "image">
  <description> AudioIcon </ description>
  <posx> 555 </ posx>
  <posy> 143 </ posy>
  <width> 20 </ width>
  <height> 33 </ height>
  <Aspect Ratio> Keep </ Aspect Ratio>
  <texture> flagging / audio / eng.png </ texture>
  <visible> substring (ListItem.Foldername, .EN) </ visible>
  </ control>

control type = "image">
  <description> AudioIcon </ description>
  <posx> 555 </ posx>
  <posy> 143 </ posy>
  <width> 20 </ width>
  <height> 33 </ height>
  <Aspect Ratio> Keep </ Aspect Ratio>
  <texture> flagging / audio / ger.png </ texture>
  <visible>! substring (ListItem.Foldername, .EN) </ visible>
  </ control>


In the case above I assume the English audio icon would be displayed always unless there is no .EN string when the audio icon would default to German.

Would this approach require adding an additional texture visible line for each language? Same language-name coding based on 3-character ISO 639-2 standard for the .png image
.EN .ES .FR .PT draw from the ISO 639-1 standard even though these could be simply renamed to .ENG .SPA .FRA .POR for consistency with the ISO 639-2 standard

For example:


Code:
<control type = "image">
  <description> AudioIcon </ description>
  <posx> 555 </ posx>
  <posy> 143 </ posy>
  <width> 20 </ width>
  <height> 33 </ height>
  <Aspect Ratio> Keep </ Aspect Ratio>
  <texture> flagging / audio / eng.png </ texture>
  <visible> substring (ListItem.Foldername, .EN) </ visible>
  <texture> flagging / audio / spa.png </ texture>
  <visible> substring (ListItem.Foldername, .ES) </ visible>
  <texture> flagging / audio / fra.png </ texture>
  <visible> substring (ListItem.Foldername, .FR) </ visible>
  <texture> flagging / audio / por.png </ texture>
  <visible> substring (ListItem.Foldername, .PT) </ visible>
  <texture> flagging / audio / ita.png </ texture>
  <visible> substring (ListItem.Foldername, .IT) </ visible>
  </ control>

The goal, as it can be easily inferred is to get audio and subtitle language, both in meta-friendly and meta-unfriendly media files as well as internal and external subtitle files, to be displayed in Confluence

Please, feel free to add any suggestions, remarks... you or anyone wishes. They will all be welcome.
Reply
#4
Very limited success, if it can be called like that...

Quote:<control type="image">
<description>Video rez Image</description>
<width>55</width>
<height>35</height>
<aspectratio align="right">keep</aspectratio>
<texture>$INFO[ListItem.VideoResolution,flagging/video/,.png]</texture>
<visible>Window.IsVisible(Videos)</visible>

Code above will show the video resolution info in the video list mode as in the following screenshot.

Image

However, the following similar piece of code

Code:
<control type="image">
                        <description>AudioLanguage</description>
                        <width>55</width>
                        <height>35</height>
                        <aspectratio align="right">keep</aspectratio>
                        <texture>$INFO[ListItem.AudioLanguage,flagging/language/,.png]</texture>
                        <visible>Window.IsVisible(Videos)</visible>
                    </control>

will not display the much-expected Audio language icon.

And trying to re-use Balro's piece of code

Code:
<control type="image">
                        <width>78</width>
                        <height>78</height>
                        <aspectratio>keep</aspectratio>
                        <texture background="true" fallback="flags/studios/default-studio.png">$INFO[ListItem.AudioLanguage,flags/language/,.png]</texture>
                    </control>

will not displaying anything either (paths must be edited...)

Any piece of advice will be welcome!
Reply
#5
You've got the image path wrong for Confluence.

Code:
$INFO[ListItem.AudioLanguage,Subtitles/flags/,.png]
Reply
#6
Hello,

Thank you for your support once more. I have tried the following piece of code so as to replace the SD/HD icon in the rightmost side of the panel with a mixed sense of success.

Code:
<control type="image">
                        <left>625</left>
                        <top>8</top>
                        <width>40</width>
                        <height>26</height>
                        <aspectratio>keep</aspectratio>
                        <texture>$INFO[ListItem.AudioLanguage,Subtitle/flags,.png]</texture>
                        <visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Sets) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
                    </control>


The SD/HD icon is no longer showing (good) but the expected Audio language icon will not (sense of failure).

I have tried different combinations so as to locate the path by trial and error in case it were somewhere else but in every case the result has been failure (no SD/HD icon but no Audio Language icon):

Code:
<texture>$INFO[ListItem.AudioLanguage,Subtitle/flags/,.png]</texture>

<texture>$INFO[ListItem.AudioLanguage,flags,.png]</texture>

<texture>$INFO[ListItem.AudioLanguage,flags/,.png]</texture>

<texture>$INFO[ListItem.AudioLanguage,flags/language,.png]</texture>

<texture>$INFO[ListItem.AudioLanguage,flags/language/,.png]</texture>

<texture>$INFO[ListItem.AudioLanguage,language/,.png]</texture>

<texture>$INFO[ListItem.AudioLanguage,Audio/flags,.png]</texture>

I must be missing the point because I have the feeling I'm getting closer to it but not yet. Thank you for your time and advice.
Reply
#7
Looks like you'll have to add you own images as the ones in Subtitles/flags/ are 2 character codes but ListItem.AudioLanguage returns 3 character codes.
Reply
#8
I see... But where is that folder expected to be located at? Because the are no subfolders below

C:\Program Files (x86)\Kodi\addons\skin.confluence\720p

So I have just created:

C:\Program Files (x86)\Kodi\addons\skin.confluence\720p\Subtitles\flags

And added 3-letter image files such as eng.png spa.png and so on. However, they still do not show... And I cannot see any flag folder within the skin.confluence file structure.

Thanks and thanks!
Reply
#9
Code:
<texture>$INFO[VideoPlayer.SubtitlesLanguage,badges/countries/v2/,.png]</texture>
Use that inside image control.
And keep in mind to put your images in the media folder.
Reply
#10
Thank you for your message, finalmakerr

This is the code inside image control:


Code:
                    <control type="image">
                        <left>625</left>
                        <top>8</top>
                        <width>40</width>
                        <height>26</height>
                        <aspectratio>keep</aspectratio>
                        <texture>$INFO[VideoPlayer.SubtitlesLanguage,badges/countries/v2/,.png]</texture>                        
                        <visible>Window.IsVisible(Videos) + [Container.Content(Movies) | Container.Content(Sets) | Container.Content(Episodes) | Container.Content(MusicVideos)]</visible>
                    </control>

And, to play safe, I have added all the flag icon files (es.png spa.png en.png eng.png etc.) inside
C:\Program Files (x86)\Kodi\addons\skin.confluence\media
and also inside
C:\Program Files (x86)\Kodi\addons\skin.confluence\media\badges\countries\v2

I have deleted all files from the Kodi library and added them as new. And, still icon flags will not be displayed...

I have checked the .nfo file created with tinymediamanager and noticed there are two language tags:

Code:
    <fileinfo>
        <streamdetails>
            <video>
                <codec>XviD</codec>
                <aspect>1.85</aspect>
                <width>720</width>
                <height>384</height>
                <durationinseconds>7040</durationinseconds>
            </video>
            <audio>
                <codec>AC3</codec>
                <language>spa</language>
                <channels>6</channels>
            </audio>
        </streamdetails>
    </fileinfo>


And here as well right at the end of the .nfo file:

Code:
        <languages>ES</languages>
    </movie>

However, both kind of png files (es.png and spa.png) are available so whichever tag Kodi is importing/reading, it should be displayed. And that is not the case yet. A bit frustrating... but I don't want to give up!

Thank you again for your support!
Reply
#11
Remove the visible condition from the image control.

You may find it useful to create a label control to display your texture path, just for testing.

When you accomplish this task you may want to use those visible conditions:
Code:
<visible>!IsEmpty(VideoPlayer.SubtitlesLanguage)</visible>
          <visible>VideoPlayer.SubtitlesEnabled + VideoPlayer.HasSubtitles</visible>
Reply
#12
Thank you for your guidance indeed.

I have tried:

Code:
                    <control type="image">
                        <left>625</left>
                        <top>8</top>
                        <width>40</width>
                        <height>26</height>
                        <aspectratio>keep</aspectratio>
                        <texture>$INFO[VideoPlayer.SubtitlesLanguage,badges/countries/v2/,.png]</texture>                        
                        
                    </control>
                    
                    <control type="label">
                    <description>Subtitle icon</description>
                        <left>625</left>
                        <top>8</top>
                        <width>40</width>
                        <height>26</height>
                        <font>font13</font>
                        <textcolor>white</textcolor>
                        <selectedcolor>selected</selectedcolor>
                        <align>left</align>
                        <aligny>center</aligny>
                        <label>$INFO[VideoPlayer.SubtitlesLanguage]</label>
                    </control>

That is, removed the visible condicion from control image and added a new control label just below following the example from the Wiki Label control article. However, nothing has shown. I have tried

Code:
<label>$INFO[VideoPlayer.SubtitlesLanguage[1]]</label>

Just in case a subtitle strem must be chosen, but same result. And I have replaced

Code:
<label>$INFO[VideoPlayer.SubtitlesLanguage,badges/countries/v2/,.png]</label>

with

Code:
<texture>$INFO[VideoPlayer.SubtitlesLanguage,badges/countries/v2/,.png]</texture>

just in case, but same result.

What you suggest about testing seems like a very good idea which I have not been able to put into practice... Could you please help some more?

Thank you again,
Reply

Logout Mark Read Team Forum Stats Members Help
[split] Help displaying flags for audio & subtitle streams0