Skip to content

Commit

Permalink
yggtorrent: tidy up and normalise title and filtered title, fix "Sais…
Browse files Browse the repository at this point in the history
…on" to "S" resolve #6207 (#9114)
  • Loading branch information
xfouloux committed Jul 8, 2020
1 parent b498bfb commit 9fdd1d3
Showing 1 changed file with 34 additions and 19 deletions.
53 changes: 34 additions & 19 deletions src/Jackett.Common/Definitions/yggtorrent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,25 +198,28 @@ search:
# BY
# One Punch Man S02E10 OR One Punch Man S02E02
- name: re_replace # S 1-9 & EP >= 10
args: ["(.*)[sS]([1-9])\\s(\\d{2,3})$", "$1 S0$2E$3"]
args: ["(?i)(.*)s([1-9])\\s(\\d{2,3})$", "$1 S0$2E$3"]
- name: re_replace # S 1-9 & EP 1-9
args: ["(.*)[sS]([1-9])\\s(\\d{1})$", "$1 S0$2E0$3"]
args: ["(?i)(.*)s([1-9])\\s(\\d{1})$", "$1 S0$2E0$3"]
- name: re_replace # S >= 10 & EP >= 10
args: ["(.*)[sS]([1-9][0-9])\\s(\\d{2,3})$", "$1 S0$2E$3"]
args: ["(?i)(.*)s([1-9][0-9])\\s(\\d{2,3})$", "$1 S0$2E$3"]
- name: re_replace # S >= 10 & EP 1-9
args: ["(.*)[sS]([1-9][0-9])\\s(\\d{1})$", "$1 S0$2E0$3"]
args: ["(?i)(.*)s([1-9][0-9])\\s(\\d{1})$", "$1 S0$2E0$3"]
- name: re_replace # Full season S 1-9
args: ["(.*)[sS]([1-9])$", "$1 S0$2"]
args: ["(?i)(.*)s([1-9])$", "$1 S0$2"]
- name: re_replace # Full season S >= 10
args: ["(.*)[sS]([1-9][0-9])$", "$1 S$2"]
args: ["(?i)(.*)s([1-9][0-9])$", "$1 S$2"]
# END ANIME HACK
- name: replace
args: ["\"", ""]
- name: replace
args: [" ", " "]
- name: trim
paths:
- path: "https://{{ .Config.searchanddlurl }}/{{ if .Config.betasearchengine }}new_search{{else}}engine{{end}}/search?category={{ .Config.category }}&name={{ if .Config.betasearchengine }}{{ .Keywords }}{{else}}{{ re_replace .Keywords \"\\b[^\\s]+\\b\" \"\"$&\"\"}}{{end}}&description=&file=&uploader=&sub_category=&do=search&order={{ .Config.type }}&sort={{ .Config.sort }}"
followredirect: true
- path: "https://{{ .Config.searchanddlurl }}/{{ if .Config.betasearchengine }}new_search{{else}}engine{{end}}/search?category={{ .Config.category }}&name={{ if .Config.betasearchengine }}{{ .Keywords }}{{else}}{{ re_replace .Keywords \"\\b[^\\s]+\\b\" \"\"$&\"\"}}{{end}}&description=&file=&uploader=&sub_category=&do=search&order={{ .Config.type }}&sort={{ .Config.sort }}&page=50"
# Saison Word
- path: "https://{{ .Config.searchanddlurl }}/{{ if .Config.betasearchengine }}new_search{{else}}engine{{end}}/search?category={{ .Config.category }}&name={{ re_replace .Keywords \"[sS]0(\\d{1,2})\" \"Saison.$1\"}}&description=&file=&uploader=&sub_category=&do=search&order={{ .Config.type }}&sort={{ .Config.sort }}"
followredirect: true

