]> git.sesse.net Git - vlc/blobdiff - share/lua/http/requests/status.xml
LUA HTTP Interface: If <id> is omitted at the status.xml play command, play last...
[vlc] / share / lua / http / requests / status.xml
index 328e65f8f360e1214383e8beafd3c92942c2e05e..6581c80cdf6797341bb4a9549dfb3254786dfbeb 100644 (file)
@@ -4,7 +4,7 @@ vim:syntax=lua
 <!--  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
 <  status.xml: VLC media player web interface
 < - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - >
-<  Copyright (C) 2005-2006 the VideoLAN team
+<  Copyright (C) 2005-2009 the VideoLAN team
 <  $Id$
 < 
 <  Authors: Antoine Cellerier <dionoea -at- videolan -dot- org>
@@ -44,7 +44,7 @@ end
 local status = vlc.playlist.status()
 
 if command == "in_play" then
-  ---[[
+  --[[
   vlc.msg.err( "<options>" )
   for a,b in ipairs(options) do
     vlc.msg.err(b)
@@ -55,10 +55,13 @@ if command == "in_play" then
 elseif command == "in_enqueue" then
   vlc.playlist.enqueue({{path=stripslashes(input),options=options}})
 elseif command == "pl_play" then
-  vlc.playlist.goto(id)
+  if id == -1 then
+    vlc.playlist.play()
+  else
+    vlc.playlist.goto(id)
+  end
 elseif command == "pl_pause" then
-  vlc.msg.err("FIXME: pl_pause implementation is ugly")
-  common.hotkey("key-play-pause") -- gruik
+  vlc.playlist.pause()
 elseif command == "pl_stop" then
   vlc.playlist.stop()
 elseif command == "pl_next" then
@@ -85,11 +88,11 @@ elseif command == "pl_sd" then
     vlc.sd.add(val)
   end
 elseif command == "fullscreen" then
-  vlc.fullscreen()
+  vlc.video.fullscreen()
 elseif command == "snapshot" then
   common.snapshot()
 elseif command == "volume" then
-  vlc.volume.set(tonumber(val))
+  common.volume(val)
 elseif command == "seek" then
   common.seek(val)
 elseif command == "key" then
@@ -102,13 +105,14 @@ local id = nil
 local val = nil
 
 local input = vlc.object.input()
+local item = vlc.input.item()
 local playlist = vlc.object.playlist()
 local vout = input and vlc.object.find(input,'vout','child')
 ?>
 <root>
   <volume><?vlc print(vlc.volume.get()) ?></volume>
-  <length><?vlc if input then print(vlc.var.get(input,"length")) else print(0) end?></length>
-  <time><?vlc if input then print(vlc.var.get(input,"time")) else print(0) end?></time>
+  <length><?vlc if input then print(math.floor(vlc.var.get(input,"length"))) else print(0) end?></length>
+  <time><?vlc if input then print(math.floor(vlc.var.get(input,"time"))) else print(0) end?></time>
   <state><?vlc print(status) ?></state>
   <position><?vlc if input then print(vlc.var.get(input,"position")) else print(0) end?></position>
   <fullscreen><?vlc if vout then vlc.var.get(vout,"fullscreen") else print(0) end?></fullscreen>
@@ -118,8 +122,8 @@ local vout = input and vlc.object.find(input,'vout','child')
   <information>
     <category name="meta">
     <?vlc
-      if input then
-        local metas = vlc.input.metas()
+      if item then
+        local metas = item:metas()
         for k,v in pairs(metas) do
           print("<info name='"..k.."'>"..vlc.strings.convert_xml_special_chars(v).."</info>")
         end
@@ -127,8 +131,8 @@ local vout = input and vlc.object.find(input,'vout','child')
     ?>
     </category>
   <?vlc
-    if input then
-      local info = vlc.input.info()
+    if item then
+      local info = item:info()
       for k, v in pairs(info) do
         print("<category name='"..k.."'>")
           for k2, v2 in pairs(v) do
@@ -141,8 +145,8 @@ local vout = input and vlc.object.find(input,'vout','child')
   </information>
   <stats>
   <?vlc
-    if input then
-      local stats = vlc.input.stats()
+    if item then
+      local stats = item:stats()
       for k,v in pairs(stats) do
         local tag = string.gsub(k,"_","")
         print("<"..tag..">"..tostring(v).."</"..tag..">\n")