Commit cf6e402b authored by Rémi Duraffort's avatar Rémi Duraffort

luarc: fix #4282

parent f7520eb1
...@@ -404,12 +404,26 @@ function titlechap(name,client,value) ...@@ -404,12 +404,26 @@ function titlechap(name,client,value)
client:append(item) client:append(item)
end end
end end
function titlechap_offset(client,offset)
return function(name,value) function titlechap_offset(var,offset)
local input = vlc.object.input() local input = vlc.object.input()
local var = string.gsub( name, "_.*$", "" ) vlc.var.set( input, var, vlc.var.get( input, var ) + offset )
vlc.var.set( input, var, vlc.var.get( input, var )+offset ) end
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 end
function seek(name,client,value) function seek(name,client,value)
...@@ -502,11 +516,11 @@ commands_ordered = { ...@@ -502,11 +516,11 @@ commands_ordered = {
{ "clear"; { func = skip2(vlc.playlist.clear); help = "clear the playlist" } }; { "clear"; { func = skip2(vlc.playlist.clear); help = "clear the playlist" } };
{ "status"; { func = playlist_status; help = "current playlist status" } }; { "status"; { func = playlist_status; help = "current playlist status" } };
{ "title"; { func = titlechap; args = "[X]"; help = "set/get title in current item" } }; { "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_n"; { func = title_next; help = "next title in current item" } };
{ "title_p"; { func = titlechap_offset(-1); help = "previous 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"; { func = titlechap; args = "[X]"; help = "set/get chapter in current item" } };
{ "chapter_n"; { func = titlechap_offset(1); help = "next chapter in current item" } }; { "chapter_n"; { func = chapter_next; help = "next chapter in current item" } };
{ "chapter_p"; { func = titlechap_offset(-1); help = "previous 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'" } }; { "seek"; { func = seek; args = "X"; help = "seek in seconds, for instance `seek 12'" } };
{ "pause"; { func = skip2(vlc.playlist.pause); help = "toggle pause" } }; { "pause"; { func = skip2(vlc.playlist.pause); help = "toggle pause" } };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment