| tweaked ui - mpv-jellyfin - MPV script for adding an interface for Jellyfin. | |
| Log | |
| Files | |
| Refs | |
| README | |
| LICENSE | |
| --- | |
| commit 8bec6ae51093850eb2850c5f1242b77f5d93a74b | |
| parent 6767689fc042bb8ccb56fba8604800418aad770c | |
| Author: EmperorPenguin18 <[email protected]> | |
| Date: Thu, 23 May 2024 21:38:52 -0400 | |
| tweaked ui | |
| Diffstat: | |
| A PKGBUILD | 18 ++++++++++++++++++ | |
| M README.md | 2 -- | |
| M scripts/jellyfin.lua | 50 ++++++++++++++++++-----------… | |
| 3 files changed, 47 insertions(+), 23 deletions(-) | |
| --- | |
| diff --git a/PKGBUILD b/PKGBUILD | |
| @@ -0,0 +1,18 @@ | |
| +# Maintainer: Sebastien MacDougall-Landry | |
| + | |
| +pkgname=mpv-jellyfin | |
| +pkgver=1.1 | |
| +pkgrel=1 | |
| +pkgdesc='mpv plugin that turns it into a Jellyfin client' | |
| +url='https://github.com/EmperorPenguin18/mpv-jellyfin/' | |
| +source=("$pkgname-$pkgver.tar.gz::https://github.com/EmperorPenguin18/mpv-jell… | |
| +arch=('any') | |
| +license=('Unlicense') | |
| +depends=('mpv' 'curl') | |
| +sha256sums=('') | |
| + | |
| +package () { | |
| + cd "$srcdir/$pkgname-$pkgver" | |
| + install -Dm644 scripts/jellyfin.lua -t "$pkgdir/etc/mpv/scripts" | |
| + install -Dm644 script-opts/jellyfin.conf -t "$pkgdir/etc/mpv/script-opts" | |
| +} | |
| diff --git a/README.md b/README.md | |
| @@ -29,6 +29,4 @@ When you activate a video in the menu, it will begin to play … | |
| In general this is a very minimal script and isn't designed to be a full Jelly… | |
| -Currently navigation is very slow because metadata is pulled in sequentially. … | |
| - | |
| Thumbnails will accumulate if the selected image path isn't tmpfs. In addition… | |
| diff --git a/scripts/jellyfin.lua b/scripts/jellyfin.lua | |
| @@ -25,6 +25,7 @@ local items = {} | |
| local ow, oh, op = 0, 0, 0 | |
| local video_id = "" | |
| local async = nil | |
| +local list_start = 1 | |
| local toggle_overlay -- function | |
| @@ -59,21 +60,24 @@ end | |
| local function update_list() | |
| overlay.data = "" | |
| - for _, item in ipairs(items) do | |
| - if _ > selection[layer] - (53 / op) then | |
| - if _ < selection[layer] + (20 * op) then | |
| - local index | |
| - if item.IndexNumber and item.IsFolder == false… | |
| - index = item.IndexNumber..". " | |
| - else | |
| - index = "" | |
| - end | |
| - if _ == selection[layer] then | |
| - overlay.data = overlay.data.."{\\fs16}… | |
| - else | |
| - overlay.data = overlay.data.."{\\fs16}… | |
| - end | |
| - end | |
| + local magic_num = 29 -- const | |
| + if selection[layer] - list_start > magic_num then | |
| + list_start = selection[layer] - magic_num | |
| + elseif selection[layer] - list_start < 0 then | |
| + list_start = selection[layer] | |
| + end | |
| + for i=list_start,list_start+magic_num do | |
| + if i > #items then break end | |
| + local index = "" | |
| + if items[i].IndexNumber and items[i].IsFolder == false then | |
| + index = items[i].IndexNumber..". " | |
| + else | |
| + -- nothing | |
| + end | |
| + if i == selection[layer] then | |
| + overlay.data = overlay.data.."{\\fs16}{\\c&HFF&}"..ind… | |
| + else | |
| + overlay.data = overlay.data.."{\\fs16}"..index..items[… | |
| end | |
| end | |
| overlay:update() | |
| @@ -178,9 +182,11 @@ local function play_video() | |
| end | |
| local function key_up() | |
| - selection[layer] = selection[layer] - 1 | |
| - if selection[layer] == 0 then selection[layer] = table.getn(items) end | |
| - update_data() | |
| + if #items > 1 then | |
| + selection[layer] = selection[layer] - 1 | |
| + if selection[layer] == 0 then selection[layer] = table.getn(it… | |
| + update_data() | |
| + end | |
| end | |
| local function key_right() | |
| @@ -196,9 +202,11 @@ local function key_right() | |
| end | |
| local function key_down() | |
| - selection[layer] = selection[layer] + 1 | |
| - if selection[layer] > table.getn(items) then selection[layer] = 1 end | |
| - update_data() | |
| + if #items > 1 then | |
| + selection[layer] = selection[layer] + 1 | |
| + if selection[layer] > table.getn(items) then selection[layer] … | |
| + update_data() | |
| + end | |
| end | |
| local function key_left() |