diff --git a/radio@driglu4it/README.md b/radio@driglu4it/README.md index 3cef764b3fe..c5a71a25fa5 100644 --- a/radio@driglu4it/README.md +++ b/radio@driglu4it/README.md @@ -18,9 +18,9 @@ A simple radio applet for Cinnamon. The radio-applet has been totally rewritten The [mpv media player](https://mpv.io) is used for playing the radio channel. As the mpv media player doesn't support MPRIS control out of the box, [this plugin](https://github.com/hoyon/mpv-mpris) is used to get this feature. For the mpv player and the plugin, a download dialogue is opened when clicking on the applet. -**TLDR** Run this [gist](https://gist.github.com/jonath92/0f6bf4606bc8a34be1bb0826c99b73d1) as sudo to install `youtube-dl` +**TLDR** Run this [gist](https://gist.github.com/jonath92/039e998b3d3f6ba4afd5d5c671eaedf1) as sudo to install `yt-dlp` -For the youtube download feature you can either use [youtube-dl](https://github.com/ytdl-org/youtube-dl) or [yt-dlp](https://github.com/yt-dlp/yt-dlp). By default youtube-dl is selected. As google frequently makes technical changes to Youtube, it is highly recommended to always have the newest version of the download cli tool installed as otherwise the feature will most likely stop working after a short time. Unfortunately, the newest version in the official linux mint apt repository is usually not even close to sufficiently up to date. Therefore I highly recommend installing the software by following the official installstion instruction which can be found on the respective github page and adding a script in `/etc/cron.daily` to automate the update. I have created a gist for both [youtube-dl](https://gist.github.com/jonath92/0f6bf4606bc8a34be1bb0826c99b73d1) and [yt-dlp](https://gist.github.com/jonath92/039e998b3d3f6ba4afd5d5c671eaedf1) for this purpose. +For the youtube download feature you can either use [youtube-dl](https://github.com/ytdl-org/youtube-dl) or [yt-dlp](https://github.com/yt-dlp/yt-dlp). By default yt-dlp is selected. As google frequently makes technical changes to Youtube, it is highly recommended to always have the newest version of the download cli tool installed as otherwise the feature will most likely stop working after a short time. Unfortunately, the newest version in the official linux mint apt repository is usually not even close to sufficiently up to date. Therefore I highly recommend installing the software by following the official installstion instruction which can be found on the respective github page and adding a script in `/etc/cron.daily` to automate the update. I have created a gist for both [youtube-dl](https://gist.github.com/jonath92/0f6bf4606bc8a34be1bb0826c99b73d1) and [yt-dlp](https://gist.github.com/jonath92/039e998b3d3f6ba4afd5d5c671eaedf1) for this purpose. ## Known Issues - It is automatically downloaded the compiled version of the mpv mpris plugin which however is only suitable for 64-bit x86 architecutres (e.g. not for the raspberry pi). In that case you unfortunately have to [build the plugin](https://github.com/hoyon/mpv-mpris#build) by yourself at the moment and place the plugin at: `~/.cinnamon/configs/radio@driglu4it/.mpris.so`. diff --git a/radio@driglu4it/files/radio@driglu4it/6.4/mpv-reconnect.lua b/radio@driglu4it/files/radio@driglu4it/6.4/mpv-reconnect.lua new file mode 100644 index 00000000000..a95875ff2c9 --- /dev/null +++ b/radio@driglu4it/files/radio@driglu4it/6.4/mpv-reconnect.lua @@ -0,0 +1,14 @@ +-- Util to automatically reconnect on network change. +-- Based on: https://github.com/mpv-player/mpv/issues/5793#issuecomment-2495268210 +local prev_pos = -1 + +function reload_if_disconnected() + local pos = mp.get_property_number('time-pos') + if pos == nil or pos == prev_pos then + mp.commandv('loadfile', mp.get_property('path'), 'replace') + else + prev_pos = pos + end +end + +mp.add_periodic_timer(1, reload_if_disconnected) \ No newline at end of file diff --git a/radio@driglu4it/files/radio@driglu4it/6.4/radio-applet.js b/radio@driglu4it/files/radio@driglu4it/6.4/radio-applet.js index 87d389e89e4..c02f6fae7a8 100644 --- a/radio@driglu4it/files/radio@driglu4it/6.4/radio-applet.js +++ b/radio@driglu4it/files/radio@driglu4it/6.4/radio-applet.js @@ -2906,8 +2906,9 @@ function createMpvHandler() { global.logWarning('initial Volume was null or undefined. Applying 50 as a fallback solution to prevent radio stop working'); initialVolume = 50; } - const command = `mpv --config=no --no-video --script=${MPRIS_PLUGIN_PATH} ${url} - --volume=${initialVolume}`; + const command = `mpv --config=no --no-video --script=${MPRIS_PLUGIN_PATH} + --scripts-append=${__meta.path}/mpv-reconnect.lua + ${url} --volume=${initialVolume}`; spawnCommandLine(command); return; } @@ -5182,6 +5183,7 @@ function createSubMenu(args) { style_class: "popup-sub-menu", vscrollbar_policy: PolicyType.AUTOMATIC, hscrollbar_policy: PolicyType.NEVER, + clip_to_allocation: true, }); const box = new PopupSubMenu_BoxLayout({ vertical: true, diff --git a/radio@driglu4it/src/lib/PopupSubMenu.ts b/radio@driglu4it/src/lib/PopupSubMenu.ts index 0a74f931fb4..d0935e1e68f 100644 --- a/radio@driglu4it/src/lib/PopupSubMenu.ts +++ b/radio@driglu4it/src/lib/PopupSubMenu.ts @@ -46,6 +46,7 @@ export function createSubMenu(args: Arguments) { style_class: "popup-sub-menu", vscrollbar_policy: PolicyType.AUTOMATIC, hscrollbar_policy: PolicyType.NEVER, + clip_to_allocation: true, }); const box = new BoxLayout({ diff --git a/radio@driglu4it/src/services/mpv/MpvHandler.ts b/radio@driglu4it/src/services/mpv/MpvHandler.ts index ecd3cd80514..bdc64c07ca1 100644 --- a/radio@driglu4it/src/services/mpv/MpvHandler.ts +++ b/radio@driglu4it/src/services/mpv/MpvHandler.ts @@ -321,8 +321,9 @@ function createMpvHandler() { initialVolume = 50 } - const command = `mpv --config=no --no-video --script=${MPRIS_PLUGIN_PATH} ${url} - --volume=${initialVolume}` + const command = `mpv --config=no --no-video --script=${MPRIS_PLUGIN_PATH} + --scripts-append=${__meta.path}/mpv-reconnect.lua + ${url} --volume=${initialVolume}` spawnCommandLine(command) return }