From dc7155be6cfe6f2b029fd70bcfa20d3929be6e62 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 18 Feb 2020 14:47:15 +0100 Subject: krops: 1.19.0 -> 1.20.0 --- submodules/krops | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/submodules/krops b/submodules/krops index f1b7112ac..ed9fc6658 160000 --- a/submodules/krops +++ b/submodules/krops @@ -1 +1 @@ -Subproject commit f1b7112ac3cbe090e96f2c82c525b6db69b82034 +Subproject commit ed9fc6658226b1525bc008205d76276f0054c6c5 -- cgit v1.2.3 From cd268ca24967733172dbe5c3fe62fefbbdf80e44 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 18 Feb 2020 14:57:16 +0100 Subject: krebs krops: use upstream writers --- krebs/krops.nix | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/krebs/krops.nix b/krebs/krops.nix index 1f439f622..608e46df1 100644 --- a/krebs/krops.nix +++ b/krebs/krops.nix @@ -31,18 +31,19 @@ }; }; stockholm.file = toString ../.; - stockholm-version.pipe = toString (pkgs.writeDash "${name}-version" '' - set -efu - cd ${lib.escapeShellArg stockholm.file} - V=$(${pkgs.coreutils}/bin/date +%y.%m) - if test -d .git; then - V=$V.git.$(${pkgs.git}/bin/git describe --always --dirty) - case $V in (*-dirty) - V=$V@''${HOSTNAME-$(${pkgs.nettools}/bin/hostname)} - esac - fi - printf %s "$V" - ''); + stockholm-version.pipe = + toString (pkgs.writers.writeDash "${name}-version" '' + set -efu + cd ${lib.escapeShellArg stockholm.file} + V=$(${pkgs.coreutils}/bin/date +%y.%m) + if test -d .git; then + V=$V.git.$(${pkgs.git}/bin/git describe --always --dirty) + case $V in (*-dirty) + V=$V@''${HOSTNAME-$(${pkgs.nettools}/bin/hostname)} + esac + fi + printf %s "$V" + ''); }; source ={ test }: lib.evalSource [ -- cgit v1.2.3 From 86fe7dcad6658a4b363ea38bae1f0bd8632022de Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 26 Feb 2020 19:37:26 +0100 Subject: nixpkgs: c49da64 -> b7bbc6d --- krebs/nixpkgs.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/krebs/nixpkgs.json b/krebs/nixpkgs.json index 769bacbe0..e0b37d1fc 100644 --- a/krebs/nixpkgs.json +++ b/krebs/nixpkgs.json @@ -1,7 +1,7 @@ { "url": "https://github.com/NixOS/nixpkgs-channels", - "rev": "c49da6435f314e04fc58ca29807221817ac2ac6b", - "date": "2020-02-07T12:52:16+01:00", - "sha256": "17zsqhaf098bvcfarnq0h9601z6smkfd1kz1px6xfg6xqfmr80r7", + "rev": "b7bbc6d37878ed00b6467b574b02e840279f7d3d", + "date": "2020-02-26T11:51:29+01:00", + "sha256": "02q10jgi6m0vak3amb50ifw1pj82i17hs0npdkig7lsp8w3is7jq", "fetchSubmodules": false } -- cgit v1.2.3 From 12eb826002182c2c3ca0084b2620f8395e3b8bc1 Mon Sep 17 00:00:00 2001 From: lassulus Date: Wed, 26 Feb 2020 19:37:54 +0100 Subject: nixpkgs-unstable: 100012e -> 55beed9 --- krebs/nixpkgs-unstable.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/krebs/nixpkgs-unstable.json b/krebs/nixpkgs-unstable.json index 20bb6c107..1600d6f4a 100644 --- a/krebs/nixpkgs-unstable.json +++ b/krebs/nixpkgs-unstable.json @@ -1,7 +1,7 @@ { "url": "https://github.com/NixOS/nixpkgs-channels", - "rev": "100012e55bc2a82fc680cba31a426ad38ead6fab", - "date": "2020-01-12T00:04:23+00:00", - "sha256": "0cvnx852n0krci9hi1rpcldx1kcpmvi5ihf2awvwfayvzp4wic8z", + "rev": "55beed9922c2f6b030af61ca7e33bd47850c68f2", + "date": "2020-02-26T03:53:16-05:00", + "sha256": "0jxkb3bl7axa6vmfsfdfx4mxv6wx0pc8iiwgrw2qh8wxhlhbylks", "fetchSubmodules": false } -- cgit v1.2.3 From 89f3a94638a425f6f07950874263f2b3da25be04 Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 2 Mar 2020 20:52:21 +0100 Subject: l mpv: add autosub script --- lass/2configs/mpv.nix | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 1 deletion(-) diff --git a/lass/2configs/mpv.nix b/lass/2configs/mpv.nix index b3de42c7b..7dc43a9ee 100644 --- a/lass/2configs/mpv.nix +++ b/lass/2configs/mpv.nix @@ -2,11 +2,84 @@ let + download_subs = pkgs.writers.writePython3 "download_sub" { + libraries = [ pkgs.python3Packages.subliminal ]; + } '' + from subliminal import download_best_subtitles, scan_video + from babelfish import Language + import sys + + video_filename = sys.argv[1] + + vid = scan_video(video_filename) + sub = download_best_subtitles([vid], {Language('eng')})[vid][0] + + filename = '/tmp/' + vid.title + '.srt' + + with open(filename, 'wb+') as file: + file.write(sub.content) + + print(filename) + ''; + + autosub = pkgs.writeText "autosub.lua" '' + -- Requires Subliminal version 1.0 or newer + -- Make sure to specify your system's Subliminal location below: + local utils = require 'mp.utils' + + -- Log function: log to both terminal and mpv OSD (On-Screen Display) + function log(string, secs) + secs = secs or 2 -- secs defaults to 2 when the secs parameter is absent + mp.msg.warn(string) -- This logs to the terminal + mp.osd_message(string, secs) -- This logs to mpv screen + end + + function download() + log('Searching subtitles ...', 10) + table = { args = {"${download_subs}", mp.get_property('path')} } + result = utils.subprocess(table) + if result.error == nil then + -- remove trailing newline from subtitle filename + filename = string.gsub(result.stdout, "\n", "") + log(filename) + mp.commandv('sub_add', filename) + log('Subtitles ready!') + else + log('Subtitles failed downloading') + end + end + + -- Control function: only download if necessary + function control_download() + duration = tonumber(mp.get_property('duration')) + if duration < 900 then + mp.msg.warn('Video is less than 15 minutes\n', '=> NOT downloading any subtitles') + return + end + -- There does not seem to be any documentation for the 'sub' property, + -- but it works on both internally encoded as well as external subtitle files! + -- -> sub = '1' when subtitles are present + -- -> sub = 'no' when subtitles are not present + -- -> sub = 'auto' when called before the 'file-loaded' event is triggered + sub = mp.get_property('sub') + if sub == '1' then + mp.msg.warn('Sub track is already present\n', '=> NOT downloading other subtitles') + return + end + mp.msg.warn('No sub track was detected\n', '=> Proceeding to download subtitles:') + download() + end + + mp.register_event('file-loaded', control_download) + mp.add_key_binding('S', "download_subs", download) + ''; + mpv = pkgs.symlinkJoin { name = "mpv"; paths = [ (pkgs.writeDashBin "mpv" '' - exec ${pkgs.mpv}/bin/mpv --no-config "$@" + exec ${pkgs.mpv}/bin/mpv --no-config --script=${autosub} "$@" + # exec ${pkgs.mpv}/bin/mpv --no-config "$@" '') pkgs.mpv ]; -- cgit v1.2.3 From 23cba7672c9ede59102ad439b9a76ee8abdaf006 Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 3 Mar 2020 21:09:48 +0100 Subject: submodules: add brockman --- .gitmodules | 3 +++ submodules/brockman | 1 + 2 files changed, 4 insertions(+) create mode 160000 submodules/brockman diff --git a/.gitmodules b/.gitmodules index 5b4336510..aee01051a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "lass/5pkgs/autowifi"] path = lass/5pkgs/autowifi url = https://github.com/Lassulus/autowifi +[submodule "submodules/brockman"] + path = submodules/brockman + url = https://github.com/kmein/brockman.git diff --git a/submodules/brockman b/submodules/brockman new file mode 160000 index 000000000..1a5b3faa1 --- /dev/null +++ b/submodules/brockman @@ -0,0 +1 @@ +Subproject commit 1a5b3faa1185f8c0e7861ebadf07e48ac4bdf7e9 -- cgit v1.2.3 From 3493cd74a1f6942566fbad4b89f4d3c84f964868 Mon Sep 17 00:00:00 2001 From: tv Date: Tue, 17 Mar 2020 20:06:22 +0100 Subject: irc-announce: fix more portable cat2 --- krebs/5pkgs/simple/irc-announce/default.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/krebs/5pkgs/simple/irc-announce/default.nix b/krebs/5pkgs/simple/irc-announce/default.nix index dea30a056..a90814aa9 100644 --- a/krebs/5pkgs/simple/irc-announce/default.nix +++ b/krebs/5pkgs/simple/irc-announce/default.nix @@ -24,7 +24,12 @@ pkgs.writeDashBin "irc-announce" '' # echo2 and cat2 are used output to both, stdout and stderr # This is used to see what we send to the irc server. (debug output) echo2() { echo "$*"; echo "$*" >&2; } - cat2() { (read x ; echo "$x" ; echo "$x" >&2) } + cat2() { + while read -r line; do + echo "$line" + echo "$line" >&2 + done + } # privmsg_cat transforms stdin to a privmsg privmsg_cat() { awk '{ print "PRIVMSG "ENVIRON["IRC_CHANNEL"]" :"$0 }'; } -- cgit v1.2.3 From 2ec1535de5c3e751d2c98952d0f2eeb80d1d2e1e Mon Sep 17 00:00:00 2001 From: lassulus Date: Tue, 17 Mar 2020 21:39:38 +0100 Subject: l games: disable minecraft --- lass/2configs/games.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lass/2configs/games.nix b/lass/2configs/games.nix index c0e6beba4..63bfa53e0 100644 --- a/lass/2configs/games.nix +++ b/lass/2configs/games.nix @@ -65,7 +65,7 @@ in { createHome = true; useDefaultShell = true; packages = with pkgs; [ - minecraft + # minecraft steam-run scummvm dolphinEmu -- cgit v1.2.3