[vlc-commits] commit: luarc: fix #4282 ( Rémi Duraffort )

git at videolan.org git at videolan.org
Sat Oct 30 19:35:15 CEST 2010


vlc/vlc-1.1 | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sat Oct 30 19:20:53 2010 +0200| [dac4e6a9590359ac78a480f2b7967e5086697aaf] | committer: Rémi Duraffort 

luarc: fix #4282
(cherry picked from commit cf6e402bb8b506a816fda71cea0afe1b90d3af4b)

Signed-off-by: Rémi Duraffort <ivoire at videolan.org>

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

 share/lua/intf/rc.lua |   34 ++++++++++++++++++++++++----------
 1 files changed, 24 insertions(+), 10 deletions(-)

diff --git a/share/lua/intf/rc.lua b/share/lua/intf/rc.lua
index 0eac503..1690da8 100644
--- a/share/lua/intf/rc.lua
+++ b/share/lua/intf/rc.lua
@@ -404,12 +404,26 @@ function titlechap(name,client,value)
         client:append(item)
     end
 end
-function titlechap_offset(client,offset)
-    return function(name,value)
-        local input = vlc.object.input()
-        local var = string.gsub( name, "_.*$", "" )
-        vlc.var.set( input, var, vlc.var.get( input, var )+offset )
-    end
+
+function titlechap_offset(var,offset)
+    local input = vlc.object.input()
+    vlc.var.set( input, var, vlc.var.get( input, var ) + offset )
+end
+
+function title_next(name,client,value)
+    titlechap_offset('title', 1)
+end
+
+function title_previous(name,client,value)
+    titlechap_offset('title', -1)
+end
+
+function chapter_next(name,client,value)
+    titlechap_offset('chapter', 1)
+end
+
+function chapter_previous(name,client,value)
+    titlechap_offset('chapter', -1)
 end
 
 function seek(name,client,value)
@@ -502,11 +516,11 @@ commands_ordered = {
     { "clear"; { func = skip2(vlc.playlist.clear); help = "clear the playlist" } };
     { "status"; { func = playlist_status; help = "current playlist status" } };
     { "title"; { func = titlechap; args = "[X]"; help = "set/get title in current item" } };
-    { "title_n"; { func = titlechap_offset(1); help = "next title in current item" } };
-    { "title_p"; { func = titlechap_offset(-1); help = "previous title in current item" } };
+    { "title_n"; { func = title_next; help = "next title in current item" } };
+    { "title_p"; { func = title_previous; help = "previous title in current item" } };
     { "chapter"; { func = titlechap; args = "[X]"; help = "set/get chapter in current item" } };
-    { "chapter_n"; { func = titlechap_offset(1); help = "next chapter in current item" } };
-    { "chapter_p"; { func = titlechap_offset(-1); help = "previous chapter in current item" } };
+    { "chapter_n"; { func = chapter_next; help = "next chapter in current item" } };
+    { "chapter_p"; { func = chapter_previous; help = "previous chapter in current item" } };
     { "" };
     { "seek"; { func = seek; args = "X"; help = "seek in seconds, for instance `seek 12'" } };
     { "pause"; { func = skip2(vlc.playlist.pause); help = "toggle pause" } };



More information about the vlc-commits mailing list