Stage new submodule locations
This commit is contained in:
3
submodules/ModernZ/extras/locale/README.md
Normal file
3
submodules/ModernZ/extras/locale/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
The different locales (languages) for ModernZ OSC are stored within the [modernz-locale.json](/extras/locale/modernz-locale.json) file.
|
||||
|
||||
For more information: [Translations](/docs/TRANSLATIONS.md)
|
||||
226
submodules/ModernZ/extras/locale/modernz-locale.json
Normal file
226
submodules/ModernZ/extras/locale/modernz-locale.json
Normal file
@@ -0,0 +1,226 @@
|
||||
{
|
||||
"fr": {
|
||||
"idle": "Déposez des fichiers ou des URLs ici pour les lire",
|
||||
"na": "Non disponible",
|
||||
"video": "Vidéo",
|
||||
"audio": "Audio",
|
||||
"subtitle": "Sous-titre",
|
||||
"no_subs": "Aucun sous-titre disponible",
|
||||
"no_audio": "Aucune piste audio disponible",
|
||||
"playlist": "Liste de lecture",
|
||||
"no_playlist": "Liste de lecture vide",
|
||||
"chapter": "Chapitre",
|
||||
"ontop": "Épingler la fenêtre",
|
||||
"ontop_disable": "Désépingler la fenêtre",
|
||||
"loop_enable": "Activer la boucle",
|
||||
"loop_disable": "Désactiver la boucle",
|
||||
"speed_control": "Contrôle de la vitesse",
|
||||
"screenshot": "Capture d'écran",
|
||||
"stats_info": "Informations",
|
||||
"cache": "Cache",
|
||||
"buffering": "Chargement",
|
||||
"zoom_in": "Agrandir",
|
||||
"zoom_out": "Rétrécir",
|
||||
"download": "Télécharger",
|
||||
"download_in_progress": "Téléchargement en cours",
|
||||
"downloading": "Téléchargement",
|
||||
"downloaded": "Déjà téléchargé",
|
||||
"menu": "Menu",
|
||||
},
|
||||
"de": {
|
||||
"idle": "Dateien oder URLs hier ablegen, um sie abzuspielen",
|
||||
"na": "Nicht verfügbar",
|
||||
"video": "Video",
|
||||
"audio": "Audio",
|
||||
"subtitle": "Untertitel",
|
||||
"no_subs": "Keine Untertitel verfügbar",
|
||||
"no_audio": "Keine Audiospuren verfügbar",
|
||||
"playlist": "Wiedergabeliste",
|
||||
"no_playlist": "Wiedergabeliste ist leer",
|
||||
"chapter": "Kapitel",
|
||||
"ontop": "Fenster fixieren",
|
||||
"ontop_disable": "Fensterfixierung aufheben",
|
||||
"loop_enable": "Dauerschleife aktivieren",
|
||||
"loop_disable": "Dauerschleife deaktivieren",
|
||||
"speed_control": "Geschwindigkeitseinstellungen",
|
||||
"screenshot": "Bildschirmaufnahme",
|
||||
"stats_info": "Informationen",
|
||||
"cache": "Zwischenspeicher",
|
||||
"buffering": "Pufferung",
|
||||
"zoom_in": "Vergrößern",
|
||||
"zoom_out": "Verkleinern",
|
||||
"download": "Herunterladen",
|
||||
"download_in_progress": "Herunterladen läuft",
|
||||
"downloading": "Herunterladen",
|
||||
"downloaded": "Bereits heruntergeladen",
|
||||
"menu": "Menü",
|
||||
},
|
||||
"es": {
|
||||
"idle": "Suelta archivos o URLs aquí para reproducirlos",
|
||||
"na": "No disponible",
|
||||
"video": "Video",
|
||||
"audio": "Audio",
|
||||
"subtitle": "Subtítulo",
|
||||
"no_subs": "No hay subtítulos disponibles",
|
||||
"no_audio": "No hay pistas de audio disponibles",
|
||||
"playlist": "Lista de reproducción",
|
||||
"no_playlist": "La lista de reproducción está vacía",
|
||||
"chapter": "Capítulo",
|
||||
"ontop": "Fijar ventana",
|
||||
"ontop_disable": "Desfijar ventana",
|
||||
"loop_enable": "Activar bucle",
|
||||
"loop_disable": "Desactivar bucle",
|
||||
"speed_control": "Control de velocidad",
|
||||
"screenshot": "Captura de pantalla",
|
||||
"stats_info": "Información",
|
||||
"cache": "Caché",
|
||||
"buffering": "Cargando",
|
||||
"zoom_in": "Ampliar",
|
||||
"zoom_out": "Reducir",
|
||||
"download": "Descargar",
|
||||
"download_in_progress": "Descarga en curso",
|
||||
"downloading": "Descargando",
|
||||
"downloaded": "Ya descargado",
|
||||
"menu": "Menú",
|
||||
},
|
||||
"pl": {
|
||||
"idle": "Upuść plik lub łącze URL do odtworzenia",
|
||||
"na": "Niedostępne",
|
||||
"video": "Wideo",
|
||||
"audio": "Audio",
|
||||
"subtitle": "Napisy",
|
||||
"no_subs": "Brak dostępnych napisów",
|
||||
"no_audio": "Brak dostępnych ścieżek dźwiękowych",
|
||||
"playlist": "Lista odtwarzania",
|
||||
"no_playlist": "Lista odtwarzania jest pusta",
|
||||
"chapter": "Rozdział",
|
||||
"ontop": "Przypnij okno",
|
||||
"ontop_disable": "Odepnij okno",
|
||||
"loop_enable": "Włącz zapętlenie",
|
||||
"loop_disable": "Wyłącz zapętlenie",
|
||||
"speed_control": "Kontrola prędkości",
|
||||
"screenshot": "Zrzut ekranu",
|
||||
"stats_info": "Informacja",
|
||||
"cache": "Pamięć podręczna",
|
||||
"buffering": "Buforowanie",
|
||||
"zoom_in": "Powiększ",
|
||||
"zoom_out": "Pomniejsz",
|
||||
"download": "Pobierz",
|
||||
"download_in_progress": "Pobieranie w toku",
|
||||
"downloading": "Pobieranie",
|
||||
"downloaded": "Już pobrano",
|
||||
"menu": "Menu",
|
||||
},
|
||||
"jp": {
|
||||
"idle": "ファイルやURLのリンクをここにドロップすると再生されます",
|
||||
"na": "利用できません",
|
||||
"video": "ビデオ",
|
||||
"audio": "オーディオ",
|
||||
"subtitle": "字幕",
|
||||
"no_subs": "利用可能な字幕はありません",
|
||||
"no_audio": "オーディオトラックはありません",
|
||||
"playlist": "プレイリスト",
|
||||
"no_playlist": "プレイリストは空です",
|
||||
"chapter": "チャプター",
|
||||
"ontop": "ウィンドウを最前面に固定",
|
||||
"ontop_disable": "ウィンドウを固定解除",
|
||||
"loop_enable": "ループを有効にする",
|
||||
"loop_disable": "ループを無効にする",
|
||||
"speed_control": "速度制御",
|
||||
"screenshot": "スクリーンショット",
|
||||
"stats_info": "情報",
|
||||
"cache": "キャッシュ",
|
||||
"buffering": "読み込み中",
|
||||
"zoom_in": "拡大",
|
||||
"zoom_out": "縮小",
|
||||
"download": "ダウンロード",
|
||||
"download_in_progress": "ダウンロード中",
|
||||
"downloading": "ダウンロード中",
|
||||
"downloaded": "既にダウンロード済み",
|
||||
"menu": "メニュー",
|
||||
},
|
||||
"zh": {
|
||||
"idle": "将文件或URL放在这里播放",
|
||||
"na": "不可用",
|
||||
"video": "视频",
|
||||
"audio": "音频",
|
||||
"subtitle": "字幕",
|
||||
"no_subs": "没有可用字幕",
|
||||
"no_audio": "没有音轨",
|
||||
"playlist": "播放列表",
|
||||
"no_playlist": "播放列表为空",
|
||||
"chapter": "章节",
|
||||
"ontop": "窗口停留在顶层",
|
||||
"ontop_disable": "禁用窗口停留在顶层",
|
||||
"loop_enable": "启用循环",
|
||||
"loop_disable": "禁用循环",
|
||||
"speed_control": "速度控制",
|
||||
"screenshot": "截屏",
|
||||
"stats_info": "信息",
|
||||
"cache": "缓存",
|
||||
"buffering": "缓冲中",
|
||||
"zoom_in": "放大",
|
||||
"zoom_out": "缩小",
|
||||
"download": "下载",
|
||||
"download_in_progress": "下载中",
|
||||
"downloading": "正在下载",
|
||||
"downloaded": "已下载",
|
||||
"menu": "菜单",
|
||||
},
|
||||
"ar": {
|
||||
"idle": "أسقط الملفات أو الروابط هنا للتشغيل",
|
||||
"na": "غير متاح",
|
||||
"video": "فيديو",
|
||||
"audio": "صوت",
|
||||
"subtitle": "ترجمة",
|
||||
"no_subs": "لا توجد ترجمات متاحة",
|
||||
"no_audio": "لا توجد مسارات صوتية متاحة",
|
||||
"playlist": "قائمة التشغيل",
|
||||
"no_playlist": "قائمة التشغيل فارغة",
|
||||
"chapter": "فصل",
|
||||
"ontop": "تثبيت النافذة",
|
||||
"ontop_disable": "إلغاء تثبيت النافذة",
|
||||
"loop_enable": "تمكين التكرار",
|
||||
"loop_disable": "تعطيل التكرار",
|
||||
"speed_control": "التحكم في السرعة",
|
||||
"screenshot": "لقطة شاشة",
|
||||
"stats_info": "معلومات",
|
||||
"cache": "ذاكرة التخزين المؤقت",
|
||||
"buffering": "جار التحميل",
|
||||
"zoom_in": "تكبير",
|
||||
"zoom_out": "تصغير",
|
||||
"download": "تنزيل",
|
||||
"download_in_progress": "التنزيل جارٍ",
|
||||
"downloading": "جاري التنزيل",
|
||||
"downloaded": "تم التنزيل بالفعل",
|
||||
"menu": "قائمة",
|
||||
},
|
||||
"ru": {
|
||||
"idle": "Перенести файл или URL для воспроизведения",
|
||||
"na": "Недоступно",
|
||||
"video": "Видео",
|
||||
"audio": "Аудио",
|
||||
"subtitle": "Субтитры",
|
||||
"no_subs": "Субтитры недоступны",
|
||||
"no_audio": "Нет аудио-дорожек",
|
||||
"playlist": "Плейлист",
|
||||
"no_playlist": "Плейлист пуст",
|
||||
"chapter": "Глава",
|
||||
"ontop": "Закрепить окно",
|
||||
"ontop_disable": "Открепить окно",
|
||||
"loop_enable": "Повтор",
|
||||
"loop_disable": "Отключить повтор",
|
||||
"speed_control": "Контроль скорости",
|
||||
"screenshot": "Скриншот",
|
||||
"stats_info": "Информация",
|
||||
"cache": "Кеш",
|
||||
"buffering": "Буферизация",
|
||||
"zoom_in": "Зум +",
|
||||
"zoom_out": "Зум -",
|
||||
"download": "Загрузить",
|
||||
"download_in_progress": "Загрузка в процессе",
|
||||
"downloading": "Загрузка",
|
||||
"downloaded": "Уже загружено",
|
||||
"menu": "Меню",
|
||||
},
|
||||
}
|
||||
68
submodules/ModernZ/extras/pause-indicator-lite/README.md
Normal file
68
submodules/ModernZ/extras/pause-indicator-lite/README.md
Normal file
@@ -0,0 +1,68 @@
|
||||
## Pause Indicator Lite
|
||||
|  |  |
|
||||
|:---:|:---:|
|
||||
|
||||
A simple script that displays an indicator on pause (and mute), with options to adjust icon type, color, height, width, opacity and whether to toggle pause with a keybind or not.
|
||||
|
||||
I only decided to write this because the ones I found were either too complicated or too simple. The alternatives are great, this one just meets my simple use case scenario.
|
||||
|
||||
**Script:** [Pause Indicator Lite](./pause_indicator_lite.lua)
|
||||
|
||||
### Indicator Options
|
||||
Below is the full list for indicator options and their default values.
|
||||
|
||||
To adjust them you can either:
|
||||
- Place [pause_indicator_lite.conf](./pause_indicator_lite.conf) in `script-opts` and change the values in it [recommended]
|
||||
- Simply change their values in `local options` within the script itself
|
||||
|
||||
| Option | Value | Description |
|
||||
|--------------------------|-------------|--------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| `indicator_icon` | pause | indicator icon type. `pause`, `play` |
|
||||
| `indicator_stay` | yes | keep indicator visibile during pause |
|
||||
| `indicator_timeout` | 0.6 | timeout (seconds) if indicator doesn't stay |
|
||||
| `keybind_allow` | yes | allow keybind to toggle pause |
|
||||
| `keybind_set` | mbtn_left | the used keybind to toggle pause [[reference](https://github.com/mpv-player/mpv/blob/master/etc/input.conf)] |
|
||||
| `keybind_mode` | onpause | mode to activate keybind. <br>`onpause`: only active when paused, to unpause <br>`always`: always active to toggle pause/unpause |
|
||||
| `keybind_eof_disable` | yes | disable keybind on eof (end of file) [[reference](https://github.com/Samillion/ModernZ/issues/291)] |
|
||||
| `icon_color` | `#FFFFFF` | icon fill color |
|
||||
| `icon_border_color` | `#111111` | icon border color |
|
||||
| `icon_border_width` | 1.5 | icon border width |
|
||||
| `icon_opacity` | 40 | icon opacity (0-100) |
|
||||
| `rectangles_width` | 30 | width of rectangles (pause icon) |
|
||||
| `rectangles_height` | 80 | height of rectangles (pause icon) |
|
||||
| `rectangles_spacing` | 20 | spacing between the two rectangles (pause icon) |
|
||||
| `triangle_width` | 80 | width of triangle (play icon) |
|
||||
| `triangle_height` | 80 | height of triangle (play icon) |
|
||||
| `flash_play_icon` | yes | flash play icon on unpause (best with pause indicator icon) |
|
||||
| `flash_icon_timeout` | 0.3 | timeout (seconds) for flash icon |
|
||||
| `fluent_icons` | no | requires `fonts/fluent-system-icons.ttf` [[details](https://github.com/Samillion/ModernZ/pull/336)] |
|
||||
| `fluent_icon_size` | 80 | fluent icon size |
|
||||
| `mute_indicator` | no | show a mute indicator (requires fluent font) |
|
||||
| `mute_indicator_pos` | middle_right | position of mute indicator. `top_left`, `top_right`, `top_center`. also: `middle_*`, `bottom_*` same as `top_*` (ie: `bottom_right`) |
|
||||
|
||||
### How to install
|
||||
|
||||
Simply place `pause_indicator_lite.lua` in the corresponding mpv scripts folder of your operating system:
|
||||
|
||||
- Windows: `%APPDATA%\mpv\scripts\` or `C:\users\USERNAME\AppData\Roaming\mpv\scripts\`
|
||||
- Linux: `~/.config/mpv/scripts/` or `/home/USERNAME/.config/mpv/scripts/`
|
||||
- Mac: `~/.config/mpv/scripts/` or `/Users/USERNAME/.config/mpv/scripts/`
|
||||
|
||||
> [!TIP]
|
||||
> More information about mpv files locations can be found [here](https://mpv.io/manual/master/#files)
|
||||
|
||||
```
|
||||
mpv
|
||||
├── fonts/
|
||||
│ └── fluent-system-icons.ttf (optional) [required for fluent_icons]
|
||||
├── script-opts
|
||||
│ └── pause_indicator_lite.conf
|
||||
└── scripts
|
||||
└── pause_indicator_lite.lua
|
||||
```
|
||||
|
||||
### Notes
|
||||
|
||||
- I don't plan to focus many updates on this script, because ASS drawing and positioning pisses me off. 😝
|
||||
- Other alternatives can be found in the mpv [user scripts](https://github.com/mpv-player/mpv/wiki/User-Scripts) wiki.
|
||||
- This isn't exclusive to be used on ModernZ OSC. Feel free to use it with whatever you want.
|
||||
@@ -0,0 +1,54 @@
|
||||
# indicator icon type. "pause", "play"
|
||||
indicator_icon=pause
|
||||
# keep indicator visibile during pause
|
||||
indicator_stay=yes
|
||||
# timeout (seconds) if indicator doesn't stay
|
||||
indicator_timeout=0.6
|
||||
|
||||
# allow keybind to toggle pause
|
||||
keybind_allow=yes
|
||||
# the used keybind to toggle pause
|
||||
keybind_set=mbtn_left
|
||||
# mode to activate keybind. "onpause", "always"
|
||||
keybind_mode=onpause
|
||||
# disable keybind on eof (end of file)
|
||||
keybind_eof_disable=yes
|
||||
|
||||
# icon fill color
|
||||
icon_color=#FFFFFF
|
||||
# icon border color
|
||||
icon_border_color=#111111
|
||||
# icon border width
|
||||
icon_border_width=1.5
|
||||
# icon opacity (0-100)
|
||||
icon_opacity=40
|
||||
|
||||
# width of rectangles
|
||||
rectangles_width=30
|
||||
# height of rectangles
|
||||
rectangles_height=80
|
||||
# spacing between the two rectangles
|
||||
rectangles_spacing=20
|
||||
|
||||
# width of triangle
|
||||
triangle_width=80
|
||||
# height of triangle
|
||||
triangle_height=80
|
||||
|
||||
# flash play icon on unpause
|
||||
flash_play_icon=yes
|
||||
# timeout (seconds) for flash icon
|
||||
flash_icon_timeout=0.3
|
||||
|
||||
# icon style used in ModernZ osc
|
||||
# requires fonts/fluent-system-icons.ttf
|
||||
fluent_icons=no
|
||||
# fluent icon size
|
||||
fluent_icon_size=80
|
||||
|
||||
# mute options
|
||||
# show a mute indicator (requires fluent font)
|
||||
mute_indicator=no
|
||||
# position of mute indicator. top_left, top_right, top_center
|
||||
# also: middle_*, bottom_* same as top_* (ie: bottom_right)
|
||||
mute_indicator_pos=middle_right
|
||||
@@ -0,0 +1,218 @@
|
||||
--[[
|
||||
|
||||
A simple script that shows a pause indicator, on pause
|
||||
https://github.com/Samillion/ModernZ/tree/main/extras/pause-indicator-lite
|
||||
|
||||
--]]
|
||||
|
||||
local options = {
|
||||
-- indicator icon type
|
||||
indicator_icon = "pause", -- indicator icon type. "pause", "play"
|
||||
indicator_stay = true, -- keep indicator visibile during pause
|
||||
indicator_timeout = 0.6, -- timeout (seconds) if indicator doesn't stay
|
||||
|
||||
-- keybind
|
||||
keybind_allow = true, -- allow keybind to toggle pause
|
||||
keybind_set = "mbtn_left", -- the used keybind to toggle pause
|
||||
keybind_mode = "onpause", -- mode to activate keybind. "onpause", "always"
|
||||
keybind_eof_disable = true, -- disable keybind on eof (end of file)
|
||||
|
||||
-- icon colors & opacity
|
||||
icon_color = "#FFFFFF", -- icon fill color
|
||||
icon_border_color = "#111111", -- icon border color
|
||||
icon_border_width = 1.5, -- icon border width
|
||||
icon_opacity = 40, -- icon opacity (0-100)
|
||||
|
||||
-- pause icon
|
||||
rectangles_width = 30, -- width of rectangles
|
||||
rectangles_height = 80, -- height of rectangles
|
||||
rectangles_spacing = 20, -- spacing between the two rectangles
|
||||
|
||||
-- play icon
|
||||
triangle_width = 80, -- width of triangle
|
||||
triangle_height = 80, -- height of triangle
|
||||
|
||||
-- best with pause icon
|
||||
flash_play_icon = true, -- flash play icon on unpause
|
||||
flash_icon_timeout = 0.3, -- timeout (seconds) for flash icon
|
||||
|
||||
-- icon style used in ModernZ osc
|
||||
fluent_icons = false, -- requires fonts/fluent-system-icons.ttf
|
||||
fluent_icon_size = 80, -- fluent icon size
|
||||
|
||||
-- mute options
|
||||
mute_indicator = false, -- show a mute indicator (requires fluent font)
|
||||
mute_indicator_pos = "middle_right", -- position of mute indicator. top_left, top_right, top_center
|
||||
-- also: middle_*, bottom_* same as top_* (ie: bottom_right)
|
||||
}
|
||||
|
||||
local msg = require "mp.msg"
|
||||
require 'mp.options'.read_options(options, "pause_indicator_lite")
|
||||
|
||||
-- convert color from hex (adjusted from mpv/osc.lua)
|
||||
local function convert_color(color)
|
||||
if color:find("^#%x%x%x%x%x%x$") == nil then
|
||||
msg.warn("'" .. color .. "' is not a valid color, using default '#FFFFFF'")
|
||||
return "FFFFFF" -- color fallback
|
||||
end
|
||||
return color:sub(6,7) .. color:sub(4,5) .. color:sub(2,3)
|
||||
end
|
||||
|
||||
-- convert percentage opacity (0-100) to ASS alpha values
|
||||
local function convert_opacity(value)
|
||||
value = math.max(0, math.min(100, value))
|
||||
return string.format("%02X", (255 - (value * 2.55)))
|
||||
end
|
||||
|
||||
-- colors and opaicty
|
||||
local icon_color = convert_color(options.icon_color)
|
||||
local icon_border_color = convert_color(options.icon_border_color)
|
||||
local icon_opacity = convert_opacity(options.icon_opacity)
|
||||
local icon_font = "fluent-system-icons"
|
||||
|
||||
-- pause icon
|
||||
local function draw_rectangles()
|
||||
if options.fluent_icons then
|
||||
local pause_icon = "\238\163\140"
|
||||
return string.format([[{\\rDefault\\an5\\alpha&H%s\\bord%s\\1c&H%s&\\3c&H%s&\\fs%s\\fn%s}%s]],
|
||||
icon_opacity, options.icon_border_width, icon_color, icon_border_color, options.fluent_icon_size, icon_font, pause_icon)
|
||||
else
|
||||
return string.format([[{\\rDefault\\p1\\an5\\alpha&H%s\\bord%s\\1c&H%s&\\3c&H%s&}m 0 0 l %d 0 l %d %d l 0 %d m %d 0 l %d 0 l %d %d l %d %d{\\p0}]],
|
||||
icon_opacity, options.icon_border_width, icon_color, icon_border_color, options.rectangles_width, options.rectangles_width,
|
||||
options.rectangles_height, options.rectangles_height, options.rectangles_width + options.rectangles_spacing,
|
||||
options.rectangles_width * 2 + options.rectangles_spacing, options.rectangles_width * 2 + options.rectangles_spacing,
|
||||
options.rectangles_height, options.rectangles_width + options.rectangles_spacing, options.rectangles_height)
|
||||
end
|
||||
end
|
||||
|
||||
-- play icon
|
||||
local function draw_triangle()
|
||||
if options.fluent_icons then
|
||||
local play_icon = "\238\166\143"
|
||||
return string.format([[{\\rDefault\\an5\\alpha&H%s\\bord%s\\1c&H%s&\\3c&H%s&\\fs%s\\fn%s}%s]],
|
||||
icon_opacity, options.icon_border_width, icon_color, icon_border_color, options.fluent_icon_size, icon_font, play_icon)
|
||||
else
|
||||
return string.format([[{\\rDefault\\p1\\an5\\alpha&H%s\\bord%s\\1c&H%s&\\3c&H%s&}m 0 0 l %d %d l 0 %d{\\p0}]],
|
||||
icon_opacity, options.icon_border_width, icon_color, icon_border_color, options.triangle_width, options.triangle_height / 2, options.triangle_height)
|
||||
end
|
||||
end
|
||||
|
||||
-- mute icon
|
||||
local function draw_mute()
|
||||
if not options.fluent_icons then return end
|
||||
|
||||
local mute_icon = "\238\173\138"
|
||||
local mute_pos_list = {
|
||||
["top_left"] = 7,
|
||||
["top_center"] = 8,
|
||||
["top_right"] = 9,
|
||||
["middle_left"] = 4,
|
||||
["middle_center"] = 5,
|
||||
["middle_right"] = 6,
|
||||
["bottom_left"] = 1,
|
||||
["bottom_center"] = 2,
|
||||
["bottom_right"] = 3,
|
||||
}
|
||||
local mute_pos = mute_pos_list[options.mute_indicator_pos:lower()] or 6
|
||||
return string.format([[{\\rDefault\\an%s\\alpha&H%s\\bord%s\\1c&H%s&\\3c&H%s&\\fs%s\\fn%s}%s]],
|
||||
mute_pos, icon_opacity, options.icon_border_width, icon_color, icon_border_color, options.fluent_icon_size, icon_font, mute_icon)
|
||||
end
|
||||
|
||||
-- initiate overlay
|
||||
local indicator = mp.create_osd_overlay("ass-events")
|
||||
local flash = mp.create_osd_overlay("ass-events")
|
||||
local mute = mp.create_osd_overlay("ass-events")
|
||||
|
||||
-- keep track of pause toggle and end of file
|
||||
local toggled, eof
|
||||
|
||||
-- draw and update indicator
|
||||
local function update_indicator()
|
||||
local _, _, display_aspect = mp.get_osd_size()
|
||||
if display_aspect == 0 or (indicator.visible and not toggled) then return end
|
||||
|
||||
indicator.data = options.indicator_icon == "play" and draw_triangle() or draw_rectangles()
|
||||
indicator:update()
|
||||
|
||||
if not options.indicator_stay then
|
||||
mp.add_timeout(options.indicator_timeout, function() indicator:remove() end)
|
||||
end
|
||||
end
|
||||
|
||||
-- flash play icon
|
||||
local function flash_icon()
|
||||
if not options.flash_play_icon then return flash:remove() end
|
||||
flash.data = draw_triangle()
|
||||
flash:update()
|
||||
mp.add_timeout(options.flash_icon_timeout, function() flash:remove() end)
|
||||
end
|
||||
|
||||
-- draw mute icon
|
||||
local function mute_icon()
|
||||
mute.data = draw_mute()
|
||||
mute:update()
|
||||
end
|
||||
|
||||
-- check if file is video
|
||||
local function is_video()
|
||||
local t = mp.get_property_native("current-tracks/video")
|
||||
return t and not (t.image or t.albumart) and true or false
|
||||
end
|
||||
|
||||
-- remove overlays
|
||||
local function shutdown()
|
||||
if flash then flash:remove() end
|
||||
if indicator then indicator:remove() end
|
||||
mp.unobserve_property("pause")
|
||||
end
|
||||
|
||||
-- end of file keybind check
|
||||
if options.keybind_eof_disable then
|
||||
mp.observe_property("eof-reached", "bool", function(_, val)
|
||||
eof = val
|
||||
end)
|
||||
end
|
||||
|
||||
-- observe when pause state changes
|
||||
mp.observe_property("pause", "bool", function(_, paused)
|
||||
if not is_video() then return shutdown() end
|
||||
if paused then
|
||||
update_indicator()
|
||||
toggled = true
|
||||
if options.flash_play_icon then flash:remove() end
|
||||
else
|
||||
indicator:remove()
|
||||
if toggled then
|
||||
flash_icon()
|
||||
toggled = false
|
||||
end
|
||||
end
|
||||
|
||||
-- keybind setup (if options allow it)
|
||||
if options.keybind_allow == true then
|
||||
mp.set_key_bindings({
|
||||
{options.keybind_set, function() mp.commandv("cycle", "pause") end}
|
||||
}, "pause-indicator", "force")
|
||||
|
||||
if options.keybind_mode == "always" or (options.keybind_mode == "onpause" and paused) then
|
||||
if not eof then mp.enable_key_bindings("pause-indicator") end
|
||||
else
|
||||
mp.disable_key_bindings("pause-indicator")
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- update pause indicator position if window size changes
|
||||
mp.observe_property("osd-dimensions", "native", function()
|
||||
if indicator and indicator.visible then
|
||||
update_indicator()
|
||||
end
|
||||
end)
|
||||
|
||||
if options.mute_indicator and options.fluent_icons then
|
||||
mp.observe_property("mute", "bool", function(_, val)
|
||||
if val and not mute.visible then mute_icon() else mute:remove() end
|
||||
end)
|
||||
else
|
||||
mute:remove()
|
||||
end
|
||||
Reference in New Issue
Block a user