[vlc-devel] [PATCH 2/2] lua/http: avoid diverging legacy code to print status.xml

Pierre Ynard linkfanel at yahoo.fr
Sun Aug 23 00:55:59 CEST 2020


The constraint with ES information was that it produced invalid XML,
but now that this is fixed, there is no reason to exclude standard data
from the output. In particular this adds support for chapter and title
information, and any future new field, while actually reducing the
amount of specific code.

Fixes #10443


diff --git a/share/lua/http/requests/status.xml b/share/lua/http/requests/status.xml
index fec2d9d..a2313a7 100644
--- a/share/lua/http/requests/status.xml
+++ b/share/lua/http/requests/status.xml
@@ -33,17 +33,23 @@ require "httprequests"
 
 httprequests.processcommands()
 
-local statusTable=httprequests.getstatus(false)
+local statusTable=httprequests.getstatus(true)
+
+--In the information section, an extra copy of some data is presented
+--in a non-standard way to keep compatibility.
+local information = statusTable.information
+statusTable.information = nil
 
 print('<root>\n')
 httprequests.printTableAsXml(statusTable,0)
 
 local item = vlc.player.item()
 
---data in the information section is presented in a non-standard way to keep compatibility.
-
 ?>
 <information>
+  <?vlc
+    httprequests.printTableAsXml(information,2)
+  ?>
     <category name="meta">
     <?vlc
       if item then
@@ -68,15 +74,4 @@ local item = vlc.player.item()
     end
   ?>
   </information>
-  <stats>
-  <?vlc
-    if item then
-      local stats = item:stats()
-      for k,v in pairs(stats) do
-        local tag = string.gsub(k,"_","")
-        print("<"..httprequests.xmlString(tag)..">"..httprequests.xmlString(v).."</"..httprequests.xmlString(tag)..">\n")
-      end
-    end
-  ?>
-  </stats>
 </root>
-- 
Pierre Ynard
"Une âme dans un corps, c'est comme un dessin sur une feuille de papier."


More information about the vlc-devel mailing list