Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions radio@driglu4it/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
14 changes: 14 additions & 0 deletions radio@driglu4it/files/radio@driglu4it/6.4/mpv-reconnect.lua
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 4 additions & 2 deletions radio@driglu4it/files/radio@driglu4it/6.4/radio-applet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions radio@driglu4it/src/lib/PopupSubMenu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
5 changes: 3 additions & 2 deletions radio@driglu4it/src/services/mpv/MpvHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Loading