summaryrefslogtreecommitdiffstats
path: root/lass/2configs/mpv.nix
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2020-04-22 00:30:37 +0200
committermakefu <github@syntax-fehler.de>2020-04-22 00:30:37 +0200
commitcb7ea9d84af46b606e5daa1252c60eb210d7e576 (patch)
tree5166a62dc73c45b3cd3b996078913588d1844266 /lass/2configs/mpv.nix
parent0b371833e9ef68fd891fac65a657d8e38b5b3fad (diff)
parentc49867b40327f83a18b956404875637ca379c1ba (diff)
Merge remote-tracking branch 'lass/20.03' into 20.03
Diffstat (limited to 'lass/2configs/mpv.nix')
-rw-r--r--lass/2configs/mpv.nix15
1 files changed, 8 insertions, 7 deletions
diff --git a/lass/2configs/mpv.nix b/lass/2configs/mpv.nix
index 7dc43a9ee..5d7bfed60 100644
--- a/lass/2configs/mpv.nix
+++ b/lass/2configs/mpv.nix
@@ -12,14 +12,17 @@ let
video_filename = sys.argv[1]
vid = scan_video(video_filename)
- sub = download_best_subtitles([vid], {Language('eng')})[vid][0]
+ try:
+ sub = download_best_subtitles([vid], {Language('eng')})[vid][0]
- filename = '/tmp/' + vid.title + '.srt'
+ filename = '/tmp/' + vid.title + '.srt'
- with open(filename, 'wb+') as file:
- file.write(sub.content)
+ with open(filename, 'wb+') as file:
+ file.write(sub.content)
- print(filename)
+ print(filename)
+ except: # noqa
+ print("/dev/null")
'';
autosub = pkgs.writeText "autosub.lua" ''
@@ -70,7 +73,6 @@ let
download()
end
- mp.register_event('file-loaded', control_download)
mp.add_key_binding('S', "download_subs", download)
'';
@@ -79,7 +81,6 @@ let
paths = [
(pkgs.writeDashBin "mpv" ''
exec ${pkgs.mpv}/bin/mpv --no-config --script=${autosub} "$@"
- # exec ${pkgs.mpv}/bin/mpv --no-config "$@"
'')
pkgs.mpv
];