Commit 2d3320dc authored by Antoine Cellerier's avatar Antoine Cellerier

Add option to use a flat playlist in the rc.lua interface (default disabled).

parent 3f32e82e
...@@ -50,6 +50,7 @@ description= ...@@ -50,6 +50,7 @@ description=
1 to enable). 1 to enable).
* autoalias: If autocompletion returns only one possibility, use it * autoalias: If autocompletion returns only one possibility, use it
(0 to disable, 1 to enable). (0 to disable, 1 to enable).
* flatplaylist: 0 to disable, 1 to enable.
]============================================================================] ]============================================================================]
require("common") require("common")
...@@ -63,7 +64,8 @@ env = { prompt = "> "; ...@@ -63,7 +64,8 @@ env = { prompt = "> ";
width = 70; width = 70;
autocompletion = 1; autocompletion = 1;
autoalias = 1; autoalias = 1;
welcome = "Remote control interface initialized. Type `help' for help." welcome = "Remote control interface initialized. Type `help' for help.";
flatplaylist = 0;
} }
--[[ Import custom environement variables from the command line config (if possible) ]] --[[ Import custom environement variables from the command line config (if possible) ]]
...@@ -163,6 +165,14 @@ function add(name,client,arg) ...@@ -163,6 +165,14 @@ function add(name,client,arg)
f({{path=arg}}) f({{path=arg}})
end end
function playlist_is_tree( client )
if client.env.flatplaylist == 0 then
return true
else
return false
end
end
function playlist(name,client,arg) function playlist(name,client,arg)
function playlist0(item,prefix) function playlist0(item,prefix)
local prefix = prefix or "" local prefix = prefix or ""
...@@ -187,17 +197,19 @@ function playlist(name,client,arg) ...@@ -187,17 +197,19 @@ function playlist(name,client,arg)
end end
end end
local playlist local playlist
local tree = playlist_is_tree(client)
print("tree",tree)
if name == "search" then if name == "search" then
playlist = vlc.playlist.search(arg or "") playlist = vlc.playlist.search(arg or "", tree)
else else
if tonumber(arg) then if tonumber(arg) then
print "number" print "number"
playlist = vlc.playlist.get(tonumber(arg)) playlist = vlc.playlist.get(tonumber(arg), tree)
elseif arg then elseif arg then
print "string" print "string"
playlist = vlc.playlist.get(arg) playlist = vlc.playlist.get(arg, tree)
else else
playlist = vlc.playlist.get() playlist = vlc.playlist.get(nil, tree)
end end
end end
if name == "search" then if name == "search" then
...@@ -223,7 +235,8 @@ function playlist_sort(name,client,arg) ...@@ -223,7 +235,8 @@ function playlist_sort(name,client,arg)
if not arg then if not arg then
client:append("Valid sort keys are: id, title, artist, genre, random, duration, album.") client:append("Valid sort keys are: id, title, artist, genre, random, duration, album.")
else else
vlc.playlist.sort(arg) local tree = playlist_is_tree(client)
vlc.playlist.sort(arg,false,tree)
end end
end end
......
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