feat(indexers): update PTP announce to new format (#1738)

* feat(indexers): update PTP to new format

* fix: update expect line

* feat: use unique key for dl link

* feat: update pattern

* fix: definition tests

* feat: rename var

* feat: add custom vars map

* feat: start mapCustomVars

* Update internal/indexer/definitions/ptp.yaml

Co-authored-by: nuxen <felix.schubert1998@gmail.com>

* feat(indexers): map custom indexer vars

* feat: support upload unix epoch time

* feat(releases): update mapvars

* feat(indexers): remove ptp api init

* feat(indexers): update ptp category mapping

* feat(releases): show announce type in details

* feat(releases): mapvars announcetype

---------

Co-authored-by: nuxen <felix.schubert1998@gmail.com>
This commit is contained in:
ze0s 2024-12-08 23:35:32 +01:00 committed by GitHub
parent f644b3a4d6
commit 24f31574e5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 342 additions and 108 deletions

View file

@ -13,7 +13,6 @@ import (
"github.com/autobrr/autobrr/pkg/errors"
"github.com/autobrr/autobrr/pkg/ggn"
"github.com/autobrr/autobrr/pkg/ops"
"github.com/autobrr/autobrr/pkg/ptp"
"github.com/autobrr/autobrr/pkg/red"
"github.com/rs/zerolog"
@ -94,18 +93,6 @@ func (s *apiService) AddClient(indexer string, settings map[string]string) error
}
s.apiClients[indexer] = btn.NewClient(key)
case "ptp":
user, ok := settings["api_user"]
if !ok || user == "" {
return errors.New("api.Service.AddClient: could not initialize ptp client: missing var 'api_user'")
}
key, ok := settings["api_key"]
if !ok || key == "" {
return errors.New("api.Service.AddClient: could not initialize ptp client: missing var 'api_key'")
}
s.apiClients[indexer] = ptp.NewClient(user, key)
case "ggn":
key, ok := settings["api_key"]
if !ok || key == "" {
@ -156,16 +143,6 @@ func (s *apiService) getClientForTest(req domain.IndexerTestApiRequest) (apiClie
}
return btn.NewClient(req.ApiKey), nil
case "ptp":
if req.ApiUser == "" {
return nil, errors.New("api.Service.AddClient: could not initialize ptp client: missing var 'api_user'")
}
if req.ApiKey == "" {
return nil, errors.New("api.Service.AddClient: could not initialize ptp client: missing var 'api_key'")
}
return ptp.NewClient(req.ApiUser, req.ApiKey), nil
case "ggn":
if req.ApiKey == "" {
return nil, errors.New("api.Service.AddClient: could not initialize ggn client: missing var 'api_key'")

View file

@ -11,7 +11,6 @@ protocol: torrent
supports:
- irc
- rss
- api
# source: gazelle
settings:
- name: authkey
@ -26,34 +25,6 @@ settings:
label: Torrent pass
help: Right click DL on a torrent and get the torrent_pass.
- name: api_user
type: secret
required: true
label: API User
help: Edit profile -> Security -> Generate new api keys
- name: api_key
type: secret
required: true
label: API Key
help: Edit profile -> Security -> Generate new api keys
# api:
# url: https://passthepopcorn.me/
# type: json
# limits:
# max: 60
# per: minute
# settings:
# - name: api_user
# type: secret
# label: API User
# help: Edit profile -> Security -> Generate new api keys
# - name: api_key
# type: secret
# label: API Key
# help: Edit profile -> Security -> Generate new api keys
irc:
network: PassThePopcorn
server: irc.passthepopcorn.me
@ -93,31 +64,131 @@ irc:
type: single
lines:
- tests:
- line: That Movie [1972] by Some Director | x264 / Blu-ray / MKV / 1080p | 204371 | 964303 | That.Movie.1972.1080p.BluRay.FLAC.x264-GROUP | comedy, drama, romance
- line: 0:2:0:0:357805:1332009:9k6p:tt24249072:1899875175:1728081334|H.264/MKV/WEB/720p||2023|Last Straw|Last.Straw.2023.REPACK.720p.AMZN.WEB-DL.DDP5.1.H.264-FLUX|thriller,horror
expect:
year: "1972"
releaseTags: x264 / Blu-ray / MKV / 1080p
freeleech: ""
torrentId: "964303"
torrentName: That.Movie.1972.1080p.BluRay.FLAC.x264-GROUP
tags: comedy, drama, romance
- line: That Other Movie [1972] | x264 / Blu-ray / MKV / 1080p / Freeleech! | 204371 | 964303 | That.Other.Movie.1972.1080p.BluRay.FLAC.x264-GROUP | comedy, drama, romance
announceTypeEnum: 0
categoryEnum: 2
originEnum: 0
freeleechEnum: 0
groupId: "357805"
torrentId: "1332009"
key: "9k6p"
imdb: "tt24249072"
torrentSizeBytes: "1899875175"
uploadedDate: "1728081334"
releaseTags: H.264/MKV/WEB/720p
editionTags: ""
year: "2023"
title: "Last Straw"
torrentName: Last.Straw.2023.REPACK.720p.AMZN.WEB-DL.DDP5.1.H.264-FLUX
tags: thriller,horror
- line: 2:1:0:1:357805:1332009:9k6p:tt24249072:1899875175:1728081334|H.264/MKV/WEB/720p||2023|Last Straw|Last.Straw.2023.REPACK.720p.AMZN.WEB-DL.DDP5.1.H.264-FLUX|thriller,horror
expect:
year: "1972"
releaseTags: x264 / Blu-ray / MKV / 1080p / Freeleech!
freeleech: Freeleech
torrentId: "964303"
torrentName: That.Other.Movie.1972.1080p.BluRay.FLAC.x264-GROUP
tags: comedy, drama, romance
pattern: '.* \[(.*)\] (?:by .*)?\| (.*?(?: \/ (Freeleech)!)?) \| .* \| (.*) \| (.*) \| (.*)'
announceTypeEnum: 2
categoryEnum: 1
originEnum: 0
freeleechEnum: 1
groupId: "357805"
torrentId: "1332009"
key: "9k6p"
imdb: "tt24249072"
torrentSizeBytes: "1899875175"
uploadedDate: "1728081334"
releaseTags: H.264/MKV/WEB/720p
editionTags: ""
year: "2023"
title: "Last Straw"
torrentName: Last.Straw.2023.REPACK.720p.AMZN.WEB-DL.DDP5.1.H.264-FLUX
tags: thriller,horror
- line: 1:1:2:1:21108:1332339:ncfe:tt0107426:63996413804:1728081334|BD66/m2ts/Blu-ray/2160p|Dolby Atmos/Dolby Vision|1993|Little Buddha|Little.Buddha.1993.2160p.FRA.UHD.Blu-ray.DV.HDR.HEVC.DTS-HD.MA.5.1|drama,italian
expect:
announceTypeEnum: 1
categoryEnum: 1
originEnum: 2
freeleechEnum: 1
groupId: "21108"
torrentId: "1332339"
key: "ncfe"
imdb: "tt0107426"
torrentSizeBytes: "63996413804"
uploadedDate: "1728081334"
releaseTags: BD66/m2ts/Blu-ray/2160p
editionTags: "Dolby Atmos/Dolby Vision"
year: "1993"
title: "Little Buddha"
torrentName: Little.Buddha.1993.2160p.FRA.UHD.Blu-ray.DV.HDR.HEVC.DTS-HD.MA.5.1
tags: drama,italian
# <announceType>:<category>:<origin>:<freeleech_type>:<gid>:<tid>:<key>:tt<imdbid>:<sizebytes>|<format>/<container>/<source>/<resolution>|<edition_tags>|<year>|<title>|<releasename>|<taglist>
pattern: '(\d):(\d):(\d):(\d):(\d+):(\d+):(\w+):(tt\d+)?:(\d+):(\d+)\|(.*)\|(.*)\|(\d+)\|(.+)\|(.+)\|(.+)'
vars:
- year
- releaseTags
- freeleech
- announceTypeEnum
- categoryEnum
- originEnum
- freeleechEnum
- groupId
- torrentId
- key
- imdb
- torrentSizeBytes
- uploadedDate
- releaseTags
- editionTags
- year
- title
- torrentName
- tags
mappings:
announceTypeEnum:
"0":
announceType: NEW
"1":
announceType: CHECKED
"2":
announceType: PROMO # X-leeched (could be neutral/half/free)
"3":
announceType: PROMO_GP # marked golden popcorn
"4":
announceType: RESURRECTED # reseeded/revived from dead
# Category IDs are Zero+1 indexed from:
# ( 'Feature Film', 'Short Film', 'Miniseries', 'Stand-up Comedy', 'Live Performance', 'Movie Collection' )
categoryEnum:
"1":
category: "Feature Film"
"2":
category: "Short Film"
"3":
category: "Miniseries"
"4":
category: "Stand-up Comedy"
"5":
category: "Live Performance"
"6":
category: "Movie Collection"
originEnum:
"0":
origin: "P2P"
"1":
origin: "SCENE"
"2":
origin: "INTERNAL" # PERSONAL RIP
freeleechEnum:
"0": # Normal
downloadVolumeFactor: 1
uploadVolumeFactor: 1
"1": # Freeleech
downloadVolumeFactor: 0
uploadVolumeFactor: 1
"2": # Halfleech
downloadVolumeFactor: 0.5
uploadVolumeFactor: 1
"3": # Neutral
downloadVolumeFactor: 0
uploadVolumeFactor: 0
match:
infourl: "/torrents.php?torrentid={{ .torrentId }}"
torrenturl: "/torrents.php?action=download&id={{ .torrentId }}&authkey={{ .authkey }}&torrent_pass={{ .torrent_pass }}"
torrenturl: "/torrents.php?action=download&id={{ .torrentId }}&authkey={{ .authkey }}&torrent_pass={{ .torrent_pass }}&key={{ .key }}"