feat(subs): add bazarr-bulk sync and timer
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-05-18 23:49:54 -04:00
parent 682db6c529
commit 638430a8e3
3 changed files with 24 additions and 22 deletions

View file

@ -2,20 +2,22 @@
config, config,
pkgs, pkgs,
... ...
}: let } @ inputs: let
inherit (config.vars) mainUser; inherit (config.vars) mainUser;
convertMkv = pkgs.callPackage ./convert.nix {inherit pkgs;}; convertMkv = pkgs.callPackage ./convert.nix {inherit pkgs;};
exportSubs = pkgs.callPackage ./extract-subs {inherit pkgs;}; extractSubs = pkgs.callPackage ./extract-subs {inherit pkgs;};
sub-clean = pkgs.callPackage ./cleanup.nix {inherit pkgs;}; sub-clean = pkgs.callPackage ./cleanup.nix {inherit pkgs;};
bazarr-bulk = pkgs.callPackage ./syncing.nix inputs;
in { in {
imports = [
./syncing.nix
# TODO: # TODO:
# - Improve cleanup # - Improve cleanup
# - Sync with bazarr-bulk
# - figure out bazarr postprocessing with subsync # - figure out bazarr postprocessing with subsync
environment.systemPackages = [
bazarr-bulk
]; ];
systemd = { systemd = {
services.manage-subs = { services.manage-subs = {
serviceConfig = { serviceConfig = {
@ -26,8 +28,9 @@ in {
path = [ path = [
convertMkv convertMkv
exportSubs extractSubs
sub-clean sub-clean
bazarr-bulk
]; ];
script = '' script = ''
@ -40,15 +43,17 @@ in {
# Remove ads and stuff in subs # 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' -exec sub-clean "{}" \;
# Bulk sync everything
bb movies sync
bb tv-shows sync
''; '';
}; };
/* timers.manage-subs = {
timers.sub-clean = {
wantedBy = ["timers.target"]; wantedBy = ["timers.target"];
partOf = ["manage-subs.service"]; partOf = ["manage-subs.service"];
timerConfig.OnCalendar = ["0:00:00"]; timerConfig.OnCalendar = ["0:00:00"];
}; };
*/
}; };
} }

View file

@ -6,13 +6,10 @@
... ...
}: let }: let
bbPkg = bazarr-bulk.packages.${pkgs.system}.default; bbPkg = bazarr-bulk.packages.${pkgs.system}.default;
in { in
environment.systemPackages = [ pkgs.writeShellApplication {
(pkgs.writeShellApplication {
name = "bb"; name = "bb";
text = '' text = ''
exec ${lib.getExe bbPkg} --config ${config.sops.secrets.bazarr-bulk.path} "$@" exec ${lib.getExe bbPkg} --config ${config.sops.secrets.bazarr-bulk.path} "$@"
''; '';
})
];
} }

Binary file not shown.