[vlc-devel] commit: Provide more item meta data to HTTP RPN. (Scott Lyons )

git version control git at videolan.org
Thu Oct 16 17:37:07 CEST 2008


vlc | branch: master | Scott Lyons <scottalyons at Ringo-2.local> | Tue Oct 14 20:40:28 2008 -0400| [b1ea9899b415ce3685e8633c6e45214e3c07e0c6] | committer: Rémi Denis-Courmont 

Provide more item meta data to HTTP RPN.

Working on a few remote-control applications that require more details
about the files in the playlist and the currently playing file. Also
fixed the RPN module so that the fields listed as possible arguments
for vlc_get_meta actually matches the list of fields in the Developer's
wiki.

Signed-off-by: Rémi Denis-Courmont <rdenis at simphalempin.com>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=b1ea9899b415ce3685e8633c6e45214e3c07e0c6
---

 modules/control/http/rpn.c       |   48 ++++++++++++++++++++++++++++++++++
 modules/control/http/util.c      |   53 ++++++++++++++++++++++++++++++++++++-
 share/http/requests/playlist.xml |   19 +++++++++++++-
 share/http/requests/status.xml   |   20 +++++++++++++-
 4 files changed, 136 insertions(+), 4 deletions(-)

diff --git a/modules/control/http/rpn.c b/modules/control/http/rpn.c
index 75c62d1..32f715b 100644
--- a/modules/control/http/rpn.c
+++ b/modules/control/http/rpn.c
@@ -1014,6 +1014,54 @@ void EvaluateRPN( intf_thread_t *p_intf, mvar_t  *vars,
                 {
                     psz_val = input_item_GetGenre( p_item );
                 }
+                else if( !strcmp( psz_meta, "COPYRIGHT" ) )
+                {
+                     psz_val = input_item_GetCopyright( p_item );
+                }
+                else if( !strcmp( psz_meta, "TRACK_NUMBER" ) )
+                {
+                    psz_val = input_item_GetTrackNum( p_item );
+                }
+                else if( !strcmp( psz_meta, "DESCRIPTION" ) )
+                {
+                    psz_val = input_item_GetDescription( p_item );
+                }
+                else if( !strcmp( psz_meta, "RATING" ) )
+                {
+                    psz_val = input_item_GetRating( p_item );
+                }
+                else if( !strcmp( psz_meta, "DATE" ) )
+                {
+                    psz_val = input_item_GetDate( p_item );
+                }
+                else if( !strcmp( psz_meta, "URL" ) )
+                {
+                    psz_val = input_item_GetURL( p_item );
+                }
+                else if( !strcmp( psz_meta, "LANGUAGE" ) )
+                {
+                    psz_val = input_item_GetLanguage( p_item );
+                }
+                else if( !strcmp( psz_meta, "NOW_PLAYING" ) )
+                {
+                    psz_val = input_item_GetNowPlaying( p_item );
+                }
+                else if( !strcmp( psz_meta, "PUBLISHER" ) )
+                {
+                    psz_val = input_item_GetPublisher( p_item );
+                }
+                else if( !strcmp( psz_meta, "ENCODED_BY" ) )
+                {
+                    psz_val = input_item_GetEncodedBy( p_item );
+                }
+                else if( !strcmp( psz_meta, "ART_URL" ) )
+                {
+                    psz_val = input_item_GetEncodedBy( p_item );
+                }
+                else if( !strcmp( psz_meta, "TRACK_ID" ) )
+                {
+                    psz_val = input_item_GetTrackID( p_item );
+                }
 #undef p_item
             }
             if( psz_val == NULL ) psz_val = strdup( "" );
