Remove timeline_elements option

This commit is contained in:
tomasklaen
2022-08-21 14:14:59 +02:00
parent 78d6dfa137
commit b37082d185
2 changed files with 83 additions and 85 deletions

View File

@@ -27,12 +27,9 @@ timeline_step=5
timeline_cached_ranges=345433:0.8
# floating number font scale adjustment
timeline_font_scale=1
# timeline chapters style: dots, lines, lines-top, lines-bottom
# timeline chapters style: never, dots, lines, lines-top, lines-bottom
timeline_chapters=dots
timeline_chapters_opacity=0.2
# which timeline elements to render, and in what order
# available: ranges,chapters,progress,cache,time
timeline_elements=ranges,chapters,progress,cache,time
# where to display volume controls: none, left, right
volume=right

View File

@@ -34,7 +34,6 @@ local options = {
timeline_font_scale = 1,
timeline_chapters = 'dots',
timeline_chapters_opacity = 0.2,
timeline_elements = 'ranges,chapters,progress,cache,time',
volume = 'right',
volume_size = 40,
@@ -1499,10 +1498,14 @@ function render_timeline(this)
-- Chapters
local function render_chapters()
if (
state.chapters ~= nil and #state.chapters > 0
or state.ab_loop_a and state.ab_loop_a > 0
or state.ab_loop_b and state.ab_loop_b > 0
) then
options.timeline_chapters == 'never'
or (
(state.chapters == nil or #state.chapters == 0)
and state.ab_loop_a == nil
and state.ab_loop_b == nil
)
) then return end
local dots = false
local chapter_size, chapter_y
if options.timeline_chapters == 'dots' then
@@ -1571,7 +1574,6 @@ function render_timeline(this)
end
end
end
end
-- Seekable ranges
local function render_cache()
@@ -1642,19 +1644,19 @@ function render_timeline(this)
end
end
-- Render requested elements
local element_renderers = {
ranges = render_ranges,
chapters = render_chapters,
progress = render_progress,
cache = render_cache,
time = render_time,
}
local rendered_chapters = false
for _, name in ipairs(options.timeline_elements) do
if name == 'chapters' then rendered_chapters = true end
if element_renderers[name] ~= nil then element_renderers[name]() end
-- Render elements in the optimal order
if is_line and size > size_min then
render_ranges()
render_chapters()
render_progress()
render_cache()
render_time()
else
render_progress()
render_ranges()
render_chapters()
render_cache()
render_time()
end
-- Hovered time and chapter
@@ -1662,7 +1664,7 @@ function render_timeline(this)
local hovered_seconds = state.duration * (cursor.x / display.width)
local chapter_title = ''
local chapter_title_width = 0
if (rendered_chapters and state.chapters) then
if (options.timeline_chapters ~= 'never' and state.chapters) then
for i = #state.chapters, 1, -1 do
local chapter = state.chapters[i]
if hovered_seconds >= chapter.time then
@@ -3208,11 +3210,10 @@ end
-- VALUE SERIALIZATION/NORMALIZATION
options.proximity_out = math.max(options.proximity_out, options.proximity_in + 1)
options.timeline_chapters = itable_find({'dots', 'lines', 'lines-top', 'lines-bottom'}, options.timeline_chapters) and options.timeline_chapters or 'dots'
options.timeline_chapters = itable_find({'dots', 'lines', 'lines-top', 'lines-bottom'}, options.timeline_chapters) and options.timeline_chapters or 'never'
options.media_types = split(options.media_types, ' *, *')
options.subtitle_types = split(options.subtitle_types, ' *, *')
options.stream_quality_options = split(options.stream_quality_options, ' *, *')
options.timeline_elements = split(options.timeline_elements, ' *, *')
options.timeline_cached_ranges = (function()
if options.timeline_cached_ranges == '' or options.timeline_cached_ranges == 'no' then return nil end
local parts = split(options.timeline_cached_ranges, ':')