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 16 additions and 201 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/
'';
}

Binary file not shown.

BIN
flake.nix

Binary file not shown.