feat: dropped compatibility for mpv 0.32 and below

closes #359
This commit is contained in:
tomasklaen
2023-07-18 18:21:00 +02:00
parent c8ad77a1a9
commit ade1d1f319
29 changed files with 35 additions and 43 deletions

View File

@@ -40,7 +40,7 @@ Most notable features:
_List of all the possible places where it can be located is documented here: https://mpv.io/manual/master/#files_ _List of all the possible places where it can be located is documented here: https://mpv.io/manual/master/#files_
On Linux and macOS these terminal commands can be used to install or update uosc and thumbfast (if wget and unzip are installed): On Linux and macOS these terminal commands can be used to install or update uosc (if wget and unzip are installed):
```sh ```sh
mkdir -pv ~/.config/mpv/script-opts/ mkdir -pv ~/.config/mpv/script-opts/

View File

@@ -221,7 +221,7 @@ chapter_ranges=openings:30abf964,endings:30abf964,ads:c54e4e80
chapter_range_patterns=openings:オープニング;endings:エンディング chapter_range_patterns=openings:オープニング;endings:エンディング
# Localization language priority from highest to lowest. # Localization language priority from highest to lowest.
# Built in languages can be found in `uosc_shared/intl`. # Built in languages can be found in `uosc/intl`.
# `slang` is a keyword to inherit values from `--slang` mpv config. # `slang` is a keyword to inherit values from `--slang` mpv config.
# Supports paths to custom json files: `languages=~~/custom.json,slang,en` # Supports paths to custom json files: `languages=~~/custom.json,slang,en`
languages=slang,en languages=slang,en

View File

@@ -1,4 +1,4 @@
local Element = require('uosc_shared/elements/Element') local Element = require('elements/Element')
---@class BufferingIndicator : Element ---@class BufferingIndicator : Element
local BufferingIndicator = class(Element) local BufferingIndicator = class(Element)

View File

@@ -1,4 +1,4 @@
local Element = require('uosc_shared/elements/Element') local Element = require('elements/Element')
---@alias ButtonProps {icon: string; on_click: function; anchor_id?: string; active?: boolean; badge?: string|number; foreground?: string; background?: string; tooltip?: string} ---@alias ButtonProps {icon: string; on_click: function; anchor_id?: string; active?: boolean; badge?: string|number; foreground?: string; background?: string; tooltip?: string}

View File

@@ -1,7 +1,7 @@
local Element = require('uosc_shared/elements/Element') local Element = require('elements/Element')
local Button = require('uosc_shared/elements/Button') local Button = require('elements/Button')
local CycleButton = require('uosc_shared/elements/CycleButton') local CycleButton = require('elements/CycleButton')
local Speed = require('uosc_shared/elements/Speed') local Speed = require('elements/Speed')
-- `scale` - `options.controls_size` scale factor. -- `scale` - `options.controls_size` scale factor.
-- `ratio` - Width/height ratio of a static or dynamic element. -- `ratio` - Width/height ratio of a static or dynamic element.

View File

@@ -1,4 +1,4 @@
local Element = require('uosc_shared/elements/Element') local Element = require('elements/Element')
---@class Curtain : Element ---@class Curtain : Element
local Curtain = class(Element) local Curtain = class(Element)

View File

@@ -1,4 +1,4 @@
local Button = require('uosc_shared/elements/Button') local Button = require('elements/Button')
---@alias CycleState {value: any; icon: string; active?: boolean} ---@alias CycleState {value: any; icon: string; active?: boolean}
---@alias CycleButtonProps {prop: string; states: CycleState[]; anchor_id?: string; tooltip?: string} ---@alias CycleButtonProps {prop: string; states: CycleState[]; anchor_id?: string; tooltip?: string}

View File

@@ -1,4 +1,4 @@
local Element = require('uosc_shared/elements/Element') local Element = require('elements/Element')
-- Menu data structure accepted by `Menu:open(menu)`. -- Menu data structure accepted by `Menu:open(menu)`.
---@alias MenuData {type?: string; title?: string; hint?: string; keep_open?: boolean; separator?: boolean; items?: MenuDataItem[]; selected_index?: integer;} ---@alias MenuData {type?: string; title?: string; hint?: string; keep_open?: boolean; separator?: boolean; items?: MenuDataItem[]; selected_index?: integer;}

View File

@@ -1,4 +1,4 @@
local Element = require('uosc_shared/elements/Element') local Element = require('elements/Element')
---@class PauseIndicator : Element ---@class PauseIndicator : Element
local PauseIndicator = class(Element) local PauseIndicator = class(Element)

View File

@@ -1,4 +1,4 @@
local Element = require('uosc_shared/elements/Element') local Element = require('elements/Element')
---@alias Dragging { start_time: number; start_x: number; distance: number; speed_distance: number; start_speed: number; } ---@alias Dragging { start_time: number; start_x: number; distance: number; speed_distance: number; start_speed: number; }

View File

@@ -1,4 +1,4 @@
local Element = require('uosc_shared/elements/Element') local Element = require('elements/Element')
---@class Timeline : Element ---@class Timeline : Element
local Timeline = class(Element) local Timeline = class(Element)

View File

@@ -1,4 +1,4 @@
local Element = require('uosc_shared/elements/Element') local Element = require('elements/Element')
---@alias TopBarButtonProps {icon: string; background: string; anchor_id?: string; command: string|fun()} ---@alias TopBarButtonProps {icon: string; background: string; anchor_id?: string; command: string|fun()}

View File

@@ -1,4 +1,4 @@
local Element = require('uosc_shared/elements/Element') local Element = require('elements/Element')
--[[ MuteButton ]] --[[ MuteButton ]]

View File

@@ -1,4 +1,4 @@
local Element = require('uosc_shared/elements/Element') local Element = require('elements/Element')
---@class WindowBorder : Element ---@class WindowBorder : Element
local WindowBorder = class(Element) local WindowBorder = class(Element)

View File

@@ -1,4 +1,4 @@
local intl_dir = '~~/scripts/uosc_shared/intl/' local intl_dir = '~~/scripts/uosc/intl/'
local locale = {} local locale = {}
local cache = {} local cache = {}

View File

@@ -9,10 +9,7 @@ osd = mp.create_osd_overlay('ass-events')
INFINITY = 1e309 INFINITY = 1e309
QUARTER_PI_SIN = math.sin(math.pi / 4) QUARTER_PI_SIN = math.sin(math.pi / 4)
-- Enables relative requires from `scripts` directory require('lib/std')
package.path = package.path .. ';' .. mp.find_config_file('scripts') .. '/?.lua'
require('uosc_shared/lib/std')
--[[ OPTIONS ]] --[[ OPTIONS ]]
@@ -133,7 +130,7 @@ fg, bg = serialize_rgba(options.foreground).color, serialize_rgba(options.backgr
fgt, bgt = serialize_rgba(options.foreground_text).color, serialize_rgba(options.background_text).color fgt, bgt = serialize_rgba(options.foreground_text).color, serialize_rgba(options.background_text).color
--[[ INTERNATIONALIZATION ]] --[[ INTERNATIONALIZATION ]]
local intl = require('uosc_shared/lib/intl') local intl = require('lib/intl')
t = intl.t t = intl.t
--[[ CONFIG ]] --[[ CONFIG ]]
@@ -435,14 +432,14 @@ state = {
thumbnail = {width = 0, height = 0, disabled = false} thumbnail = {width = 0, height = 0, disabled = false}
external = {} -- Properties set by external scripts external = {} -- Properties set by external scripts
key_binding_overwrites = {} -- Table of key_binding:mpv_command key_binding_overwrites = {} -- Table of key_binding:mpv_command
Elements = require('uosc_shared/elements/Elements') Elements = require('elements/Elements')
Menu = require('uosc_shared/elements/Menu') Menu = require('elements/Menu')
-- State dependent utilities -- State dependent utilities
require('uosc_shared/lib/utils') require('lib/utils')
require('uosc_shared/lib/text') require('lib/text')
require('uosc_shared/lib/ass') require('lib/ass')
require('uosc_shared/lib/menus') require('lib/menus')
--[[ STATE UPDATERS ]] --[[ STATE UPDATERS ]]
@@ -1285,11 +1282,11 @@ mp.register_script_message('overwrite-binding', function(name, command) key_bind
--[[ ELEMENTS ]] --[[ ELEMENTS ]]
require('uosc_shared/elements/WindowBorder'):new() require('elements/WindowBorder'):new()
require('uosc_shared/elements/BufferingIndicator'):new() require('elements/BufferingIndicator'):new()
require('uosc_shared/elements/PauseIndicator'):new() require('elements/PauseIndicator'):new()
require('uosc_shared/elements/TopBar'):new() require('elements/TopBar'):new()
require('uosc_shared/elements/Timeline'):new() require('elements/Timeline'):new()
if options.controls and options.controls ~= 'never' then require('uosc_shared/elements/Controls'):new() end if options.controls and options.controls ~= 'never' then require('elements/Controls'):new() end
if itable_index_of({'left', 'right'}, options.volume) then require('uosc_shared/elements/Volume'):new() end if itable_index_of({'left', 'right'}, options.volume) then require('elements/Volume'):new() end
require('uosc_shared/elements/Curtain'):new() require('elements/Curtain'):new()

View File

@@ -1,5 +0,0 @@
--[[
File required for compatibility between mpv:
- 0.32 - doesn't support `dir/main.lua`, so we need `uosc.lua` in root
- 0.33 - requires `main.lua` in directories
]]