From e970f05feea86232fa44adf951b680411b57ade8 Mon Sep 17 00:00:00 2001 From: Antoine Cellerier Date: Sat, 18 Mar 2006 01:22:06 +0000 Subject: [PATCH] HTTP interface: Display estimated item time when available. --- modules/control/http/util.c | 3 +++ share/http/dialogs/playlist | 2 +- share/http/js/functions.js | 3 +++ share/http/requests/playlist.xml | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/control/http/util.c b/modules/control/http/util.c index e2d77f7615..b12ccde8bd 100644 --- a/modules/control/http/util.c +++ b/modules/control/http/util.c @@ -458,6 +458,9 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl, E_(mvar_AppendNewVar)( itm, "ro", "rw" ); } + sprintf( value, "%d", p_node->input.i_duration ); + E_(mvar_AppendNewVar)( itm, "duration", value ); + E_(mvar_AppendVar)( s, itm ); } else diff --git a/share/http/dialogs/playlist b/share/http/dialogs/playlist index 4eb89f577f..9e7ab7f8ef 100644 --- a/share/http/dialogs/playlist +++ b/share/http/dialogs/playlist @@ -71,7 +71,7 @@ This dialog needs the following dialogs to be fully functional: diff --git a/share/http/js/functions.js b/share/http/js/functions.js index eeac8f966e..e1a0031852 100644 --- a/share/http/js/functions.js +++ b/share/http/js/functions.js @@ -557,6 +557,9 @@ function parse_playlist() } pl.setAttribute( 'title', elt.getAttribute( 'uri' )); pl.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) ); + var duration = elt.getAttribute( 'duration' ); + if( duration > 0 ) + pl.appendChild( document.createTextNode( " (" + format_time( elt.getAttribute( 'duration' ) / 1000000 ) + ")" ) ); pos.appendChild( pl ); if( elt.getAttribute( 'ro' ) == 'rw' ) diff --git a/share/http/requests/playlist.xml b/share/http/requests/playlist.xml index f8b3cddcc4..debe400096 100644 --- a/share/http/requests/playlist.xml +++ b/share/http/requests/playlist.xml @@ -35,7 +35,7 @@ - " current="current" uri="" name="" ro="" /> + " current="current" uri="" name="" ro="" duration="" /> " name="" ro="" > -- 2.39.5