Skip to content

Commit

Permalink
assorted yml: use default: statement for optional fields (#14179)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilike2burnthing committed Mar 21, 2023
1 parent 0c5dfd4 commit f69879a
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 53 deletions.
5 changes: 2 additions & 3 deletions src/Jackett.Common/Definitions/amigosshare.yml
Expand Up @@ -297,19 +297,18 @@ search:
"[src$=\"/Scripts.png\"]": 128
"[src$=\"/Vetores.png\"]": 124
"[src$=\"/outros2.png\"]": 130
date_optional:
date:
selector: p:contains("Lançado:")
# auto adjusted by site account profile
optional: true
default: now
filters:
- name: regexp
args: "Lançado: (.+?)$"
- name: re_replace
args: [" (\\d:)", " 0$1"]
- name: dateparse
args: "dd/MM/yy HH:mm:ss"
date:
text: "{{ if .Result.date_optional }}{{ .Result.date_optional }}{{ else }}now{{ end }}"
size:
selector: div.list-group-item-content p.m-0 span.badge-info
seeders:
Expand Down
7 changes: 3 additions & 4 deletions src/Jackett.Common/Definitions/anime-free.yml
Expand Up @@ -88,10 +88,11 @@ search:
selector: article

fields:
category_optional:
optional: true
category:
selector: a[href*="category="]
attribute: href
optional: true
default: 54
case:
a[href$="3d_hentai"]: 51
a[href$="3dcg_game"]: 55
Expand All @@ -110,8 +111,6 @@ search:
a[href$="original_hentai"]: 48
a[href$="rus-game"]: 57
a[href$="uncensored"]: 45
category:
text: "{{ if .Result.category_optional }}{{ .Result.category_optional }}{{ else }}54{{ end }}"
title:
selector: h2.title a
details:
Expand Down
7 changes: 3 additions & 4 deletions src/Jackett.Common/Definitions/beyond-hd.yml
Expand Up @@ -86,15 +86,14 @@ search:
selector: div.table-torrents > table > tbody > tr[id^="torrentposter"]

fields:
category_optional:
category:
selector: a[href*="/categories/"]
optional: true
attribute: href
optional: true
default: 1
filters:
- name: regexp
args: "/categories/.*?\\.(\\d+)"
category:
text: "{{ if .Result.category_optional }}{{ .Result.category_optional }}{{ else }}1{{ end }}"
title:
selector: a.torrent-name
details:
Expand Down
7 changes: 3 additions & 4 deletions src/Jackett.Common/Definitions/bibliotik.yml
Expand Up @@ -80,14 +80,13 @@ search:
div[title="Comics"]: 4
div[title="Ebooks"]: 5
div[title="Magazines"]: 7
author_optional:
selector: .authorLink
optional: true
_editor:
selector: .editorLink
optional: true
author:
text: "{{ or .Result.author_optional .Result._editor }}"
selector: .authorLink
optional: true
default: "{{ .Result._editor }}"
year:
selector: .torYear
optional: true
Expand Down
6 changes: 3 additions & 3 deletions src/Jackett.Common/Definitions/byrutor.yml
Expand Up @@ -391,6 +391,7 @@ search:
size_rus:
selector: div.shor_subtitles span:nth-child(2):contains("Б")
optional: true
default: "0 B"
filters:
- name: replace
args: ["ТБ", "TB"]
Expand All @@ -400,11 +401,10 @@ search:
args: ["МБ", "MB"]
- name: replace
args: ["КБ", "KB"]
size_eng:
size:
selector: div.shor_subtitles span:nth-child(2):contains("B")
optional: true
size:
text: "{{ if or .Result.size_rus .Result.size_eng }}{{ or .Result.size_rus .Result.size_eng }}{{ else }}0 B{{ end }}"
default: "{{ .Result.size_rus }}"
downloadvolumefactor:
text: 0
uploadvolumefactor:
Expand Down
11 changes: 6 additions & 5 deletions src/Jackett.Common/Definitions/extremlymtorrents.yml
Expand Up @@ -149,6 +149,8 @@ search:
filters:
- name: regexp
args: "src=(.+?) "
- name: replace
args: ["/pic/uploadimage.jpg", ""]
date:
selector: td:nth-last-child(1)
# auto adjusted by site account profile
Expand All @@ -167,19 +169,18 @@ search:
"*": 1
uploadvolumefactor:
text: 1
genre_optional:
genre:
# Drama, Romance | N/A | 2022 | 112 min | N/A
# Drama:Family:Romance
selector: td:nth-child(2)
remove: a
filters:
- name: split
args: ["|", 0]
genre:
# if its VIP then do not keep genre
text: "{{ if .Result._vip }}{{ else }}{{ .Result.genre_optional }}{{ end }}"
- name: re_replace
args: ["\\bn\\\\a\\b", ""]
description:
text: "{{ if .Result._vip }}VIP ONLY{{ else }}{{ .Result.genre }}{{ end }}"
text: "{{ .Result.genre }}{{ if .Result._vip }}</br>VIP ONLY{{ else }}{{ end }}"
minimumratio:
text: 1.0
minimumseedtime:
Expand Down
5 changes: 2 additions & 3 deletions src/Jackett.Common/Definitions/femdomcult.yml
Expand Up @@ -116,16 +116,15 @@ search:
args: ["/static/common/noartwork/noimage.png", ""]
files:
selector: td:nth-child(3)
date_optional:
date:
selector: td:nth-child(5) > span
attribute: title
# auto adjusted by site account profile
optional: true
default: "20 years ago" # some torrents have "Never" date
filters:
- name: dateparse
args: "MMM dd yyyy, HH:mm"
date: # some torrents have "Never" date
text: "{{ if .Result.date_optional }}{{ .Result.date_optional }}{{ else }}20 years ago{{ end }}"
size:
selector: td:nth-child(6)
grabs:
Expand Down
7 changes: 3 additions & 4 deletions src/Jackett.Common/Definitions/nipponsei.yml
Expand Up @@ -42,14 +42,13 @@ search:
download:
selector: a
attribute: href
date_optional:
optional: true
date:
selector: td.date
optional: true
default: now
filters:
- name: dateparse
args: "yyyy-MM-dd HH:mm"
date:
text: "{{ if .Result.date_optional }}{{ .Result.date_optional }}{{ else }}now{{ end }}"
size:
selector: td.bytes
optional: true
Expand Down
5 changes: 2 additions & 3 deletions src/Jackett.Common/Definitions/parnuxi.yml
Expand Up @@ -229,18 +229,17 @@ search:
selector: span.leech
grabs:
selector: span.complet
date_optional:
date:
# (09.03.2020)
selector: a.topictitle
optional: true
default: now
# do not append TZ else text {{if}} will not work if date not found
filters:
- name: regexp
args: (\d{2}\.\d{2}\.\d{4})
- name: dateparse
args: "dd.MM.yyyy"
date:
text: "{{ if .Result.date_optional }}{{ .Result.date_optional }}{{ else }}now{{ end }}"
downloadvolumefactor:
text: 0
uploadvolumefactor:
Expand Down
9 changes: 1 addition & 8 deletions src/Jackett.Common/Definitions/sktorrent.yml
Expand Up @@ -183,16 +183,9 @@ search:
details:
selector: a[href^="details.php?name="]
attribute: href
poster_default:
poster:
selector: img[class="lozad"]
attribute: data-src
optional: true
poster_optional:
selector: img[src="//cdn.sktorrent.eu/obrazky/xXx.jpg"]
attribute: src
optional: true
poster:
text: "{{ if .Result.poster_optional }}{{ .Result.poster_optional }}{{ else }}{{ .Result.poster_default }}{{ end }}"
download:
selector: a[href^="details.php?name="]
attribute: href
Expand Down
9 changes: 4 additions & 5 deletions src/Jackett.Common/Definitions/thefallingangels.yml
Expand Up @@ -154,14 +154,13 @@ search:
attribute: href
download_default:
selector: a[href^="download.php?torrent="]
optional: true
attribute: href
download_ssl:
selector: a[href^="download_ssl.php?torrent="]
optional: true
attribute: href
download:
text: "{{ if .Result.download_ssl }}{{ .Result.download_ssl }}{{ else }}{{ .Result.download_default }}{{ end }}"
selector: a[href^="download_ssl.php?torrent="]
attribute: href
optional: true
default: "{{ .Result.download_default }}"
poster:
selector: div[id^="details"] img
attribute: src
Expand Down
7 changes: 3 additions & 4 deletions src/Jackett.Common/Definitions/torrent9.yml
Expand Up @@ -170,14 +170,13 @@ search:
download:
selector: td:nth-child(1) a
attribute: href
date_optional:
optional: true
date:
selector: td:nth-child(2):contains("/")
optional: true
default: now
filters:
- name: dateparse
args: "dd/MM/yyyy"
date:
text: "{{ if .Result.date_optional }}{{ .Result.date_optional }}{{ else }}now{{ end }}"
size:
selector: "{{ if .Keywords }}td:nth-child(3){{ else }}td:nth-child(2){{ end }}"
filters:
Expand Down
6 changes: 3 additions & 3 deletions src/Jackett.Common/Definitions/tribalmixes.yml
Expand Up @@ -105,14 +105,14 @@ search:
filters:
- name: regexp
args: "Size: (.+?)<"
files_optional:
files:
selector: a[href^="/download.php?id="]
attribute: title
optional: true
default: 1
filters:
- name: regexp
args: "\\((\\d+) files\\)"
files:
text: "{{ if .Result.files_optional }}{{ .Result.files_optional }}{{ else }}1{{ end }}"
seeders:
selector: a[href^="/download.php?id="]
attribute: title
Expand Down

0 comments on commit f69879a

Please sign in to comment.