nyaasi: add sonarr compatibility setting for release titles

This commit is contained in:
Bogdan
2023-05-01 01:13:01 +03:00
parent dcf9df0c74
commit 5b6b8d8697

View File

@@ -31,6 +31,10 @@ settings:
type: checkbox
label: Prefer Magnet Links
default: true
- name: sonarr_compatibility
type: checkbox
label: Improve Sonarr compatibility by trying to add Season information into Release Titles
default: false
- name: filter-id
type: select
label: Filter
@@ -154,14 +158,16 @@ search:
args: ["_", 0]
title_default:
selector: td:nth-child(2) a:last-of-type
title_spanish:
title_phase1:
selector: td:nth-child(2) a:last-of-type:contains("[PuyaSubs!] ")
optional: true
filters:
- name: append
args: " Spanish"
title_optional:
text: "{{ or (.Result.title_spanish) (.Result.title_default) }}"
title_phase2:
text: "{{ or (.Result.title_phase1) (.Result.title_default) }}"
title_phase3:
text: "{{ .Result.title_phase2 }}"
filters:
- name: re_replace
args: ["(?i)\\b((?:S|Seasons?|EP?|Episodes?)\\s?)(\\d+)(?:\\-|[\\s~\\+àa&]+)(\\d+)\\b", "$1$2-$3"]
@@ -192,24 +198,26 @@ search:
- name: re_replace
args: ["(?i)\\b(?:EP|Episodes?)\\s?(\\d+(?:-\\d+)?)\\b(?!(?:-\\d+)?\\sS\\d+(?:-\\d+)?(?:E\\d+(?:-\\d+)?)?)", "$0 S01E$1"]
title_has_season:
text: "{{ .Result.title_optional }}"
text: "{{ .Result.title_phase3 }}"
filters:
- name: regexp
args: "(?i)(S\\d{1,3}(E\\d+)?)"
- name: append
args: "NULL"
title_has_episode:
text: "{{ .Result.title_optional }}"
text: "{{ .Result.title_phase3 }}"
filters:
- name: regexp
args: "\\b(.+? - ?)(\\d+) ([\\[\\(])\\b"
- name: append
args: "NULL"
title:
text: "{{ .Result.title_optional }}"
title_optional:
text: "{{ .Result.title_phase3 }}"
filters:
- name: append
args: "{{ if and (eq .Result.category_group_id \"1\") (and (eq .Result.title_has_season \"NULL\") (eq .Result.title_has_episode \"NULL\")) }} S01{{ else }}{{ end }}"
title:
text: "{{ if .Config.sonarr_compatibility }}{{ .Result.title_optional }}{{ else }}{{ .Result.title_phase2 }}{{ end }}"
details:
selector: td:nth-child(2) a:last-of-type
attribute: href