Skip to content

Commit

Permalink
Document options, and add a common to explicity write flags
Browse files Browse the repository at this point in the history
  • Loading branch information
occivink committed Sep 29, 2018
1 parent c2ba38b commit e2738e9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 8 additions & 0 deletions script-opts/gallery.conf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,13 @@ strip_extension=yes
# size of the text. The up-down margin will be expanded if needed
text_size=28

# color of the frames
selected_frame_color=DDDDDD
flagged_frame_color=5B9769
selected_flagged_frame_color=BAFFCA
# path of the text file containing the paths of the flagged files
flagged_file_path=./mpv_gallery_flagged

# maximum generators, could be useful with different profiles (not sure how)
max_generators=8

Expand All @@ -100,6 +107,7 @@ RANDOM=r
CANCEL=ESC
# simply removes entry from playlist, not the file
REMOVE=DEL
FLAG=SPACE

# vim-style version
#UP=k
Expand Down
9 changes: 6 additions & 3 deletions scripts/gallery.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ local opts = {
selected_frame_color = "DDDDDD",
flagged_frame_color = "5B9769",
selected_flagged_frame_color = "BAFFCA",
flagged_file_path = "./mpv_flagged",
flagged_file_path = "./mpv_gallery_flagged",

max_generators = 8,

Expand Down Expand Up @@ -748,14 +748,16 @@ mp.register_script_message("thumbnails-generator-broadcast", function(generator_
generators[#generators + 1] = generator_name
end)

mp.register_event("shutdown", function()
function write_flag_file()
if next(flags) == nil then return end
local out = io.open(opts.flagged_file_path, "w")
for f, _ in pairs(flags) do
out:write(f .. "\n")
end
out:close()
end)
end

mp.register_event("shutdown", write_flag_file)

if opts.start_gallery_on_file_end then
mp.register_event("end-file", function()
Expand All @@ -766,3 +768,4 @@ if opts.start_gallery_on_file_end then
end

mp.add_key_binding("g", "gallery-view", toggle_gallery)
mp.add_key_binding(nil, "gallery-write-flag-file", write_flag_file)

0 comments on commit e2738e9

Please sign in to comment.