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

Pierre Ynard git at videolan.org
Mon Aug 31 20:46:02 CEST 2020


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Mon Aug 31 20:44:40 2020 +0200| [8c5ae08331c85d827c50d7733fbae43c5690f5ed] | committer: Pierre Ynard

lua/http: avoid diverging legacy code to print status.xml

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

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

 share/lua/http/requests/status.xml | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/share/lua/http/requests/status.xml b/share/lua/http/requests/status.xml
index fec2d9d383..67b8ddf944 100644
--- a/share/lua/http/requests/status.xml
+++ b/share/lua/http/requests/status.xml
@@ -33,17 +33,25 @@ 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
+    if information then
+      httprequests.printTableAsXml(information,2)
+    end
+  ?>
     <category name="meta">
     <?vlc
       if item then
@@ -68,15 +76,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>



More information about the vlc-commits mailing list