diff --git a/modules/control/http/util.c b/modules/control/http/util.c
index 65a36df..52cadd9 100644
--- a/modules/control/http/util.c
+++ b/modules/control/http/util.c
@@ -384,10 +384,59 @@ void PlaylistListNode( intf_thread_t *p_intf, playlist_t *p_pl,
         else
             mvar_AppendNewVar( itm, "ro", "rw" );
 
-        sprintf( value, "%ld",
-                 (long) input_item_GetDuration( p_node->p_input ) );
+        sprintf( value, "%"PRId64, input_item_GetDuration( p_node->p_input ) );
         mvar_AppendNewVar( itm, "duration", value );
 
+        //Adding extra meta-information to each playlist item
+
+        psz = input_item_GetTitle( p_node->p_input );
+        mvar_AppendNewVar( itm, "title", psz );
+
+        psz = input_item_GetArtist( p_node->p_input );
+        mvar_AppendNewVar( itm, "artist", psz );
+
+        psz = input_item_GetGenre( p_node->p_input );
+        mvar_AppendNewVar( itm, "genre", psz );
+
+        psz = input_item_GetCopyright( p_node->p_input );
+        mvar_AppendNewVar( itm, "copyright", psz );
+
+        psz = input_item_GetAlbum( p_node->p_input );
+        mvar_AppendNewVar( itm, "album", psz );
+
+        psz = input_item_GetTrackNum( p_node->p_input );
+        mvar_AppendNewVar( itm, "track", psz );
+
+        psz = input_item_GetDescription( p_node->p_input );
+        mvar_AppendNewVar( itm, "description", psz );
+
+        psz = input_item_GetRating( p_node->p_input );
+        mvar_AppendNewVar( itm, "rating", psz );
+
+        psz = input_item_GetDate( p_node->p_input );
+        mvar_AppendNewVar( itm, "date", psz );
+
+        psz = input_item_GetURL( p_node->p_input );
+        mvar_AppendNewVar( itm, "url", psz );
+
+        psz = input_item_GetLanguage( p_node->p_input );
+        mvar_AppendNewVar( itm, "language", psz );
+
+        psz = input_item_GetNowPlaying( p_node->p_input );
+        mvar_AppendNewVar( itm, "now_playing", psz );
+
+        psz = input_item_GetPublisher( p_node->p_input );
+        mvar_AppendNewVar( itm, "publisher", psz );
+
+        psz = input_item_GetEncodedBy( p_node->p_input );
+        mvar_AppendNewVar( itm, "encoded_by", psz );
+
+        psz = input_item_GetArtURL( p_node->p_input );
+        mvar_AppendNewVar( itm, "art_url", psz );
+
+        psz = input_item_GetTrackID( p_node->p_input );
+        mvar_AppendNewVar( itm, "track_id", psz );
+
         mvar_AppendVar( s, itm );
     }
     else
diff --git a/share/http/requests/playlist.xml b/share/http/requests/playlist.xml
index 5a3fb5c..46ecfb9 100644
--- a/share/http/requests/playlist.xml
+++ b/share/http/requests/playlist.xml
@@ -35,7 +35,24 @@
   <vlc id="end" />
   <vlc id="if" param1="pl.type value 'Node' strcmp" />
     <vlc id="rpn" param1="1 +" />
-    <leaf id="<vlc id="value" param1="pl.index" />" <vlc id="if" param1="pl.current" /> current="current" <vlc id="end" /> uri="<vlc id="value" param1="pl.uri xml_encode" />" name="<vlc id="value" param1="pl.name xml_encode" />" ro="<vlc id="value" param1="pl.ro" />" duration="<vlc id="value" param1="pl.duration" />" />
+    <leaf id="<vlc id="value" param1="pl.index" />" <vlc id="if" param1="pl.current" /> current="current" <vlc id="end" /> uri="<vlc id="value" param1="pl.uri xml_encode" />" name="<vlc id="value" param1="pl.name xml_encode" />" ro="<vlc id="value" param1="pl.ro" />" duration="<vlc id="value" param1="pl.duration" />">
+		<title><![CDATA[<vlc id="value" param1="pl.title xml_encode" />]]></title>
+		<artist><![CDATA[<vlc id="value" param1="pl.artist" xml_encode />]]></artist>
+		<genre><![CDATA[<vlc id="value" param1="pl.genre xml_encode" />]]></genre>
+		<copyright><![CDATA[<vlc id="value" param1="pl.copyright xml_encode" />]]></copyright>
+		<album><![CDATA[<vlc id="value" param1="pl.album xml_encode" />]]></album>
+		<track><![CDATA[<vlc id="value" param1="pl.track xml_encode" />]]></track>
+		<description><![CDATA[<vlc id="value" param1="pl.description xml_encode" />]]></description>
+		<rating><![CDATA[<vlc id="value" param1="pl.rating xml_encode" />]]></rating>
+		<date><![CDATA[<vlc id="value" param1="pl.date xml_encode" />]]></date>
+		<url><![CDATA[<vlc id="value" param1="pl.url xml_encode" />]]></url>
+		<language><![CDATA[<vlc id="value" param1="pl.language xml_encode" />]]></language>
+		<now_playing><![CDATA[<vlc id="value" param1="pl.now_playing xml_encode" />]]></now_playing>
+		<publisher><![CDATA[<vlc id="value" param1="pl.publisher xml_encode" />]]></publisher>
+		<encoded_by><![CDATA[<vlc id="value" param1="pl.encoded_by xml_encode" />]]></encoded_by>
+		<art_url><![CDATA[<vlc id="value" param1="pl.art_url xml_encode" />]]></art_url>
+		<track_id><![CDATA[<vlc id="value" param1="pl.track_id xml_encode" />]]></track_id>
+	</leaf>
   <vlc id="else" />
     <node id="<vlc id="value" param1="pl.index" />" name="<vlc id="value" param1="pl.name xml_encode" />" ro="<vlc id="value" param1="pl.ro" />" >
     <vlc id="if" param1="first_item value 0 ="/>
