|
|
@ -60,6 +60,72 @@ return screen:new { |
|
|
|
} |
|
|
|
} |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local enqueue_fs_iterator = function(it) |
|
|
|
|
|
|
|
local cnt = 0 |
|
|
|
|
|
|
|
while true do |
|
|
|
|
|
|
|
it:next() |
|
|
|
|
|
|
|
local item = it:value() |
|
|
|
|
|
|
|
if item == nil then |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not item:is_directory() and not playlist_iterator:is_playlist(item) and playback.is_playable(item:filepath()) then |
|
|
|
|
|
|
|
queue.add(item:filepath()) |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- safety |
|
|
|
|
|
|
|
cnt = cnt + 1 |
|
|
|
|
|
|
|
if cnt > 1000 then |
|
|
|
|
|
|
|
break |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- copied from browser.lua |
|
|
|
|
|
|
|
local buttons = header:Object({ |
|
|
|
|
|
|
|
flex = { |
|
|
|
|
|
|
|
flex_direction = "row", |
|
|
|
|
|
|
|
flex_wrap = "wrap", |
|
|
|
|
|
|
|
justify_content = "space-between", |
|
|
|
|
|
|
|
align_items = "center", |
|
|
|
|
|
|
|
align_content = "center" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
w = lvgl.PCT(100), |
|
|
|
|
|
|
|
h = lvgl.SIZE_CONTENT, |
|
|
|
|
|
|
|
pad_column = 4 |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
local original_iterator = self.iterator:clone() |
|
|
|
|
|
|
|
local enqueue = widgets.IconBtn(buttons, img.enqueue, "Enqueue") |
|
|
|
|
|
|
|
enqueue:onClicked(function() |
|
|
|
|
|
|
|
-- queue.add(original_iterator) |
|
|
|
|
|
|
|
enqueue_fs_iterator(original_iterator) |
|
|
|
|
|
|
|
playback.playing:set(true) |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
local shuffle_play = widgets.IconBtn(buttons, img.shuffleplay, "Shuffle") |
|
|
|
|
|
|
|
shuffle_play:onClicked(function() |
|
|
|
|
|
|
|
queue.clear() |
|
|
|
|
|
|
|
queue.random:set(true) |
|
|
|
|
|
|
|
--queue.add(original_iterator) |
|
|
|
|
|
|
|
enqueue_fs_iterator(original_iterator) |
|
|
|
|
|
|
|
playback.playing:set(true) |
|
|
|
|
|
|
|
backstack.push(playing:new()) |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
-- enqueue:add_flag(lvgl.FLAG.HIDDEN) |
|
|
|
|
|
|
|
local play = widgets.IconBtn(buttons, img.play_small, "Play") |
|
|
|
|
|
|
|
play:onClicked(function() |
|
|
|
|
|
|
|
queue.clear() |
|
|
|
|
|
|
|
queue.random:set(false) |
|
|
|
|
|
|
|
--queue.add(original_iterator) |
|
|
|
|
|
|
|
enqueue_fs_iterator(original_iterator) |
|
|
|
|
|
|
|
playback.playing:set(true) |
|
|
|
|
|
|
|
backstack.push(playing:new()) |
|
|
|
|
|
|
|
end) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
local get_icon_func = function(item) |
|
|
|
local get_icon_func = function(item) |
|
|
|
if item:is_directory() then |
|
|
|
if item:is_directory() then |
|
|
|
return img.file_directory |
|
|
|
return img.file_directory |
|
|
|