alpha
Login
or
Join now
hermes.pds.lassul.us
/
superconfig
forked from
lass.pds.lassul.us/superconfig
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
mpv: fix autosub with sublime
author
lassulus
date
2 years ago
(Feb 16, 2025, 3:26 AM CET)
commit
cf2e6a31
cf2e6a311415e48edb4ae608bb0cd87e0c9b8ae5
parent
da2c4ff9
da2c4ff9e60f6bb758f4f52b8390237f6d546472
+20
-8
1 changed file
Expand all
Collapse all
Unified
Split
2configs
mpv.nix
+20
-8
2configs/mpv.nix
View file
Reviewed
···
1
1
{ pkgs, ... }:
2
2
3
3
let
4
4
-
dl_subs = pkgs.writers.writeDashBin "dl_subs" ''
5
5
-
set -efu
6
6
-
filename=$1
7
7
-
cd "$(dirname "$filename")"
8
8
-
filename=$(basename "$filename")
9
9
-
${pkgs.subdl}/bin/subdl --download=best-rating --existing=overwrite --output='/tmp/{m}.{M}.sub' "$filename" 1>&2
10
10
-
echo "/tmp/$filename.sub"
4
4
+
dl_subs = pkgs.writers.writePython3Bin "dl_subs" {
5
5
+
libraries = [ pkgs.python3Packages.subliminal ];
6
6
+
flakeIgnore = [ "E501" ];
7
7
+
} ''
8
8
+
import babelfish
9
9
+
import subliminal
10
10
+
from pathlib import Path
11
11
+
import sys
12
12
+
import os
13
13
+
14
14
+
video_path = Path(sys.argv[1])
15
15
+
video = subliminal.scan_video(video_path)
16
16
+
cache_path = Path(os.path.expanduser("~/.cache/subliminal")) / f"{video.title}.srt"
17
17
+
if not cache_path.exists():
18
18
+
cache_path.parent.mkdir(parents=True, exist_ok=True)
19
19
+
language = babelfish.Language("eng")
20
20
+
sub = subliminal.download_best_subtitles([video], {language})[video][0]
21
21
+
cache_path.write_bytes(sub.content)
22
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
53
-
(pkgs.writeDashBin "mpv" ''
65
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