diff --git a/share/http/requests/status.xml b/share/http/requests/status.xml
index c180fa2..3dd459a 100644
--- a/share/http/requests/status.xml
+++ b/share/http/requests/status.xml
@@ -123,7 +123,25 @@
         <vlc id="end" />
       </category>
     <vlc id="end" />
-  </information>
+	   <meta-information>
+		    <title><![CDATA[<vlc id="value" param1="'TITLE' vlc_get_meta xml_encode" />]]></title>
+		    <artist><![CDATA[<vlc id="value" param1="'ARTIST' vlc_get_meta xml_encode" />]]></artist>
+		    <genre><![CDATA[<vlc id="value" param1="'GENRE' vlc_get_meta xml_encode" />]]></genre>
+		    <copyright><![CDATA[<vlc id="value" param1="'COPYRIGHT' vlc_get_meta xml_encode" />]]></copyright>
+		    <album><![CDATA[<vlc id="value" param1="'ALBUM' vlc_get_meta xml_encode" />]]></album>
+		    <track><![CDATA[<vlc id="value" param1="'TRACK_NUMBER' vlc_get_meta xml_encode" />]]></track>
+		    <description><![CDATA[<vlc id="value" param1="'DESCRIPTION' vlc_get_meta xml_encode" />]]></description>
+		    <rating><![CDATA[<vlc id="value" param1="'RATING' vlc_get_meta xml_encode" />]]></rating>
+		    <date><![CDATA[<vlc id="value" param1="'DATE' vlc_get_meta xml_encode" />]]></date>
+		    <url><![CDATA[<vlc id="value" param1="'URL' vlc_get_meta xml_encode" />]]></url>
+		    <language><![CDATA[<vlc id="value" param1="'LANGUAGE' vlc_get_meta xml_encode" />]]></language>
+		    <now_playing><![CDATA[<vlc id="value" param1="'NOW_PLAYING' vlc_get_meta xml_encode" />]]></now_playing>
+		    <publisher><![CDATA[<vlc id="value" param1="'PUBLISHER' vlc_get_meta xml_encode" />]]></publisher>
+		    <encoded_by><![CDATA[<vlc id="value" param1="'ENCODED_BY' vlc_get_meta xml_encode" />]]></encoded_by>
+		    <art_url><![CDATA[<vlc id="value" param1="'ART_URL' vlc_get_meta xml_encode" />]]></art_url>
+		    <track_id><![CDATA[<vlc id="value" param1="'TRACK_ID' vlc_get_meta xml_encode" />]]></track_id>
+		    </meta-information>
+	   </information>
   <stats>
     <readbytes><vlc id="value" param1="read_bytes" /></readbytes>
     <inputbitrate><vlc id="value" param1="input_bitrate" /></inputbitrate>




More information about the vlc-devel mailing list