feat(streamlink): add streamlink
This commit is contained in:
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -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}"`)
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user