rows:
Expand All @@ -231,19 +234,31 @@ search:
args: "/(\\d+)-"
title_normal:
selector: td:nth-child(2) > a
title_filtered:
selector: td:nth-child(2) > a
filters:
- name: re_replace # S 1-9 & EP >= 10
args: ["(?i)(.*)s([1-9])\\s(\\d{2,3})$", "$1 S0$2E$3"]
- name: re_replace # S 1-9 & EP 1-9
args: ["(?i)(.*)s([1-9])\\s(\\d{1})$", "$1 S0$2E0$3"]
- name: re_replace # S >= 10 & EP >= 10
args: ["(?i)(.*)s([1-9][0-9])\\s(\\d{2,3})$", "$1 S0$2E$3"]
- name: re_replace # S >= 10 & EP 1-9
args: ["(?i)(.*)s([1-9][0-9])\\s(\\d{1})$", "$1 S0$2E0$3"]
- name: re_replace # Full season S 1-9
args: ["(?i)(.*)s([1-9])$", "$1 S0$2"]
- name: re_replace # Full season S >= 10
args: ["(?i)(.*)s([1-9][0-9])$", "$1 S$2"]
- name: re_replace
args: ["(?i)^(?:(.+?)((?:[\\.\\-\\s_\\[]+(?:imax|(?:dvd|bd|tv)(?:rip|scr)|bluray(?:\\-?rip)?|720\\s*p?|1080\\s*p?|vof?|vost(?:fr)?|multi|vf(?:f|q)?[1-3]?|(?:true)?french|eng?)[\\.\\-\\s_\\]]*)*)([\\(\\[]?(?:20|1[7-9])\\d{2}[\\)\\]]?)(.*)$|(.*))$", "$1 $3 $2 $4 $5"]
# Replace Saison/saison by 'S' to match for Full season search Sonarrv3 and tidy up
args: ["(?i)(multi)", "MULTi"]
# Replace French Saison by Season
- name: re_replace
args: ["([Ss]aison|[Ss]aison )(\\d{1,4})", "S$2"]
args: ["(?i)(saison|saison )([1-9])", "S0$2"]
- name: re_replace
args: ["S(\\d+)E(\\d+)(\\D+)", "S$1E$2 $3"]
args: ["(?i)(saison|saison )(\\d{1,4})", "S$2"]
title_filtered:
text: "{{ .Result.title_normal }}"
filters:
- name: re_replace
args: ["([Mm][Uu][Ll][Tt][Ii])", "MULTi"]
# End tidy up for sonarrv3 season search
args: ["(?i)^(?:(.+?)((?:[\\.\\-\\s_\\[]+(?:imax|(?:dvd|bd|tv)(?:rip|scr)|bluray(?:\\-?rip)?|720\\s*p?|1080\\s*p?|vof?|vost(?:fr)?|multi|vf(?:f|q)?[1-3]?|(?:true)?french|eng?)[\\.\\-\\s_\\]]*)*)([\\(\\[]?(?:20|1[7-9])\\d{2}[\\)\\]]?)(.*)$|(.*))$", "$1 $3 $2 $4 $5"]
- name: replace
args: [".", " "]
- name: trim
Expand All @@ -253,21 +268,21 @@ search:
args: ["(\\s{2,5})", " "]
- name: trim
title_phase1:
text: "{{ if .Config.filter_title }}{{ .Result.title_filtered }}{{else}}{{ .Result.title_normal }}{{end}}"
text: "{{ if .Config.filter_title }}{{ .Result.title_filtered }}{{ else }}{{ .Result.title_normal }}{{ end }}"
title_multilang:
text: "{{ .Result.title_phase1 }}"
filters:
- name: re_replace
args: ["[\\.\\s\\[\\-][Mm][Uu][Ll][Tt][Ii][\\.\\s\\]\\-]", ".{{ .Config.multilanguage }}."]
args: ["(?i)[\\.\\s\\[\\-]multi[\\.\\s\\]\\-]", ".{{ .Config.multilanguage }}."]
title_phase2:
text: "{{ if .Config.multilang }}{{ .Result.title_multilang }}{{else}}{{ .Result.title_phase1 }}{{end}}"
title_vostfr:
text: "{{ .Result.title_phase2 }}"
filters:
- name: re_replace
args: ["[\\.\\s\\[\\-][Vv][Oo][Ss][Tt][Ff][Rr][\\.\\s\\]\\-]", ".ENGLISH."]
args: ["(?i)[\\.\\s\\[\\-]vostfr[\\.\\s\\]\\-]", ".ENGLISH."]
- name: re_replace
args: ["[\\.\\s\\[\\-][Ss][Uu][Bb][Ff][Rr][Ee][Nn][Cc][Hh][\\.\\s\\]\\-]", ".ENGLISH."]
args: ["(?i)[\\.\\s\\[\\-]subfrench[\\.\\s\\]\\-]", ".ENGLISH."]
title_phase3:
text: "{{ if .Config.vostfr }}{{ .Result.title_vostfr }}{{else}}{{ .Result.title_phase2 }}{{end}}"
title_anime:
Expand Down

0 comments on commit 9fdd1d3

Please sign in to comment.