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

luarc: fix #4282

(cherry picked from commit cf6e402bb8b506a816fda71cea0afe1b90d3af4b)
Signed-off-by: default avatarRémi Duraffort <ivoire@videolan.org>
parent 72aaed31
......@@ -404,12 +404,26 @@ function titlechap(name,client,value)
client:append(item)
end
end
function titlechap_offset(client,offset)
return function(name,value)
function titlechap_offset(var,offset)
local input = vlc.object.input()
local var = string.gsub( name, "_.*$", "" )
vlc.var.set( input, var, vlc.var.get( input, var )+offset )
end
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" } };
......
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