pyradio: add per-station buffering option

This commit is contained in:
magicquark 2026-02-26 04:37:49 +00:00 committed by Austin Horstman
parent e04cf4c16d
commit 358bafaf95
3 changed files with 23 additions and 2 deletions

View file

@ -61,6 +61,24 @@ in
description = "Stream URL of the radio station.";
};
buffering = mkOption {
type = nullOr (submodule {
options = {
seconds = mkOption {
type = ints.positive;
description = "Number of seconds to buffer the stream.";
};
bitrate = mkOption {
type = ints.positive;
default = 128;
description = "Bitrate of the stream in kbps (modify only if using MPlayer).";
};
};
});
description = "Buffering configuration to apply to the station.";
default = null;
};
encoding = mkOption {
type = str;
default = "";
@ -142,7 +160,9 @@ in
station.encoding
(escapeCSV station.iconUrl)
""
""
(lib.optionalString (
station.buffering != null
) "${toString station.buffering.seconds}@${toString station.buffering.bitrate}")
(if station.forceHttp then "1" else "0")
(toString station.volume)
]

View file

@ -23,6 +23,7 @@
{
name = "DEF CON Radio (SomaFM)";
url = "https://somafm.com/defcon256.pls";
buffering.seconds = 10;
volume = 85;
encoding = "utf-8";
iconUrl = "https://somafm.com/img3/defcon400.png";

View file

@ -2,4 +2,4 @@ DEF CON Radio (SomaFM),https://somafm.com/defcon256.pls,,,,,0,50
"DEF CON Radio, SomaFM",https://somafm.com/defcon256.pls,,,,,0,50
"DEF CON Radio on ""SomaFM""",https://somafm.com/defcon256.pls,,,,,0,50
"DEF CON Radio on ""SomaFM""",https://somafm.com/defcon256.pls,,,,,0,50
DEF CON Radio (SomaFM),https://somafm.com/defcon256.pls,utf-8,https://somafm.com/img3/defcon400.png,,,1,85
DEF CON Radio (SomaFM),https://somafm.com/defcon256.pls,utf-8,https://somafm.com/img3/defcon400.png,,10@128,1,85

1 DEF CON Radio (SomaFM) https://somafm.com/defcon256.pls 0 50
2 DEF CON Radio, SomaFM https://somafm.com/defcon256.pls 0 50
3 DEF CON Radio on "SomaFM" https://somafm.com/defcon256.pls 0 50
4 DEF CON Radio on "SomaFM" https://somafm.com/defcon256.pls 0 50
5 DEF CON Radio (SomaFM) https://somafm.com/defcon256.pls utf-8 https://somafm.com/img3/defcon400.png 10@128 1 85