refactor(subsync): use flake instead
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-04-04 08:57:19 -04:00
parent 2ed1ee2281
commit fc33a7c1fc
17 changed files with 77 additions and 216 deletions

View file

@ -14,7 +14,7 @@ in {
./modules/qbittorrent
./modules/snapraid.nix
./modules/subtitles/cleanup.nix
./modules/subtitles/syncing
./modules/subtitles/syncing.nix
];
vars = {

View file

@ -97,6 +97,11 @@ async function main() {
// ffprobe the video file to see available audio tracks
ffProbe(VIDEO, (_e, data) => {
if (!data?.streams) {
console.error('Couldn\'t find streams in video file');
process.exit(1);
}
const AVAIL_LANGS = data.streams
.filter((s) => s.codec_type === 'audio')
.map((s) => s['tags'] && s['tags']['language']);

View file

@ -1,20 +1,18 @@
{
config,
pkgs,
pocketsphinx-src,
subsync-src,
subsync,
...
}: let
inherit (config.vars) mainUser;
subsync = pkgs.callPackage ./subsync {
inherit pocketsphinx-src subsync-src;
};
subsyncPkg = subsync.packages.${pkgs.system}.default;
node-syncsub = pkgs.callPackage ./node-syncsub {
inherit subsync;
subsync = subsyncPkg;
};
in {
environment.systemPackages = [subsync node-syncsub];
environment.systemPackages = [subsyncPkg node-syncsub];
systemd = {
services.subsync-job = {
@ -26,7 +24,6 @@ in {
path = with pkgs; [
findutils
subsync
node-syncsub
];
@ -36,10 +33,10 @@ in {
# find /data/tv -name '*.mkv' -printf "%h\0" | xargs -0 -I '{}' node-syncsub '{}' "eng,fra"
'';
};
timers.subsync-job = {
wantedBy = ["timers.target"];
partOf = ["subsync-job.service"];
timerConfig.OnCalendar = ["0:00:00"];
};
#timers.subsync-job = {
# wantedBy = ["timers.target"];
# partOf = ["subsync-job.service"];
# timerConfig.OnCalendar = ["0:00:00"];
#};
};
}

View file

@ -1,64 +0,0 @@
{
callPackage,
ffmpeg,
pkg-config,
pocketsphinx-src,
python3Packages,
subsync-src,
...
} @ pkgs: let
inherit (builtins) concatStringsSep;
sphinxbase = callPackage ./sphinxbase.nix pkgs;
pocketsphinx =
callPackage ./pocketsphinx.nix (pkgs
// {inherit pocketsphinx-src sphinxbase;});
in
python3Packages.buildPythonPackage {
pname = "subsync";
version = subsync-src.shortRev;
src = subsync-src;
buildInputs = [
ffmpeg
pkg-config
sphinxbase
pocketsphinx
];
nativeBuildInputs = with python3Packages; [
pip
setuptools
wheel
];
propagatedBuildInputs = with python3Packages; [
certifi
cryptography
pybind11
pycryptodome
pysubs2
pyyaml
requests
utils
];
patches = [./patches/cstdint.patch];
# The tests are for the GUI
doCheck = false;
# 'pip install .' takes care of building the package
buildPhase = "";
installPhase = ''
python -m pip install . ${concatStringsSep " " [
"--no-index"
"--no-warn-script-location"
"--prefix=\"$out\""
"--no-cache"
]}
'';
}

View file

@ -1,25 +0,0 @@
diff --git a/gizmo/text/utf8.h b/gizmo/text/utf8.h
index 7c3bcdb..99f1a92 100644
--- a/gizmo/text/utf8.h
+++ b/gizmo/text/utf8.h
@@ -2,6 +2,7 @@
#define __UTF8_H__
#include <string>
+#include <cstdint>
class Utf8
diff --git a/gizmo/text/ssa.h b/gizmo/text/ssa.h
index 66d9918..170e265 100644
--- a/gizmo/text/ssa.h
+++ b/gizmo/text/ssa.h
@@ -5,6 +5,7 @@
#include <list>
#include <set>
#include <string>
+#include <cstdint>
class SSAParser

View file

@ -1,26 +0,0 @@
diff --git a/m4/ax_python_devel.m4 b/m4/ax_python_devel.m4
index 59a2ff09..af64eab2 100644
--- a/m4/ax_python_devel.m4
+++ b/m4/ax_python_devel.m4
@@ -132,21 +132,6 @@ variable to configure. See ``configure --help'' for reference.
fi
fi
- #
- # Check if you have distutils, else fail
- #
- AC_MSG_CHECKING([for the distutils Python package])
- ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
- if test -z "$ac_distutils_result"; then
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- AC_MSG_ERROR([cannot import Python module "distutils".
-Please check your Python installation. The error was:
-$ac_distutils_result])
- PYTHON_VERSION=""
- fi
-
#
# Check for Python include path
#

View file

@ -1,40 +0,0 @@
{
autoreconfHook,
fetchFromGitHub,
pkg-config,
python3,
sphinxbase,
stdenv,
swig2,
...
}:
stdenv.mkDerivation {
pname = "pocketsphinx";
version = "5prealpha";
src = fetchFromGitHub {
owner = "cmusphinx";
repo = "pocketsphinx";
rev = "5da71f0a05350c923676b02a69423d1291825d5b";
hash = "sha256-YZwuVYg8Uqt1gOYXeYC8laRj+IObbuO9f/BjcQKRwkY=";
};
patches = [./patches/distutils.patch];
autoreconfPhase = ''
./autogen.sh
'';
nativeBuildInputs = [
autoreconfHook
pkg-config
swig2
python3
];
propagatedBuildInputs = [
sphinxbase
];
postFixup = ''
cp $out/include/pocketsphinx/* $out/include
'';
}

View file

@ -1,32 +0,0 @@
{
autoreconfHook,
bison,
fetchFromGitHub,
pkg-config,
python3,
stdenv,
swig2,
...
}:
stdenv.mkDerivation {
name = "sphinxbase";
version = "5prealpha"; # Deprecated
buildInputs = [bison pkg-config python3 swig2];
nativeBuildInputs = [autoreconfHook];
autoreconfPhase = ''
./autogen.sh
'';
src = fetchFromGitHub {
owner = "cmusphinx";
repo = "sphinxbase";
rev = "617e53691889336a482631380f75b453445d0dae";
hash = "sha256-w/Huz4+crTzdiSyQVAx0h3lhtTTrtPyKp3xpQD5EG9g=";
};
postFixup = ''
cp $out/include/sphinxbase/* $out/include/
'';
}

View file

@ -1405,6 +1405,23 @@
"type": "github"
}
},
"pocketsphinx-src_2": {
"flake": false,
"locked": {
"lastModified": 1645539790,
"narHash": "sha256-YZwuVYg8Uqt1gOYXeYC8laRj+IObbuO9f/BjcQKRwkY=",
"owner": "cmusphinx",
"repo": "pocketsphinx",
"rev": "5da71f0a05350c923676b02a69423d1291825d5b",
"type": "github"
},
"original": {
"owner": "cmusphinx",
"ref": "last-pre-1.0",
"repo": "pocketsphinx",
"type": "github"
}
},
"pointer-event-src": {
"flake": false,
"locked": {
@ -1496,7 +1513,7 @@
"pointer-event-src": "pointer-event-src",
"pokemon-colorscripts-src": "pokemon-colorscripts-src",
"secrets": "secrets",
"subsync-src": "subsync-src",
"subsync": "subsync",
"touch-gestures-src": "touch-gestures-src",
"trash-d-src": "trash-d-src",
"vimplugin-riscv-src": "vimplugin-riscv-src",
@ -1562,19 +1579,43 @@
"type": "github"
}
},
"subsync-src": {
"sphinxbase-src": {
"flake": false,
"locked": {
"lastModified": 1681249928,
"narHash": "sha256-jUur1U1yNShQx70/mj36+sGoVk8+E5hQUV/G79q2A2k=",
"owner": "sc0ty",
"repo": "subsync",
"rev": "8e0cf71960b9a5418acb60a1910cf3295d67e6bf",
"lastModified": 1654774494,
"narHash": "sha256-w/Huz4+crTzdiSyQVAx0h3lhtTTrtPyKp3xpQD5EG9g=",
"owner": "cmusphinx",
"repo": "sphinxbase",
"rev": "617e53691889336a482631380f75b453445d0dae",
"type": "github"
},
"original": {
"owner": "sc0ty",
"owner": "cmusphinx",
"repo": "sphinxbase",
"rev": "617e53691889336a482631380f75b453445d0dae",
"type": "github"
}
},
"subsync": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"pocketsphinx-src": "pocketsphinx-src_2",
"sphinxbase-src": "sphinxbase-src"
},
"locked": {
"lastModified": 1712018289,
"narHash": "sha256-JYG+GQuyvDoZ6TWD0lDjaWDNTq5FxNh3AymTHxWyggI=",
"owner": "matt1432",
"repo": "subsync",
"rev": "ee9e1592ae4ec7c694d8857aa72be079d81ea209",
"type": "github"
},
"original": {
"owner": "matt1432",
"repo": "subsync",
"rev": "ee9e1592ae4ec7c694d8857aa72be079d81ea209",
"type": "github"
}
},

View file

@ -199,6 +199,7 @@
inputs.nixpkgs.follows = "nixpkgs";
};
jellyfin-flake = {
type = "github";
owner = "matt1432";
@ -207,6 +208,17 @@
inputs.nixpkgs.follows = "nixpkgs";
};
subsync = {
type = "github";
owner = "matt1432";
repo = "subsync";
# Keep version that uses Sphinxbase
rev = "ee9e1592ae4ec7c694d8857aa72be079d81ea209";
inputs.nixpkgs.follows = "nixpkgs";
};
# Desktop inputs
hyprland = {
type = "github";
@ -300,13 +312,6 @@
flake = false;
};
subsync-src = {
type = "github";
owner = "sc0ty";
repo = "subsync";
flake = false;
};
trash-d-src = {
type = "github";
owner = "rushsteve1";