NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.11k stars 14.15k forks source link

Package request: mpvScripts.autosub #336986

Open Kommynct opened 2 months ago

Kommynct commented 2 months ago

Project description

Automatic subtitle downloading for MPV

Metadata


Add a :+1: reaction to issues you find important.

jcaesar commented 2 months ago

Hm, this looks neat. I think I'll test this a while with

  home.file.".config/mpv/scripts/autosub.lua".source = let
    patched = pkgs.stdenv.mkDerivation {
      name = "mpv-autosub-git";
      src = pkgs.fetchFromGitHub {
        owner = "davidde";
        repo = "mpv-autosub";
        rev = "35115355bd339681f97d067538356c29e5b14afa";
        hash = "sha256-BKT/Tzwl5ZA4fbdc/cxz0+CYc1zyY/KOXc58x5GYow0=";
      };
      prePatch = ''
        substituteInPlace autosub.lua --replace-fail \
          "local subliminal = '/home/david/.local/bin/subliminal'" \
          "local subliminal = '${lib.getExe' pkgs.python3.pkgs.subliminal "subliminal"}'"
      '';
      buildPhase = "";
      installPhase = "install -Dt $out/mpv/scripts autosub.lua";
    };
  in "${patched}/mpv/scripts/autosub.lua";

and then think about packaging it.

Shouldn't be too difficult, there's existing architecture for mpv scripts. There's two small oofs, which is

Kommynct commented 2 weeks ago

Any luck with that?

jcaesar commented 2 weeks ago

I've tried it on a few files, but it seems subliminal just downloads random garbage. Given that, I don't see the point of packaging this script. I don't have the time to look into the problem with subliminal.

See e.g. this for what I mean:

yt-dlp ytsearch:3uDwjIBR9s4
subliminal download -l en *3uDwjIBR9s4*
mpv *3uDwjIBR9s4*
Kommynct commented 2 weeks ago

it doesn't work on youtube videos, it's for movies/tv shows.

Extending it to also work on youtube videos would be pointless if you're using yt-dlp you should be able to download the sub then anyway.