[RELEASE] Video language script for audio & subtitle streams

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
`Black Offline
Team-XBMC Member
Posts: 2,358
Joined: Apr 2009
Reputation: 62
Location: Germany
Post: #1
Hi,

there is currently no other way to show the language of all audio & subtitle streams of a video file than adding the language(s) to the filename and display images with substring conditions. Since XBMC already extracts all those infos (we just don't have the necessary info labels), I decided to make a small script which sets properties for the languages in the video info dialog.

You have to add this to DialogVideoInfo.xml
<onload condition="System.HasAddon(script.videolanguage) + [Container.Content(movies) | Container.Content(episodes)]">RunScript(script.videolanguage,movieid=$INFO[ListItem.DBID])</onload>


Then you can access the following properties in the video info dialog
PHP Code:
Window.Property(AudioLanguage.%d)
Window.Property(SubtitleLanguage.%d

Quick example
PHP Code:
<control type="grouplist">
    [...]
    <
control type="image">
        <
width>48</width>
        <
height>48</height>
        <
texture>$INFO[Window.Property(AudioLanguage.1),flags/language/,.png]</texture>
        <
visible>!IsEmpty(Window.Property(AudioLanguage.1))</visible>
    </
control>
    <
control type="image">
        <
width>48</width>
        <
height>48</height>
        <
texture>$INFO[Window.Property(AudioLanguage.2),flags/language/,.png]</texture>
        <
visible>!IsEmpty(Window.Property(AudioLanguage.2))</visible>
    </
control>
    [...]
</
control

I did some quick testing and it seems to work fine but you never know. Suggestions are welcome. Smile

GitHub

[Image: xp1080-21.png]
(This post was last modified: 2013-02-28 20:02 by `Black.)
find quote
butchabay Offline
Skilled Skinner
Posts: 3,670
Joined: Mar 2010
Reputation: 71
Location: Planet Crematoria
Post: #2
Nice one ! Going to test it the next days...
Thanx mate
find quote
phil65 Offline
Skilled Skinner
Posts: 4,455
Joined: Mar 2009
Reputation: 60
Location: Cologne, Germany
Post: #3
nice work. thx.
find quote
Hitcher Online
Skilled Skinner
Posts: 10,262
Joined: Aug 2007
Reputation: 80
Location: Eastleigh, UK
Post: #4
Nice work black.

Whatever happened to the request anyway?
find quote
pieh Offline
Team-XBMC Member
Posts: 672
Joined: Aug 2010
Reputation: 13
Location: Poland
Post: #5
Hi,
I wasn't around much last month so I guess I missed request for this.

I'd say that now there is no good way to pass data containing multiple entries/items (i.e. cast list, album's track list, subtitles/audio streams list) to skin. We usually hardcode some list id to fill it with items (cast / track list). We need to add some mechanism to automate control/items creation, for example:

1.
Code:
<control type="grouplist">
    [...]
    <template end="$INFO[Window.Property(AudioLanguage.Count)]" begin="1" step="1"> <!-- begin and step could be optional -->
        <control type="image">
            <width>48</width>
            <height>48</height>
            <texture>$INFO[Window.Property(AudioLanguage.%d),flags/language/,.png]</texture>
        </control>
    </template>
    [...]
</control>
and/or
2.
Code:
<control type="grouplist">
    [...]
    <template source="AudioLanguages">
        <control type="image">
            <width>48</width>
            <height>48</height>
            <texture>$INFO[Entry,flags/language/,.png]</texture> <!-- for complex types like cast things like Entry.ActorName, EntryRole could be used -->
        </control>
    </template>
    [...]
</control>
This could be used in grouplists and static containers. I remember there was idea like this before but I never got to do anything in this direction.

After having such mechanism in place it would be really easy to add access to audio/subtitles streams (plus it would allow some nice stuff to be done with VideoPlayer.Cast)

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
find quote
`Black Offline
Team-XBMC Member
Posts: 2,358
Joined: Apr 2009
Reputation: 62
Location: Germany
Post: #6
@pieh
That would be nice. 2. example looks ok to me, maybe with begin, step and most importantly number of max items. The source could maybe better ListItem.AudioLanguages instead of just AudioLanguages.

[Image: xp1080-21.png]
(This post was last modified: 2013-02-11 13:46 by `Black.)
find quote
ferent Offline
Senior Member
Posts: 176
Joined: Sep 2010
Reputation: 0
Post: #7
I use the skin Aeon Nox that recently has included this script in the latest git, but the Languages don't show for me.
Here you have the log. Is there any error?

http://www.xbmclogs.com/show.php?id=1177

Thanks!!

I use XBMC (12.0), Platform: Linux (Ubuntu 12.04 LTS - XBMCbuntu, 3.2.0-37-generic-pae i686). Built on Feb 7 2013
find quote
`Black Offline
Team-XBMC Member
Posts: 2,358
Joined: Apr 2009
Reputation: 62
Location: Germany
Post: #8
Your video file has no language in the audio stream.

[Image: xp1080-21.png]
find quote
phil65 Offline
Skilled Skinner
Posts: 4,455
Joined: Mar 2009
Reputation: 60
Location: Cologne, Germany
Post: #9
would be nice if you could also add

self.window.setProperty('AudioCodec.%d' % count, item['codec'])

and

self.window.setProperty('AudioChannels.%d' % count, item['channels'])

to the script.

( + putting the script on GitHub Smile )

cheers.
(This post was last modified: 2013-02-25 16:45 by phil65.)
find quote
`Black Offline
Team-XBMC Member
Posts: 2,358
Joined: Apr 2009
Reputation: 62
Location: Germany
Post: #10
Will do. Should also be no problem to submit it to the official repo.

Edit: https://github.com/Black09/script.videolanguage

[Image: xp1080-21.png]
(This post was last modified: 2013-02-25 17:28 by `Black.)
find quote
ferent Offline
Senior Member
Posts: 176
Joined: Sep 2010
Reputation: 0
Post: #11
(2013-02-25 14:04)`Black Wrote:  Your video file has no language in the audio stream.

How can I add this language in the audio stream to my films? Thanks
find quote
hunkyn Offline
Fan
Posts: 401
Joined: May 2011
Reputation: 1
Location: Universe
Post: #12
I have a video that has a language set to "hin" but i only see english in the video info dialog. Using Aeon Nox latest git.

http://www.xbmclogs.com/show.php?id=1204

Is it supposed to change the language of the plot automatically to hindi in this case? or am i missing something

Intel® Quad Core i5 Sandybridge @3.40GHz | ASRock Z775 Mobo 8GB DDR3 Ram | Logitech K400 Keyboard |
| Logitec Harmony 550 Remote| 46' Samsung LCD TV | Onkyo TX-S605 w/ Bose 5.1 Surround
find quote
`Black Offline
Team-XBMC Member
Posts: 2,358
Joined: Apr 2009
Reputation: 62
Location: Germany
Post: #13
It won't change the plot language, you have to configure that in the scraper. If you don't see a flag image for hindi, I guess there simply is no hin.png available.

@ferent
Google it.

[Image: xp1080-21.png]
find quote
hunkyn Offline
Fan
Posts: 401
Joined: May 2011
Reputation: 1
Location: Universe
Post: #14
(2013-02-26 13:35)`Black Wrote:  It won't change the plot language, you have to configure that in the scraper. If you don't see a flag image for hindi, I guess there simply is no hin.png available.

Ah ok that explains. I do see the flag image but was not sure how the plot comes in a different language. Thanks for this amazing feature.

Intel® Quad Core i5 Sandybridge @3.40GHz | ASRock Z775 Mobo 8GB DDR3 Ram | Logitech K400 Keyboard |
| Logitec Harmony 550 Remote| 46' Samsung LCD TV | Onkyo TX-S605 w/ Bose 5.1 Surround
find quote
voidy Offline
Member
Posts: 91
Joined: Mar 2009
Reputation: 0
Post: #15
awesome work first off all Big Grin

1 question i have and i should mention i have ony a general idea how this works so no flaming me please Big Grin. pretty much all my movies and tvshow episodes have a seperate subtitle file wich is names exactly as the movie or show
small example
Pulp Fiction.mkv
Pulp Fiction-EN.srt

is it possible that it sees the .srt file and add the flag ?
find quote
Post Reply