This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

mpv: fix autosub with sublime

+20 -8
+20 -8
2configs/mpv.nix
··· 1 1 { pkgs, ... }: 2 2 3 3 let 4 - dl_subs = pkgs.writers.writeDashBin "dl_subs" '' 5 - set -efu 6 - filename=$1 7 - cd "$(dirname "$filename")" 8 - filename=$(basename "$filename") 9 - ${pkgs.subdl}/bin/subdl --download=best-rating --existing=overwrite --output='/tmp/{m}.{M}.sub' "$filename" 1>&2 10 - echo "/tmp/$filename.sub" 4 + dl_subs = pkgs.writers.writePython3Bin "dl_subs" { 5 + libraries = [ pkgs.python3Packages.subliminal ]; 6 + flakeIgnore = [ "E501" ]; 7 + } '' 8 + import babelfish 9 + import subliminal 10 + from pathlib import Path 11 + import sys 12 + import os 13 + 14 + video_path = Path(sys.argv[1]) 15 + video = subliminal.scan_video(video_path) 16 + cache_path = Path(os.path.expanduser("~/.cache/subliminal")) / f"{video.title}.srt" 17 + if not cache_path.exists(): 18 + cache_path.parent.mkdir(parents=True, exist_ok=True) 19 + language = babelfish.Language("eng") 20 + sub = subliminal.download_best_subtitles([video], {language})[video][0] 21 + cache_path.write_bytes(sub.content) 22 + print(cache_path) 11 23 ''; 12 24 13 25 autosub = pkgs.writeText "autosub.lua" '' ··· 50 62 mpv = pkgs.symlinkJoin { 51 63 name = "mpv"; 52 64 paths = [ 53 - (pkgs.writeDashBin "mpv" '' 65 + (pkgs.writers.writeDashBin "mpv" '' 54 66 set -efu 55 67 Y_RES=1081 56 68 # we need to disable sponsorblock local database because of