]> git.sesse.net Git - vlc/commitdiff
luahttp: fix service discovery loading.
authorRémi Duraffort <ivoire@videolan.org>
Mon, 5 Apr 2010 09:35:18 +0000 (11:35 +0200)
committerRémi Duraffort <ivoire@videolan.org>
Mon, 5 Apr 2010 09:35:18 +0000 (11:35 +0200)
share/lua/http/dialogs/playlist
share/lua/http/js/functions.js
share/lua/http/requests/status.xml

index cf3f58a2d0b17155a162efdf8ca21c353bcb3ccb..01814cce87c77f552cf889ca140e89d474ed36df 100644 (file)
@@ -83,7 +83,13 @@ This dialog needs the following dialogs to be fully functional: <none>
           <?vlc
             local sd = vlc.sd.get_services_names()
             for n,ln in pairs(sd) do
-              print([[<button onclick="pl_sd(']]..n..[[');hide_menu('menu_sd');" onmouseover="setclass(this,'menuover');" onmouseout="setclass(this,'menuout');" class="menuout" title="Toggle ]]..ln..[[" >]]..ln..[[</button><br/>]])
+                local sdname = string.gsub(n, "([^{]*)({.*)", "%1")
+                local islua = 0
+                if(sdname == "lua") then
+                    sdname = string.gsub(n, "(lua{sd=')([^']*)'(.*)", "%2")
+                    islua = 1
+                end
+              print([[<button class="menuout" onclick='pl_sd("]]..sdname..[[", "]]..islua..[[");hide_menu("menu_sd");' onmouseover="setclass(this,'menuover');" onmouseout="setclass(this,'menuout');" class="menuout" title="Toggle ]]..ln..[[" >]]..ln..[[</button><br/>]])
             end
           ?>
           </div>
index fc0ed9246aaed640fd10df3bc12918f1315a55ee..d75aa16e11e70330fc1dedae67eff0eb01838cfe 100644 (file)
@@ -360,9 +360,9 @@ function pl_repeat()
 {
     loadXMLDoc( 'requests/status.xml?command=pl_repeat', parse_status );
 }
-function pl_sd( value )
+function pl_sd( value, islua )
 {
-    loadXMLDoc( 'requests/status.xml?command=pl_sd&val='+value, parse_status );
+    loadXMLDoc( 'requests/status.xml?command=pl_sd&val='+value+'&islua='+islua, parse_status );
 }
 
 /* misc actions */
index f4fc486bd6b1ba2743957ff86c7a39da952f0429..17c76df1d281483208d60300cc300ec19ba116da 100644 (file)
@@ -79,10 +79,15 @@ elseif command == "pl_loop" then
 elseif command == "pl_repeat" then
   vlc.playlist.repeat_()
 elseif command == "pl_sd" then
-  if vlc.sd.is_loaded(val) then
-    vlc.sd.remove(val)
+  if(_GET['islua'] == "1") then
+    sdname = "lua{sd='" .. val .. "'}"
   else
-    vlc.sd.add(val)
+    sdname = val
+  end
+  if vlc.sd.is_loaded(sdname) then
+    vlc.sd.remove(sdname)
+  else
+    vlc.sd.add(sdname)
   end
 elseif command == "fullscreen" then
   vlc.fullscreen()