Add support for using freeleech tokens if available

This commit is contained in:
Daniel Mason 2025-07-11 10:12:43 +12:00
parent 74f777340e
commit 3656a68a27
Signed by: idanoo
GPG key ID: 387387CDBC02F132
28 changed files with 199 additions and 39 deletions

View file

@ -210,6 +210,7 @@ func (r *FilterRepo) FindByID(ctx context.Context, filterID int) (*domain.Filter
"f.scene",
"f.freeleech",
"f.freeleech_percent",
"f.freeleech_token",
"f.smart_episode",
"f.shows",
"f.seasons",
@ -278,7 +279,7 @@ func (r *FilterRepo) FindByID(ctx context.Context, filterID int) (*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, matchRecordLabels, exceptRecordLabels, tags, exceptTags, tagsMatchLogic, exceptTagsMatchLogic sql.NullString
var useRegex, scene, freeleech, hasLog, hasCue, perfectFlac sql.NullBool
var useRegex, scene, freeleech, freeleechToken, hasLog, hasCue, perfectFlac sql.NullBool
var delay, maxDownloads, logScore sql.NullInt32
var releaseProfileDuplicateId sql.NullInt64
@ -307,6 +308,7 @@ func (r *FilterRepo) FindByID(ctx context.Context, filterID int) (*domain.Filter
&scene,
&freeleech,
&freeleechPercent,
&freeleechToken,
&f.SmartEpisode,
&shows,
&seasons,
@ -375,7 +377,9 @@ func (r *FilterRepo) FindByID(ctx context.Context, filterID int) (*domain.Filter
f.ExceptReleaseTags = exceptReleaseTags.String
f.MatchDescription = matchDescription.String
f.ExceptDescription = exceptDescription.String
f.Freeleech = freeleech.Bool
f.FreeleechPercent = freeleechPercent.String
f.FreeleechToken = freeleechToken.Bool
f.Shows = shows.String
f.Seasons = seasons.String
f.Episodes = episodes.String
@ -400,7 +404,6 @@ func (r *FilterRepo) FindByID(ctx context.Context, filterID int) (*domain.Filter
f.ExceptTagsMatchLogic = exceptTagsMatchLogic.String
f.UseRegex = useRegex.Bool
f.Scene = scene.Bool
f.Freeleech = freeleech.Bool
f.ReleaseProfileDuplicateID = releaseProfileDuplicateId.Int64
return &f, nil
@ -438,6 +441,7 @@ func (r *FilterRepo) findByIndexerIdentifier(ctx context.Context, indexer string
"f.scene",
"f.freeleech",
"f.freeleech_percent",
"f.freeleech_token",
"f.smart_episode",
"f.shows",
"f.seasons",
@ -535,7 +539,7 @@ func (r *FilterRepo) findByIndexerIdentifier(ctx context.Context, indexer string
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, matchRecordLabels, exceptRecordLabels, tags, exceptTags, tagsMatchLogic, exceptTagsMatchLogic sql.NullString
var useRegex, scene, freeleech, hasLog, hasCue, perfectFlac sql.NullBool
var useRegex, scene, freeleech, freeleechToken, hasLog, hasCue, perfectFlac sql.NullBool
var delay, maxDownloads, logScore sql.NullInt32
var releaseProfileDuplicateID, rdpId sql.NullInt64
@ -567,6 +571,7 @@ func (r *FilterRepo) findByIndexerIdentifier(ctx context.Context, indexer string
&scene,
&freeleech,
&freeleechPercent,
&freeleechToken,
&f.SmartEpisode,
&shows,
&seasons,
@ -680,6 +685,7 @@ func (r *FilterRepo) findByIndexerIdentifier(ctx context.Context, indexer string
f.UseRegex = useRegex.Bool
f.Scene = scene.Bool
f.Freeleech = freeleech.Bool
f.FreeleechToken = freeleechToken.Bool
f.ReleaseProfileDuplicateID = releaseProfileDuplicateID.Int64
f.Rejections = []string{}
@ -832,6 +838,7 @@ func (r *FilterRepo) Store(ctx context.Context, filter *domain.Filter) error {
"scene",
"freeleech",
"freeleech_percent",
"freeleech_token",
"smart_episode",
"shows",
"seasons",
@ -901,6 +908,7 @@ func (r *FilterRepo) Store(ctx context.Context, filter *domain.Filter) error {
filter.Scene,
filter.Freeleech,
filter.FreeleechPercent,
filter.FreeleechToken,
filter.SmartEpisode,
filter.Shows,
filter.Seasons,
@ -988,6 +996,7 @@ func (r *FilterRepo) Update(ctx context.Context, filter *domain.Filter) error {
Set("scene", filter.Scene).
Set("freeleech", filter.Freeleech).
Set("freeleech_percent", filter.FreeleechPercent).
Set("freeleech_token", filter.FreeleechToken).
Set("smart_episode", filter.SmartEpisode).
Set("shows", filter.Shows).
Set("seasons", filter.Seasons).
@ -1128,6 +1137,9 @@ func (r *FilterRepo) UpdatePartial(ctx context.Context, filter domain.FilterUpda
if filter.FreeleechPercent != nil {
q = q.Set("freeleech_percent", filter.FreeleechPercent)
}
if filter.FreeleechToken != nil {
q = q.Set("freeleech_token", filter.FreeleechToken)
}
if filter.SmartEpisode != nil {
q = q.Set("smart_episode", filter.SmartEpisode)
}