summary refs log tree commit diff
path: root/pkgs/applications/video
diff options
context:
space:
mode:
authorpacien <pacien.trangirard@pacien.net>2020-07-06 23:30:53 +0200
committerpacien <pacien.trangirard@pacien.net>2020-08-07 14:47:12 +0200
commit1d18e350236130f7570d6a8fc67ad0234e82247e (patch)
tree1a57b4ca2bc4ab6809de763471e4e0982a65750b /pkgs/applications/video
parentfeab14d327e6b3b8c6bf9298b522b9b5719db3e0 (diff)
downloadnixpkgs-1d18e350236130f7570d6a8fc67ad0234e82247e.tar
nixpkgs-1d18e350236130f7570d6a8fc67ad0234e82247e.tar.gz
nixpkgs-1d18e350236130f7570d6a8fc67ad0234e82247e.tar.bz2
nixpkgs-1d18e350236130f7570d6a8fc67ad0234e82247e.tar.lz
nixpkgs-1d18e350236130f7570d6a8fc67ad0234e82247e.tar.xz
nixpkgs-1d18e350236130f7570d6a8fc67ad0234e82247e.tar.zst
nixpkgs-1d18e350236130f7570d6a8fc67ad0234e82247e.zip
mpvScripts.sponsorblock: init at f71e49e (2020-07-05)
Diffstat (limited to 'pkgs/applications/video')
-rw-r--r--pkgs/applications/video/mpv/scripts/sponsorblock.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/pkgs/applications/video/mpv/scripts/sponsorblock.nix b/pkgs/applications/video/mpv/scripts/sponsorblock.nix
new file mode 100644
index 00000000000..8213e514d2b
--- /dev/null
+++ b/pkgs/applications/video/mpv/scripts/sponsorblock.nix
@@ -0,0 +1,51 @@
+{ stdenv, fetchFromGitHub, fetchpatch, python3 }:
+
+# Usage: `pkgs.mpv.override { scripts = [ pkgs.mpvScripts.sponsorblock ]; }`
+stdenv.mkDerivation {
+  pname = "mpv_sponsorblock";
+  version = "unstable-2020-07-05";
+
+  src = fetchFromGitHub {
+    owner = "po5";
+    repo = "mpv_sponsorblock";
+    rev = "f71e49e0531350339134502e095721fdc66eac20";
+    sha256 = "1fr4cagzs26ygxyk8dxqvjw4n85fzv6is6cb1jhr2qnsjg6pa0p8";
+  };
+
+  dontBuild = true;
+
+  patches = [
+    # Use XDG_DATA_HOME and XDG_CACHE_HOME if defined for UID and DB
+    # Necessary to avoid sponsorblock to write in the nix store at runtime.
+    # https://github.com/po5/mpv_sponsorblock/pull/17
+    (fetchpatch {
+      url = "https://github.com/po5/mpv_sponsorblock/pull/17/commits/e65b360a7d03a3430b4829e457a6670b2f617b09.patch";
+      sha256 = "00wv0pvbz0dz2ibka66zhl2jk0pil4pyv6ipjfz37i81q6szyhs5";
+    })
+    (fetchpatch {
+      url = "https://github.com/po5/mpv_sponsorblock/pull/17/commits/3832304d959205e99120a14c0560ed3c37104b08.patch";
+      sha256 = "149ffvn714n2m3mqs8mgrbs24bcr74kqfkx7wyql36ndhm88xd2z";
+    })
+  ];
+
+  postPatch = ''
+    substituteInPlace sponsorblock.lua \
+      --replace "python3" "${python3}/bin/python3" \
+      --replace 'mp.find_config_file("scripts")' "\"$out/share/mpv/scripts\""
+  '';
+
+  installPhase = ''
+    mkdir -p $out/share/mpv/scripts
+    cp -r sponsorblock.lua sponsorblock_shared $out/share/mpv/scripts/
+  '';
+
+  passthru.scriptName = "sponsorblock.lua";
+
+  meta = with stdenv.lib; {
+    description = "mpv script to skip sponsored segments of YouTube videos";
+    homepage = "https://github.com/po5/mpv_sponsorblock";
+    license = licenses.gpl3;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ pacien ];
+  };
+}