mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(filters): RED and OPS fetch record label from API (#1881)
* feat(filters): RED and OPS fetch record label from API * test: add record label to RED and OPS test data * refactor: record label check --------- Co-authored-by: ze0s <ze0s@riseup.net>
This commit is contained in:
parent
221bc35371
commit
d153ac44b8
16 changed files with 380 additions and 154 deletions
|
@ -105,34 +105,34 @@ type Group struct {
|
|||
}
|
||||
|
||||
type Torrent struct {
|
||||
Id int `json:"id"`
|
||||
InfoHash string `json:"infoHash"`
|
||||
Media string `json:"media"`
|
||||
Format string `json:"format"`
|
||||
Encoding string `json:"encoding"`
|
||||
Remastered bool `json:"remastered"`
|
||||
RemasterYear int `json:"remasterYear"`
|
||||
RemasterTitle string `json:"remasterTitle"`
|
||||
RemasterRecordLabel string `json:"remasterRecordLabel"`
|
||||
RemasterCatalogueNumber string `json:"remasterCatalogueNumber"`
|
||||
Scene bool `json:"scene"`
|
||||
HasLog bool `json:"hasLog"`
|
||||
HasCue bool `json:"hasCue"`
|
||||
LogScore int `json:"logScore"`
|
||||
FileCount int `json:"fileCount"`
|
||||
Size int `json:"size"`
|
||||
Seeders int `json:"seeders"`
|
||||
Leechers int `json:"leechers"`
|
||||
Snatched int `json:"snatched"`
|
||||
FreeTorrent bool `json:"freeTorrent"`
|
||||
IsNeutralleech bool `json:"isNeutralleech"`
|
||||
IsFreeload bool `json:"isFreeload"`
|
||||
Time string `json:"time"`
|
||||
Description string `json:"description"`
|
||||
FileList string `json:"fileList"`
|
||||
FilePath string `json:"filePath"`
|
||||
UserId int `json:"userId"`
|
||||
Username string `json:"username"`
|
||||
Id int `json:"id"`
|
||||
InfoHash string `json:"infoHash"`
|
||||
Media string `json:"media"`
|
||||
Format string `json:"format"`
|
||||
Encoding string `json:"encoding"`
|
||||
Remastered bool `json:"remastered"`
|
||||
RemasterYear int `json:"remasterYear"`
|
||||
RemasterTitle string `json:"remasterTitle"`
|
||||
RecordLabel string `json:"remasterRecordLabel"` // remasterRecordLabel is the record label of the release, which should be used instead of the record label of the group
|
||||
CatalogueNumber string `json:"remasterCatalogueNumber"` // remasterCatalogueNumber is the catalogue number of the release, which should be used instead of the catalogue number of the group
|
||||
Scene bool `json:"scene"`
|
||||
HasLog bool `json:"hasLog"`
|
||||
HasCue bool `json:"hasCue"`
|
||||
LogScore int `json:"logScore"`
|
||||
FileCount int `json:"fileCount"`
|
||||
Size int `json:"size"`
|
||||
Seeders int `json:"seeders"`
|
||||
Leechers int `json:"leechers"`
|
||||
Snatched int `json:"snatched"`
|
||||
FreeTorrent bool `json:"freeTorrent"`
|
||||
IsNeutralleech bool `json:"isNeutralleech"`
|
||||
IsFreeload bool `json:"isFreeload"`
|
||||
Time string `json:"time"`
|
||||
Description string `json:"description"`
|
||||
FileList string `json:"fileList"`
|
||||
FilePath string `json:"filePath"`
|
||||
UserId int `json:"userId"`
|
||||
Username string `json:"username"`
|
||||
}
|
||||
|
||||
type IndexResponse struct {
|
||||
|
@ -231,10 +231,11 @@ func (c *Client) GetTorrentByID(ctx context.Context, torrentID string) (*domain.
|
|||
}
|
||||
|
||||
return &domain.TorrentBasic{
|
||||
Id: strconv.Itoa(response.Response.Torrent.Id),
|
||||
InfoHash: response.Response.Torrent.InfoHash,
|
||||
Size: strconv.Itoa(response.Response.Torrent.Size),
|
||||
Uploader: response.Response.Torrent.Username,
|
||||
Id: strconv.Itoa(response.Response.Torrent.Id),
|
||||
InfoHash: response.Response.Torrent.InfoHash,
|
||||
Size: strconv.Itoa(response.Response.Torrent.Size),
|
||||
Uploader: response.Response.Torrent.Username,
|
||||
RecordLabel: response.Response.Torrent.RecordLabel,
|
||||
}, nil
|
||||
|
||||
}
|
||||
|
|
|
@ -72,10 +72,11 @@ func TestREDClient_GetTorrentByID(t *testing.T) {
|
|||
},
|
||||
args: args{torrentID: "29991962"},
|
||||
want: &domain.TorrentBasic{
|
||||
Id: "29991962",
|
||||
InfoHash: "B2BABD3A361EAFC6C4E9142C422DF7DDF5D7E163",
|
||||
Size: "527749302",
|
||||
Uploader: "Uploader",
|
||||
Id: "29991962",
|
||||
InfoHash: "B2BABD3A361EAFC6C4E9142C422DF7DDF5D7E163",
|
||||
Size: "527749302",
|
||||
Uploader: "Uploader",
|
||||
RecordLabel: "FAJo Music",
|
||||
},
|
||||
wantErr: "",
|
||||
},
|
||||
|
|
2
pkg/red/testdata/get_torrent_by_id.json
vendored
2
pkg/red/testdata/get_torrent_by_id.json
vendored
|
@ -52,7 +52,7 @@
|
|||
"remastered": false,
|
||||
"remasterYear": 0,
|
||||
"remasterTitle": "",
|
||||
"remasterRecordLabel": "",
|
||||
"remasterRecordLabel": "FAJo Music",
|
||||
"remasterCatalogueNumber": "",
|
||||
"scene": true,
|
||||
"hasLog": false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue