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
|
@ -226,6 +226,8 @@ func (r *FilterRepo) FindByID(ctx context.Context, filterID int) (*domain.Filter
|
|||
"f.except_categories",
|
||||
"f.match_uploaders",
|
||||
"f.except_uploaders",
|
||||
"f.match_record_labels",
|
||||
"f.except_record_labels",
|
||||
"f.match_language",
|
||||
"f.except_language",
|
||||
"f.tags",
|
||||
|
@ -261,7 +263,7 @@ func (r *FilterRepo) FindByID(ctx context.Context, filterID int) (*domain.Filter
|
|||
var f domain.Filter
|
||||
|
||||
// filter
|
||||
var minSize, maxSize, maxDownloadsUnit, matchReleases, exceptReleases, matchReleaseGroups, exceptReleaseGroups, matchReleaseTags, exceptReleaseTags, matchDescription, exceptDescription, freeleechPercent, shows, seasons, episodes, years, months, days, artists, albums, matchCategories, exceptCategories, matchUploaders, exceptUploaders, tags, exceptTags, tagsMatchLogic, exceptTagsMatchLogic sql.NullString
|
||||
var minSize, maxSize, maxDownloadsUnit, matchReleases, exceptReleases, matchReleaseGroups, exceptReleaseGroups, matchReleaseTags, exceptReleaseTags, matchDescription, exceptDescription, freeleechPercent, shows, seasons, episodes, years, months, days, artists, albums, matchCategories, exceptCategories, matchUploaders, exceptUploaders, matchRecordLabels, exceptRecordLabels, tags, exceptTags, tagsMatchLogic, exceptTagsMatchLogic sql.NullString
|
||||
var useRegex, scene, freeleech, hasLog, hasCue, perfectFlac sql.NullBool
|
||||
var delay, maxDownloads, logScore sql.NullInt32
|
||||
|
||||
|
@ -319,6 +321,8 @@ func (r *FilterRepo) FindByID(ctx context.Context, filterID int) (*domain.Filter
|
|||
&exceptCategories,
|
||||
&matchUploaders,
|
||||
&exceptUploaders,
|
||||
&matchRecordLabels,
|
||||
&exceptRecordLabels,
|
||||
pq.Array(&f.MatchLanguage),
|
||||
pq.Array(&f.ExceptLanguage),
|
||||
&tags,
|
||||
|
@ -372,6 +376,8 @@ func (r *FilterRepo) FindByID(ctx context.Context, filterID int) (*domain.Filter
|
|||
f.ExceptCategories = exceptCategories.String
|
||||
f.MatchUploaders = matchUploaders.String
|
||||
f.ExceptUploaders = exceptUploaders.String
|
||||
f.MatchRecordLabels = matchRecordLabels.String
|
||||
f.ExceptRecordLabels = exceptRecordLabels.String
|
||||
f.Tags = tags.String
|
||||
f.ExceptTags = exceptTags.String
|
||||
f.TagsMatchLogic = tagsMatchLogic.String
|
||||
|
@ -444,6 +450,8 @@ func (r *FilterRepo) findByIndexerIdentifier(ctx context.Context, indexer string
|
|||
"f.except_categories",
|
||||
"f.match_uploaders",
|
||||
"f.except_uploaders",
|
||||
"f.match_record_labels",
|
||||
"f.except_record_labels",
|
||||
"f.match_language",
|
||||
"f.except_language",
|
||||
"f.tags",
|
||||
|
@ -484,7 +492,7 @@ func (r *FilterRepo) findByIndexerIdentifier(ctx context.Context, indexer string
|
|||
for rows.Next() {
|
||||
var f domain.Filter
|
||||
|
||||
var minSize, maxSize, maxDownloadsUnit, matchReleases, exceptReleases, matchReleaseGroups, exceptReleaseGroups, matchReleaseTags, exceptReleaseTags, matchDescription, exceptDescription, freeleechPercent, shows, seasons, episodes, years, months, days, artists, albums, matchCategories, exceptCategories, matchUploaders, exceptUploaders, tags, exceptTags, tagsMatchLogic, exceptTagsMatchLogic sql.NullString
|
||||
var minSize, maxSize, maxDownloadsUnit, matchReleases, exceptReleases, matchReleaseGroups, exceptReleaseGroups, matchReleaseTags, exceptReleaseTags, matchDescription, exceptDescription, freeleechPercent, shows, seasons, episodes, years, months, days, artists, albums, matchCategories, exceptCategories, matchUploaders, exceptUploaders, matchRecordLabels, exceptRecordLabels, tags, exceptTags, tagsMatchLogic, exceptTagsMatchLogic sql.NullString
|
||||
var useRegex, scene, freeleech, hasLog, hasCue, perfectFlac sql.NullBool
|
||||
var delay, maxDownloads, logScore sql.NullInt32
|
||||
|
||||
|
@ -542,6 +550,8 @@ func (r *FilterRepo) findByIndexerIdentifier(ctx context.Context, indexer string
|
|||
&exceptCategories,
|
||||
&matchUploaders,
|
||||
&exceptUploaders,
|
||||
&matchRecordLabels,
|
||||
&exceptRecordLabels,
|
||||
pq.Array(&f.MatchLanguage),
|
||||
pq.Array(&f.ExceptLanguage),
|
||||
&tags,
|
||||
|
@ -591,6 +601,8 @@ func (r *FilterRepo) findByIndexerIdentifier(ctx context.Context, indexer string
|
|||
f.ExceptCategories = exceptCategories.String
|
||||
f.MatchUploaders = matchUploaders.String
|
||||
f.ExceptUploaders = exceptUploaders.String
|
||||
f.MatchRecordLabels = matchRecordLabels.String
|
||||
f.ExceptRecordLabels = exceptRecordLabels.String
|
||||
f.Tags = tags.String
|
||||
f.ExceptTags = exceptTags.String
|
||||
f.TagsMatchLogic = tagsMatchLogic.String
|
||||
|
@ -738,6 +750,8 @@ func (r *FilterRepo) Store(ctx context.Context, filter *domain.Filter) error {
|
|||
"except_categories",
|
||||
"match_uploaders",
|
||||
"except_uploaders",
|
||||
"match_record_labels",
|
||||
"except_record_labels",
|
||||
"match_language",
|
||||
"except_language",
|
||||
"tags",
|
||||
|
@ -804,6 +818,8 @@ func (r *FilterRepo) Store(ctx context.Context, filter *domain.Filter) error {
|
|||
filter.ExceptCategories,
|
||||
filter.MatchUploaders,
|
||||
filter.ExceptUploaders,
|
||||
filter.MatchRecordLabels,
|
||||
filter.ExceptRecordLabels,
|
||||
pq.Array(filter.MatchLanguage),
|
||||
pq.Array(filter.ExceptLanguage),
|
||||
filter.Tags,
|
||||
|
@ -888,6 +904,8 @@ func (r *FilterRepo) Update(ctx context.Context, filter *domain.Filter) error {
|
|||
Set("except_categories", filter.ExceptCategories).
|
||||
Set("match_uploaders", filter.MatchUploaders).
|
||||
Set("except_uploaders", filter.ExceptUploaders).
|
||||
Set("match_record_labels", filter.MatchRecordLabels).
|
||||
Set("except_record_labels", filter.ExceptRecordLabels).
|
||||
Set("match_language", pq.Array(filter.MatchLanguage)).
|
||||
Set("except_language", pq.Array(filter.ExceptLanguage)).
|
||||
Set("tags", filter.Tags).
|
||||
|
@ -1063,6 +1081,12 @@ func (r *FilterRepo) UpdatePartial(ctx context.Context, filter domain.FilterUpda
|
|||
if filter.ExceptUploaders != nil {
|
||||
q = q.Set("except_uploaders", filter.ExceptUploaders)
|
||||
}
|
||||
if filter.MatchRecordLabels != nil {
|
||||
q = q.Set("match_record_labels", filter.MatchRecordLabels)
|
||||
}
|
||||
if filter.ExceptRecordLabels != nil {
|
||||
q = q.Set("except_record_labels", filter.ExceptRecordLabels)
|
||||
}
|
||||
if filter.MatchLanguage != nil {
|
||||
q = q.Set("match_language", pq.Array(filter.MatchLanguage))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue