feat(nos): reenable subtitle management
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
6aec344314
commit
d624d33b01
12 changed files with 59 additions and 63 deletions
BIN
apps/config/package-lock.json
generated
BIN
apps/config/package-lock.json
generated
Binary file not shown.
|
@ -139,7 +139,9 @@ const main = async(): Promise<void> => {
|
|||
}
|
||||
|
||||
// Extract all subs
|
||||
subs.forEach((sub) => { extractSub(sub); });
|
||||
subs.forEach((sub) => {
|
||||
extractSub(sub);
|
||||
});
|
||||
});
|
||||
|
||||
removeContainerSubs();
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
./obsidian-livesync
|
||||
./qbittorrent
|
||||
./snapraid
|
||||
|
||||
# TODO: I need to actually do this properly before unleashing it on my library
|
||||
# ./subtitles
|
||||
./subtitles
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
{pkgs, ...}: let
|
||||
scriptSrc = pkgs.fetchFromGitHub {
|
||||
owner = "brianspilner01";
|
||||
repo = "media-server-scripts";
|
||||
rev = "00d9efcd37bb2667d23d7747240b59291cde64d3";
|
||||
hash = "sha256-Qql6Z+smU8vEJaai0POjdMnYpET9ak4NddNQevEQ8Ds=";
|
||||
};
|
||||
|
||||
script = pkgs.concatTextFile {
|
||||
name = "sub-clean.sh";
|
||||
files = ["${scriptSrc}/sub-clean.sh"];
|
||||
executable = true;
|
||||
};
|
||||
in
|
||||
pkgs.writeShellApplication {
|
||||
name = "sub-clean";
|
||||
|
||||
runtimeInputs = builtins.attrValues {
|
||||
inherit
|
||||
(pkgs)
|
||||
findutils
|
||||
gnugrep
|
||||
gawk
|
||||
;
|
||||
};
|
||||
|
||||
text = ''
|
||||
exec ${script} "$@"
|
||||
'';
|
||||
}
|
|
@ -1,13 +1,12 @@
|
|||
{pkgs, ...}:
|
||||
pkgs.writeShellApplication {
|
||||
name = "convertMkv";
|
||||
{
|
||||
writeShellApplication,
|
||||
ffmpeg-full,
|
||||
...
|
||||
}:
|
||||
writeShellApplication {
|
||||
name = "convert-mkv";
|
||||
|
||||
runtimeInputs = builtins.attrValues {
|
||||
inherit
|
||||
(pkgs)
|
||||
ffmpeg-full
|
||||
;
|
||||
};
|
||||
runtimeInputs = [ffmpeg-full];
|
||||
|
||||
text = ''
|
||||
extension="$1"
|
||||
|
|
|
@ -2,17 +2,15 @@
|
|||
config,
|
||||
mainUser,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
} @ inputs: let
|
||||
convertMkv = pkgs.callPackage ./convert.nix {inherit pkgs;};
|
||||
extractSubs = pkgs.callPackage ./extract-subs {inherit pkgs;};
|
||||
sub-clean = pkgs.callPackage ./cleanup.nix {inherit pkgs;};
|
||||
bazarr-bulk = pkgs.callPackage ./syncing.nix inputs;
|
||||
in {
|
||||
# TODO:
|
||||
# - Improve cleanup
|
||||
# - figure out bazarr postprocessing with syncing subs
|
||||
} @ extraArgs: let
|
||||
inherit (self.appsPackages.${pkgs.system}) extract-subs;
|
||||
inherit (self.packages.${pkgs.system}) subscleaner;
|
||||
|
||||
convert-mkv = pkgs.callPackage ./convert.nix {};
|
||||
bazarr-bulk = pkgs.callPackage ./syncing.nix ({} // extraArgs);
|
||||
in {
|
||||
environment.systemPackages = [
|
||||
bazarr-bulk
|
||||
];
|
||||
|
@ -25,22 +23,22 @@ in {
|
|||
};
|
||||
|
||||
path = [
|
||||
convertMkv
|
||||
extractSubs
|
||||
sub-clean
|
||||
bazarr-bulk
|
||||
convert-mkv
|
||||
extract-subs
|
||||
subscleaner
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Make sure every video file is a mkv
|
||||
find /data/{anime,history,movies,tv} -name '*.mp4' -exec convertMkv "mp4" "{}" \;
|
||||
find /data/{anime,history,movies,tv} -name '*.mp4' -exec convert-mkv "mp4" "{}" \;
|
||||
|
||||
# Export subs from mkv files
|
||||
find /data/{anime,history,movies,tv} -name '*.mkv' -printf "%h\0" |
|
||||
xargs -0 -I '{}' extract-subs '{}' "eng,fre"
|
||||
|
||||
# Remove ads and stuff in subs
|
||||
find /data/{anime,history,movies,tv} -name '*.srt' -exec sub-clean "{}" \;
|
||||
find /data/{anime,history,movies,tv} -name '*.srt' | subscleaner
|
||||
|
||||
# Bulk sync everything
|
||||
bb movies sync
|
||||
|
|
|
@ -2,14 +2,17 @@
|
|||
bazarr-bulk,
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
system,
|
||||
writeShellApplication,
|
||||
...
|
||||
}: let
|
||||
bbPkg = bazarr-bulk.packages.${pkgs.system}.default;
|
||||
inherit (lib) getExe;
|
||||
|
||||
bbPkg = bazarr-bulk.packages.${system}.default;
|
||||
in
|
||||
pkgs.writeShellApplication {
|
||||
writeShellApplication {
|
||||
name = "bb";
|
||||
text = ''
|
||||
exec ${lib.getExe bbPkg} --config ${config.sops.secrets.bazarr-bulk.path} "$@"
|
||||
exec ${getExe bbPkg} --config ${config.sops.secrets.bazarr-bulk.path} "$@"
|
||||
'';
|
||||
}
|
||||
|
|
BIN
flake.lock
BIN
flake.lock
Binary file not shown.
BIN
flake.nix
BIN
flake.nix
Binary file not shown.
|
@ -67,6 +67,11 @@ let
|
|||
repo = "nurl";
|
||||
};
|
||||
|
||||
poetry2nix = mkInput {
|
||||
owner = "nix-community";
|
||||
repo = "poetry2nix";
|
||||
};
|
||||
|
||||
# These are here to make sure all 'systems' and popular inputs are the same
|
||||
flake-compat = mkInput {
|
||||
owner = "edolstra";
|
||||
|
@ -336,6 +341,11 @@ let
|
|||
owner = "rushsteve1";
|
||||
repo = "trash-d";
|
||||
}
|
||||
{
|
||||
type = "gitlab";
|
||||
owner = "rogs";
|
||||
repo = "subscleaner";
|
||||
}
|
||||
{
|
||||
type = "gitlab";
|
||||
owner = "mishakmak";
|
||||
|
|
|
@ -45,6 +45,10 @@
|
|||
|
||||
some-sass-language-server = pkgs.callPackage ./some-sass-language-server {};
|
||||
|
||||
subscleaner = pkgs.callPackage ./subscleaner {
|
||||
inherit (inputs) poetry2nix subscleaner-src;
|
||||
};
|
||||
|
||||
trash-d = pkgs.callPackage ./trash-d {
|
||||
inherit (inputs) trash-d-src;
|
||||
};
|
||||
|
|
12
packages/subscleaner/default.nix
Normal file
12
packages/subscleaner/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
pkgs,
|
||||
poetry2nix,
|
||||
subscleaner-src,
|
||||
...
|
||||
}: let
|
||||
inherit (poetry2nix.lib.mkPoetry2Nix {inherit pkgs;}) mkPoetryApplication;
|
||||
in
|
||||
mkPoetryApplication {
|
||||
projectDir = subscleaner-src;
|
||||
preferWheels = true;
|
||||
}
|
Loading…
Reference in a new issue