nushell: Add kink module
This commit is contained in:
parent
2983121a35
commit
56e1c03098
2 changed files with 25 additions and 0 deletions
|
@ -33,9 +33,15 @@ in
|
|||
|
||||
register ${pkgs.nushellPlugins.query}/bin/nu_plugin_query
|
||||
register ${nushell_plugin_formats}/bin/nu_plugin_formats
|
||||
|
||||
use kink.nu
|
||||
'';
|
||||
};
|
||||
|
||||
xdg.configFile."nushell/scripts/kink.nu" = {
|
||||
source = ./scripts/kink.nu;
|
||||
};
|
||||
|
||||
home.packages = with pkgs; [
|
||||
carapace
|
||||
];
|
||||
|
|
19
home-manager/modules/nushell/scripts/kink.nu
Normal file
19
home-manager/modules/nushell/scripts/kink.nu
Normal file
|
@ -0,0 +1,19 @@
|
|||
export def main [channel?: string] {
|
||||
let playlist = (if ($channel == null) {
|
||||
http get https://playerservices.streamtheworld.com/pls/KINKAAC.pls | from ini
|
||||
} else if ($channel == "80s") {
|
||||
http get https://playerservices.streamtheworld.com/pls/KINK_DNAAAC.pls | from ini
|
||||
} else if ($channel == "distortion") {
|
||||
http get https://playerservices.streamtheworld.com/pls/KINK_DISTORTIONAAC.pls | from ini
|
||||
} else {
|
||||
echo "Unknown channel"
|
||||
exit
|
||||
})
|
||||
let playlist = ($playlist.playlist | transpose | where {|x| ($x.column0 | str starts-with "File") } | get column1)
|
||||
mpc clear
|
||||
let streamIndex = (random integer ..($playlist | length))
|
||||
echo $"Playing stream ($streamIndex)"
|
||||
let stream = ($playlist | get $streamIndex)
|
||||
mpc add $stream
|
||||
mpc play
|
||||
}
|
Loading…
Reference in a new issue