mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
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:
parent
f644b3a4d6
commit
24f31574e5
6 changed files with 342 additions and 108 deletions
|
@ -228,10 +228,11 @@ func (i IndexerIRC) ValidChannel(channel string) bool {
|
|||
}
|
||||
|
||||
type IndexerIRCParse struct {
|
||||
Type string `json:"type"`
|
||||
ForceSizeUnit string `json:"forcesizeunit"`
|
||||
Lines []IndexerIRCParseLine `json:"lines"`
|
||||
Match IndexerIRCParseMatch `json:"match"`
|
||||
Type string `json:"type"`
|
||||
ForceSizeUnit string `json:"forcesizeunit"`
|
||||
Lines []IndexerIRCParseLine `json:"lines"`
|
||||
Match IndexerIRCParseMatch `json:"match"`
|
||||
Mappings map[string]map[string]map[string]string `json:"mappings"`
|
||||
}
|
||||
|
||||
type LineTest struct {
|
||||
|
@ -352,7 +353,31 @@ func (p *IndexerIRCParseMatch) ParseTorrentName(vars map[string]string, rls *Rel
|
|||
return nil
|
||||
}
|
||||
|
||||
func (p *IndexerIRCParse) MapCustomVariables(vars map[string]string) error {
|
||||
for varsKey, varsKeyMap := range p.Mappings {
|
||||
varsValue, ok := vars[varsKey]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
keyValueMap, ok := varsKeyMap[varsValue]
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
for k, v := range keyValueMap {
|
||||
vars[k] = v
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *IndexerIRCParse) Parse(def *IndexerDefinition, vars map[string]string, rls *Release) error {
|
||||
if err := p.MapCustomVariables(vars); err != nil {
|
||||
return errors.Wrap(err, "could not map custom variables for release")
|
||||
}
|
||||
|
||||
if err := rls.MapVars(def, vars); err != nil {
|
||||
return errors.Wrap(err, "could not map variables for release")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue