2015-03-08, 23:05
Hi all,
It was annoying me to see movies durations in minutes (for exemple: 157 minutes means nothing for a human being) so I wrote a script to fix this.
I prefer durations in HH:MM or HHhMM format so that's what this script do, it converts movies duration from minutes to hours & minutes to display it on a human-readable way.
2h35 is easier to understand than 155, right ?
(updated in december 2017 thanks to axbmcuser work, available here : https://github.com/axbmcuser/_repo/tree/..._axbmcuser )
Of course, your kodi skin has to be tweaked to trigger the script and to display the value calculated.
---------------------------------------------------
HOW TO TWEAK YOUR SKIN
---------------------------------------------------
Exemple: for the Estuary skin, these 2 xml files need to be modified as follow :
Variables.xml
Add this new variable at the end of the file (before the </include>) :
<variable name="ItemDuration">
<value condition="System.HasAddon(script.duration) +
[Window.IsVisible(Videos) | Window.IsVisible(Movieinformation)] +
!String.IsEmpty(Window(Home).Property(Durations.Hours)) +
!String.IsEqual(Window(Home).Property(Durations.Hours),0) +
!String.IsEmpty(Window(Home).Property(Durations.DBID)) +
String.IsEqual(Window(Home).Property(Durations.DBID),ListItem.DBID)">$INFO[Window(Home).Property(Durations.HoursMinutes)]</value>
<value>$INFO[ListItem.Duration] min</value>
</variable>
Includes.xml
Replace <label>$INFO[ListItem.Duration,, $LOCALIZE[31132]]</label> with <label>$VAR[ItemDuration]</label>
--------------------------------------------------------------------------------------------------------------------
This way, your skin can still display a duration even if the script.duration is not installed.
It's my first script, so it must be far from perfection but it fully works on my HTPC.
Tell me what you think of it.
It was annoying me to see movies durations in minutes (for exemple: 157 minutes means nothing for a human being) so I wrote a script to fix this.
I prefer durations in HH:MM or HHhMM format so that's what this script do, it converts movies duration from minutes to hours & minutes to display it on a human-readable way.
2h35 is easier to understand than 155, right ?
(updated in december 2017 thanks to axbmcuser work, available here : https://github.com/axbmcuser/_repo/tree/..._axbmcuser )
Of course, your kodi skin has to be tweaked to trigger the script and to display the value calculated.
---------------------------------------------------
HOW TO TWEAK YOUR SKIN
---------------------------------------------------
Exemple: for the Estuary skin, these 2 xml files need to be modified as follow :
Variables.xml
Add this new variable at the end of the file (before the </include>) :
<variable name="ItemDuration">
<value condition="System.HasAddon(script.duration) +
[Window.IsVisible(Videos) | Window.IsVisible(Movieinformation)] +
!String.IsEmpty(Window(Home).Property(Durations.Hours)) +
!String.IsEqual(Window(Home).Property(Durations.Hours),0) +
!String.IsEmpty(Window(Home).Property(Durations.DBID)) +
String.IsEqual(Window(Home).Property(Durations.DBID),ListItem.DBID)">$INFO[Window(Home).Property(Durations.HoursMinutes)]</value>
<value>$INFO[ListItem.Duration] min</value>
</variable>
Includes.xml
Replace <label>$INFO[ListItem.Duration,, $LOCALIZE[31132]]</label> with <label>$VAR[ItemDuration]</label>
--------------------------------------------------------------------------------------------------------------------
This way, your skin can still display a duration even if the script.duration is not installed.
It's my first script, so it must be far from perfection but it fully works on my HTPC.
Tell me what you think of it.