]> git.sesse.net Git - vlc/blobdiff - share/lua/intf/rc.lua
Galician l10n for vlc.desktop
[vlc] / share / lua / intf / rc.lua
index c02d0a917252906c8a1e7c998e57cb014b446ad7..0eac503f1955ac13e898ee65a3e8a362ed14dd28 100644 (file)
@@ -61,12 +61,15 @@ skip2 = function(foo) return skip(skip(foo)) end
 setarg = common.setarg
 strip = common.strip
 
+_ = vlc.gettext._
+N_ = vlc.gettext.N_
+
 --[[ Setup default environement ]]
 env = { prompt = "> ";
         width = 70;
         autocompletion = 1;
         autoalias = 1;
-        welcome = "Remote control interface initialized. Type `help' for help.";
+        welcome = _("Remote control interface initialized. Type `help' for help.");
         flatplaylist = 0;
       }
 
@@ -157,7 +160,7 @@ function quit(name,client)
 end
 
 function add(name,client,arg)
-    -- TODO: par single and double quotes properly
+    -- TODO: parse single and double quotes properly
     local f
     if name == "enqueue" then
         f = vlc.playlist.enqueue
@@ -310,7 +313,9 @@ function help(name,client,arg)
 end
 
 function input_info(name,client)
-    local categories = vlc.input.info()
+    local item = vlc.input.item()
+    if(item == nil) then return end
+    local categories = item:info()
     for cat, infos in pairs(categories) do
         client:append("+----[ "..cat.." ]")
         client:append("|")
@@ -323,14 +328,16 @@ function input_info(name,client)
 end
 
 function stats(name,client)
-    local stats_tab = vlc.input.stats()
+    local item = vlc.input.item()
+    if(item == nil) then return end
+    local stats_tab = item:stats()
 
     client:append("+----[ begin of statistical info")
     client:append("+-[Incoming]")
-    client:append("| input bytes read : "..string.format("%8.0f kB",stats_tab["read_bytes"]/1000))
-    client:append("| input bitrate    :   "..string.format("%6.0f bB/s",stats_tab["input_bitrate"]*8000))
-    client:append("| demux bytes read : "..string.format("%8.0f kB",stats_tab["demux_read_bytes"]/1000))
-    client:append("| demux bitrate    :   "..string.format("%6.0f kB/s",stats_tab["demux_bitrate"]*8000))
+    client:append("| input bytes read : "..string.format("%8.0f KiB",stats_tab["read_bytes"]/1024))
+    client:append("| input bitrate    :   "..string.format("%6.0f kb/s",stats_tab["input_bitrate"]*8000))
+    client:append("| demux bytes read : "..string.format("%8.0f KiB",stats_tab["demux_read_bytes"]/1024))
+    client:append("| demux bitrate    :   "..string.format("%6.0f kb/s",stats_tab["demux_bitrate"]*8000))
     client:append("| demux corrupted  :    "..string.format("%5i",stats_tab["demux_corrupted"]))
     client:append("| discontinuities  :    "..string.format("%5i",stats_tab["demux_discontinuity"]))
     client:append("|")
@@ -346,13 +353,16 @@ function stats(name,client)
     client:append("|")
     client:append("+-[Streaming]")
     client:append("| packets sent     :    "..string.format("%5i",stats_tab["sent_packets"]))
-    client:append("| bytes sent       : "..string.format("%8.0f kB",stats_tab["sent_bytes"]/1000))
+    client:append("| bytes sent       : "..string.format("%8.0f KiB",stats_tab["sent_bytes"]/1024))
     client:append("| sending bitrate  :   "..string.format("%6.0f kb/s",stats_tab["send_bitrate"]*8000))
     client:append("+----[ end of statistical info ]")
 end
 
 function playlist_status(name,client)
-    client:append( "( new input: " .. "FIXME" .. " )" )
+    local item = vlc.input.item()
+    if(item ~= nil) then
+        client:append( "( new input: " .. vlc.strings.decode_uri(item:uri()) .. " )" )
+    end
     client:append( "( audio volume: " .. tostring(vlc.volume.get()) .. " )")
     client:append( "( state " .. vlc.playlist.status() .. " )")
 end
@@ -361,6 +371,15 @@ function is_playing(name,client)
     if vlc.input.is_playing() then client:append "1" else client:append "0" end
 end
 
+function get_title(name,client)
+    local item = vlc.input.item()
+    if item then
+        client:append(item:name())
+    else
+        client:append("")
+    end
+end
+
 function ret_print(foo,start,stop)
     local start = start or ""
     local stop = stop or ""
@@ -490,7 +509,7 @@ commands_ordered = {
     { "chapter_p"; { func = titlechap_offset(-1); help = "previous chapter in current item" } };
     { "" };
     { "seek"; { func = seek; args = "X"; help = "seek in seconds, for instance `seek 12'" } };
-    { "pause"; { func = setarg(common.hotkey,"key-play-pause"); help = "toggle pause" } };
+    { "pause"; { func = skip2(vlc.playlist.pause); help = "toggle pause" } };
     { "fastforward"; { func = setarg(common.hotkey,"key-jump+extrashort"); help = "set to maximum rate" } };
     { "rewind"; { func = setarg(common.hotkey,"key-jump-extrashort"); help = "set to minimum rate" } };
     { "faster"; { func = rate; help = "faster playing of stream" } };
@@ -503,7 +522,7 @@ commands_ordered = {
     { "stats"; { func = stats; help = "show statistical information" } };
     { "get_time"; { func = get_time("time"); help = "seconds elapsed since stream's beginning" } };
     { "is_playing"; { func = is_playing; help = "1 if a stream plays, 0 otherwise" } };
-    { "get_title"; { func = ret_print(vlc.input.get_title); help = "the title of the current stream" } };
+    { "get_title"; { func = get_title; help = "the title of the current stream" } };
     { "get_length"; { func = get_time("length"); help = "the length of the current stream" } };
     { "" };
     { "volume"; { func = volume; args = "[X]"; help = "set/get audio volume" } };
@@ -648,8 +667,7 @@ h:listen( config.hosts or config.host or "*console" )
 
 --[[ The main loop ]]
 while not vlc.misc.should_die() do
-    h:accept()
-    local write, read = h:select(0.1)
+    local write, read = h:accept_and_select()
 
     for _, client in pairs(write) do
         local len = client:send()