yggtorrent: tidy up and normalise title and filtered title, fix "Saison" to "S" resolve #6207 (#9114)

This commit is contained in:
xfouloux 2020-07-08 16:00:26 +11:00 committed by GitHub
parent b498bfbe3e
commit 9fdd1d358d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 35 additions and 20 deletions

View File

@ -198,25 +198,28 @@ search:
# BY # BY
# One Punch Man S02E10 OR One Punch Man S02E02 # One Punch Man S02E10 OR One Punch Man S02E02
- name: re_replace # S 1-9 & EP >= 10 - 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 - 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 - 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 - 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 - 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 - 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 # END ANIME HACK
- name: replace - name: replace
args: ["\"", ""] args: ["\"", ""]
- name: replace
args: [" ", " "]
- name: trim - name: trim
paths: 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 }}" - 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 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 followredirect: true
rows: rows:
@ -231,19 +234,31 @@ search:
args: "/(\\d+)-" args: "/(\\d+)-"
title_normal: title_normal:
selector: td:nth-child(2) > a 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)(multi)", "MULTi"]
# Replace French Saison by Season
- name: re_replace
args: ["(?i)(saison|saison )([1-9])", "S0$2"]
- name: re_replace
args: ["(?i)(saison|saison )(\\d{1,4})", "S$2"]
title_filtered: title_filtered:
selector: td:nth-child(2) > a text: "{{ .Result.title_normal }}"
filters: filters:
- name: re_replace - 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"] 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
- name: re_replace
args: ["([Ss]aison|[Ss]aison )(\\d{1,4})", "S$2"]
- name: re_replace
args: ["S(\\d+)E(\\d+)(\\D+)", "S$1E$2 $3"]
- name: re_replace
args: ["([Mm][Uu][Ll][Tt][Ii])", "MULTi"]
# End tidy up for sonarrv3 season search
- name: replace - name: replace
args: [".", " "] args: [".", " "]
- name: trim - name: trim
@ -258,16 +273,16 @@ search:
text: "{{ .Result.title_phase1 }}" text: "{{ .Result.title_phase1 }}"
filters: filters:
- name: re_replace - name: re_replace
args: ["[\\.\\s\\[\\-][Mm][Uu][Ll][Tt][Ii][\\.\\s\\]\\-]", ".{{ .Config.multilanguage }}."] args: ["(?i)[\\.\\s\\[\\-]multi[\\.\\s\\]\\-]", ".{{ .Config.multilanguage }}."]
title_phase2: title_phase2:
text: "{{ if .Config.multilang }}{{ .Result.title_multilang }}{{else}}{{ .Result.title_phase1 }}{{end}}" text: "{{ if .Config.multilang }}{{ .Result.title_multilang }}{{else}}{{ .Result.title_phase1 }}{{end}}"
title_vostfr: title_vostfr:
text: "{{ .Result.title_phase2 }}" text: "{{ .Result.title_phase2 }}"
filters: filters:
- name: re_replace - name: re_replace
args: ["[\\.\\s\\[\\-][Vv][Oo][Ss][Tt][Ff][Rr][\\.\\s\\]\\-]", ".ENGLISH."] args: ["(?i)[\\.\\s\\[\\-]vostfr[\\.\\s\\]\\-]", ".ENGLISH."]
- name: re_replace - name: re_replace
args: ["[\\.\\s\\[\\-][Ss][Uu][Bb][Ff][Rr][Ee][Nn][Cc][Hh][\\.\\s\\]\\-]", ".ENGLISH."] args: ["(?i)[\\.\\s\\[\\-]subfrench[\\.\\s\\]\\-]", ".ENGLISH."]
title_phase3: title_phase3:
text: "{{ if .Config.vostfr }}{{ .Result.title_vostfr }}{{else}}{{ .Result.title_phase2 }}{{end}}" text: "{{ if .Config.vostfr }}{{ .Result.title_vostfr }}{{else}}{{ .Result.title_phase2 }}{{end}}"
title_anime: title_anime: