Compare commits
4 Commits
ae6915c204
...
288a90f366
| Author | SHA1 | Date | |
|---|---|---|---|
|
288a90f366
|
|||
|
de089f8f64
|
|||
|
5548b9e280
|
|||
|
e77a6cbfcf
|
@@ -6,121 +6,117 @@
|
||||
...
|
||||
}:
|
||||
let
|
||||
radarrPort = builtins.toString service_configs.ports.radarr;
|
||||
sonarrPort = builtins.toString service_configs.ports.sonarr;
|
||||
configTemplate = (pkgs.formats.yaml {}).generate "recyclarr.yml" {
|
||||
radarr.movies = {
|
||||
base_url = "http://localhost:${builtins.toString service_configs.ports.radarr}";
|
||||
api_key = "RADARR_API_KEY_PLACEHOLDER";
|
||||
|
||||
configTemplate = pkgs.writeText "recyclarr.yml" ''
|
||||
radarr:
|
||||
movies:
|
||||
base_url: http://localhost:${radarrPort}
|
||||
api_key: RADARR_API_KEY_PLACEHOLDER
|
||||
include = [
|
||||
{ template = "radarr-quality-definition-movie"; }
|
||||
{ template = "radarr-quality-profile-remux-web-2160p"; }
|
||||
{ template = "radarr-custom-formats-remux-web-2160p"; }
|
||||
];
|
||||
|
||||
include:
|
||||
- template: radarr-quality-definition-movie
|
||||
- template: radarr-quality-profile-remux-web-2160p
|
||||
- template: radarr-custom-formats-remux-web-2160p
|
||||
quality_profiles = [{
|
||||
name = "Remux + WEB 2160p";
|
||||
upgrade = {
|
||||
allowed = true;
|
||||
until_quality = "Remux-2160p";
|
||||
};
|
||||
qualities = [
|
||||
{ name = "Remux-2160p"; }
|
||||
{
|
||||
name = "WEB 2160p";
|
||||
qualities = [ "WEBDL-2160p" "WEBRip-2160p" ];
|
||||
}
|
||||
{ name = "Remux-1080p"; }
|
||||
{ name = "Bluray-1080p"; }
|
||||
{
|
||||
name = "WEB 1080p";
|
||||
qualities = [ "WEBDL-1080p" "WEBRip-1080p" ];
|
||||
}
|
||||
{ name = "HDTV-1080p"; }
|
||||
];
|
||||
}];
|
||||
|
||||
# Override template to also allow 1080p (2160p still prioritized via cutoff)
|
||||
quality_profiles:
|
||||
- name: Remux + WEB 2160p
|
||||
upgrade:
|
||||
allowed: true
|
||||
until_quality: Remux-2160p
|
||||
qualities:
|
||||
- name: Remux-2160p
|
||||
- name: WEB 2160p
|
||||
qualities:
|
||||
- WEBDL-2160p
|
||||
- WEBRip-2160p
|
||||
- name: Remux-1080p
|
||||
- name: Bluray-1080p
|
||||
- name: WEB 1080p
|
||||
qualities:
|
||||
- WEBDL-1080p
|
||||
- WEBRip-1080p
|
||||
- name: HDTV-1080p
|
||||
custom_formats = [
|
||||
# Upscaled
|
||||
{
|
||||
trash_ids = [ "bfd8eb01832d646a0a89c4deb46f8564" ];
|
||||
assign_scores_to = [{ name = "Remux + WEB 2160p"; score = -10000; }];
|
||||
}
|
||||
# x265 (HD) - override template -10000 penalty
|
||||
{
|
||||
trash_ids = [ "dc98083864ea246d05a42df0d05f81cc" ];
|
||||
assign_scores_to = [{ name = "Remux + WEB 2160p"; score = 0; }];
|
||||
}
|
||||
# x265 (no HDR/DV) - override template -10000 penalty
|
||||
{
|
||||
trash_ids = [ "839bea857ed2c0a8e084f3cbdbd65ecb" ];
|
||||
assign_scores_to = [{ name = "Remux + WEB 2160p"; score = 0; }];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
custom_formats:
|
||||
- trash_ids:
|
||||
- bfd8eb01832d646a0a89c4deb46f8564 # Upscaled
|
||||
assign_scores_to:
|
||||
- name: Remux + WEB 2160p
|
||||
score: -10000
|
||||
# Codec preferences: allow x265/HEVC (override template -10000 penalties)
|
||||
- trash_ids:
|
||||
- dc98083864ea246d05a42df0d05f81cc # x265 (HD)
|
||||
assign_scores_to:
|
||||
- name: Remux + WEB 2160p
|
||||
score: 0
|
||||
- trash_ids:
|
||||
- 839bea857ed2c0a8e084f3cbdbd65ecb # x265 (no HDR/DV)
|
||||
assign_scores_to:
|
||||
- name: Remux + WEB 2160p
|
||||
score: 0
|
||||
- trash_ids:
|
||||
- cae4ca30163749b891686f95532519bd # AV1
|
||||
assign_scores_to:
|
||||
- name: Remux + WEB 2160p
|
||||
score: 0
|
||||
sonarr.series = {
|
||||
base_url = "http://localhost:${builtins.toString service_configs.ports.sonarr}";
|
||||
api_key = "SONARR_API_KEY_PLACEHOLDER";
|
||||
|
||||
sonarr:
|
||||
series:
|
||||
base_url: http://localhost:${sonarrPort}
|
||||
api_key: SONARR_API_KEY_PLACEHOLDER
|
||||
include = [
|
||||
{ template = "sonarr-quality-definition-series"; }
|
||||
{ template = "sonarr-v4-quality-profile-web-2160p"; }
|
||||
{ template = "sonarr-v4-custom-formats-web-2160p"; }
|
||||
];
|
||||
|
||||
include:
|
||||
- template: sonarr-quality-definition-series
|
||||
- template: sonarr-v4-quality-profile-web-2160p
|
||||
- template: sonarr-v4-custom-formats-web-2160p
|
||||
quality_profiles = [{
|
||||
name = "WEB-2160p";
|
||||
upgrade = {
|
||||
allowed = true;
|
||||
until_quality = "WEB 2160p";
|
||||
};
|
||||
qualities = [
|
||||
{
|
||||
name = "WEB 2160p";
|
||||
qualities = [ "WEBDL-2160p" "WEBRip-2160p" ];
|
||||
}
|
||||
{ name = "Bluray-1080p Remux"; }
|
||||
{ name = "Bluray-1080p"; }
|
||||
{
|
||||
name = "WEB 1080p";
|
||||
qualities = [ "WEBDL-1080p" "WEBRip-1080p" ];
|
||||
}
|
||||
{ name = "HDTV-1080p"; }
|
||||
];
|
||||
}];
|
||||
|
||||
# Override template to also allow 1080p (2160p still prioritized via cutoff)
|
||||
quality_profiles:
|
||||
- name: WEB-2160p
|
||||
upgrade:
|
||||
allowed: true
|
||||
until_quality: WEB 2160p
|
||||
qualities:
|
||||
- name: WEB 2160p
|
||||
qualities:
|
||||
- WEBDL-2160p
|
||||
- WEBRip-2160p
|
||||
- name: Bluray-1080p Remux
|
||||
- name: Bluray-1080p
|
||||
- name: WEB 1080p
|
||||
qualities:
|
||||
- WEBDL-1080p
|
||||
- WEBRip-1080p
|
||||
- name: HDTV-1080p
|
||||
|
||||
custom_formats:
|
||||
- trash_ids:
|
||||
- 23297a736ca77c0fc8e70f8edd7ee56c # Upscaled
|
||||
assign_scores_to:
|
||||
- name: WEB-2160p
|
||||
score: -10000
|
||||
# Codec preferences: allow x265/HEVC (override template -10000 penalties)
|
||||
- trash_ids:
|
||||
- 47435ece6b99a0b477caf360e79ba0bb # x265 (HD)
|
||||
assign_scores_to:
|
||||
- name: WEB-2160p
|
||||
score: 0
|
||||
- trash_ids:
|
||||
- 9b64dff695c2115facf1b6ea59c9bd07 # x265 (no HDR/DV)
|
||||
assign_scores_to:
|
||||
- name: WEB-2160p
|
||||
score: 0
|
||||
- trash_ids:
|
||||
- 15a05bc7c1a36e2b57fd628f8977e2fc # AV1
|
||||
assign_scores_to:
|
||||
- name: WEB-2160p
|
||||
score: 0
|
||||
'';
|
||||
custom_formats = [
|
||||
# Upscaled
|
||||
{
|
||||
trash_ids = [ "23297a736ca77c0fc8e70f8edd7ee56c" ];
|
||||
assign_scores_to = [{ name = "WEB-2160p"; score = -10000; }];
|
||||
}
|
||||
# x265 (HD) - override template -10000 penalty
|
||||
{
|
||||
trash_ids = [ "47435ece6b99a0b477caf360e79ba0bb" ];
|
||||
assign_scores_to = [{ name = "WEB-2160p"; score = 0; }];
|
||||
}
|
||||
# x265 (no HDR/DV) - override template -10000 penalty
|
||||
{
|
||||
trash_ids = [ "9b64dff695c2115facf1b6ea59c9bd07" ];
|
||||
assign_scores_to = [{ name = "WEB-2160p"; score = 0; }];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
dataDir = service_configs.recyclarr.dataDir;
|
||||
radarrConfig = "${service_configs.radarr.dataDir}/config.xml";
|
||||
sonarrConfig = "${service_configs.sonarr.dataDir}/config.xml";
|
||||
|
||||
# Script to inject API keys from sonarr/radarr config.xml at runtime
|
||||
user = "recyclarr";
|
||||
group = "recyclarr";
|
||||
|
||||
# Runs as root (via + prefix) to read API keys from config.xml, then chowns output
|
||||
generateConfig = pkgs.writeShellScript "recyclarr-generate-config" ''
|
||||
RADARR_KEY=$(${pkgs.gnugrep}/bin/grep -oP '(?<=<ApiKey>)[^<]+' ${radarrConfig})
|
||||
SONARR_KEY=$(${pkgs.gnugrep}/bin/grep -oP '(?<=<ApiKey>)[^<]+' ${sonarrConfig})
|
||||
@@ -128,6 +124,7 @@ let
|
||||
-e "s/RADARR_API_KEY_PLACEHOLDER/$RADARR_KEY/" \
|
||||
-e "s/SONARR_API_KEY_PLACEHOLDER/$SONARR_KEY/" \
|
||||
${configTemplate} > ${dataDir}/recyclarr.yml
|
||||
chown ${user}:${group} ${dataDir}/recyclarr.yml
|
||||
'';
|
||||
in
|
||||
{
|
||||
@@ -138,8 +135,8 @@ in
|
||||
];
|
||||
|
||||
systemd.tmpfiles.rules = [
|
||||
"d ${dataDir} 0755 root root -"
|
||||
"d ${dataDir}/data 0755 root root -"
|
||||
"d ${dataDir} 0755 ${user} ${group} -"
|
||||
"d ${dataDir}/data 0755 ${user} ${group} -"
|
||||
];
|
||||
|
||||
systemd.services.recyclarr = {
|
||||
@@ -148,11 +145,21 @@ in
|
||||
wants = [ "network-online.target" ];
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStartPre = "${generateConfig}";
|
||||
ExecStart = "${pkgs.recyclarr}/bin/recyclarr sync --config ${dataDir}/recyclarr.yml --app-data ${dataDir}/data";
|
||||
User = user;
|
||||
Group = group;
|
||||
ExecStartPre = "+${generateConfig}";
|
||||
ExecStart = "${lib.getExe pkgs.recyclarr} sync --config ${dataDir}/recyclarr.yml --app-data ${dataDir}/data";
|
||||
};
|
||||
};
|
||||
|
||||
users.users.${user} = {
|
||||
isSystemUser = true;
|
||||
group = group;
|
||||
home = dataDir;
|
||||
};
|
||||
|
||||
users.groups.${group} = {};
|
||||
|
||||
systemd.timers.recyclarr = {
|
||||
description = "Run Recyclarr daily";
|
||||
wantedBy = [ "timers.target" ];
|
||||
|
||||
Reference in New Issue
Block a user