feat(streamlink): add streamlink

This commit is contained in:
2026-06-07 18:27:19 +02:00
parent 88e31d3ce4
commit 971ce23e49
3 changed files with 31 additions and 1 deletions
+2
View File
@@ -12,6 +12,7 @@ in {
./mpd-mpris.nix
./mpv.nix
./ncmpcpp.nix
./streamlink.nix
];
options.home.media.fullDesktop = mkEnableOption "Enables everything";
@@ -20,5 +21,6 @@ in {
mpd.enable = mkDefault (cfg.fullDesktop or cfg.mpd-mpris.enable);
mpv.enable = mkDefault cfg.fullDesktop;
ncmpcpp.enable = mkDefault config.home.media.mpd.enable;
streamlink.enable = mkDefault config.home.media.mpv.enable;
};
}
+17
View File
@@ -0,0 +1,17 @@
{
lib,
config,
pkgs,
...
}:
with lib; let
cfg = config.home.media.streamlink;
in {
options.home.media.streamlink.enable = mkEnableOption "Enable Streamlink";
config.programs.streamlink = mkIf cfg.enable {
enable = true;
settings = {
player = "${pkgs.mpv}/bin/mpv";
};
};
}
+12 -1
View File
@@ -1,4 +1,4 @@
{
{pkgs, ...}: {
config.home.desktop.firefox = {
enable = true;
useZen = true;
@@ -13,6 +13,16 @@
smothscroll = "true";
};
extraConfig = ''
command openTwitchInMpv js -d@\
const url = new URL(document.location.href);\
const cleanUrl = url.hostname + url.pathname;\
const token = document.cookie.split("; ")\
.find(item => item.startsWith("auth-token="))?.split("=")[1];\
const auth = "--twitch-api-header=Authorization=OAuth " + token;\
const cmd = `${pkgs.streamlink}/bin/streamlink "''${auth}" "''${cleanUrl}" best`;\
tri.native.run(cmd)\
@
unbind h
unbind j
unbind k
@@ -69,6 +79,7 @@
bind < urlincrement -1
bind > urlincrement 1
bind ypt openTwitchInMpv
bind ypv js tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${document.location.href}"`)
bind ypm hint -JF e => tri.native.run(`mpv --ytdl-format="[height >=? 480]" --ontop --fs "''${e.href}"`)
'';