feat(actions): qBittorrent add first-last piece priority (#1517)

* feat(actions): qBittorrent add first/last piece priority

* removed accidental change

* fix: scanrow order

* fix: spaces vs tabs

* bump(deps): upgrade go-qbittorrent to v1.9.0

* fix(test): add missing colon

* fix(database): sqlite remove duplicate
This commit is contained in:
s0up4200 2024-04-18 14:47:36 +02:00 committed by GitHub
parent 7b9993b296
commit 56ef3a5402
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 36 additions and 7 deletions

View file

@ -75,6 +75,7 @@ func (r *ActionRepo) findByFilterID(ctx context.Context, tx *Tx, filterID int, a
"save_path",
"paused",
"ignore_rules",
"first_last_piece_prio",
"skip_hash_check",
"content_layout",
"priority",
@ -124,7 +125,7 @@ func (r *ActionRepo) findByFilterID(ctx context.Context, tx *Tx, filterID int, a
var externalClientID, clientID sql.NullInt32
var paused, ignoreRules sql.NullBool
if err := rows.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &priorityLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &externalClient, &clientID); err != nil {
if err := rows.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.FirstLastPiecePrio, &a.SkipHashCheck, &contentLayout, &priorityLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &externalClient, &clientID); err != nil {
return nil, errors.Wrap(err, "error scanning row")
}
@ -229,6 +230,7 @@ func (r *ActionRepo) List(ctx context.Context) ([]domain.Action, error) {
"save_path",
"paused",
"ignore_rules",
"first_last_piece_prio",
"skip_hash_check",
"content_layout",
"priority",
@ -272,7 +274,7 @@ func (r *ActionRepo) List(ctx context.Context) ([]domain.Action, error) {
var externalClientID, clientID sql.NullInt32
var paused, ignoreRules sql.NullBool
if err := rows.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &priorityLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &externalClient, &clientID); err != nil {
if err := rows.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.FirstLastPiecePrio, &a.SkipHashCheck, &contentLayout, &priorityLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &externalClient, &clientID); err != nil {
return nil, errors.Wrap(err, "error scanning row")
}
@ -325,6 +327,7 @@ func (r *ActionRepo) Get(ctx context.Context, req *domain.GetActionRequest) (*do
"save_path",
"paused",
"ignore_rules",
"first_last_piece_prio",
"skip_hash_check",
"content_layout",
"priority",
@ -370,7 +373,7 @@ func (r *ActionRepo) Get(ctx context.Context, req *domain.GetActionRequest) (*do
var externalClientID, clientID, filterID sql.NullInt32
var paused, ignoreRules sql.NullBool
if err := row.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &priorityLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &externalClient, &clientID, &filterID); err != nil {
if err := row.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.FirstLastPiecePrio, &a.SkipHashCheck, &contentLayout, &priorityLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &externalClient, &clientID, &filterID); err != nil {
if errors.Is(err, sql.ErrNoRows) {
return nil, domain.ErrRecordNotFound
}
@ -464,6 +467,7 @@ func (r *ActionRepo) Store(ctx context.Context, action domain.Action) (*domain.A
"save_path",
"paused",
"ignore_rules",
"first_last_piece_prio",
"skip_hash_check",
"content_layout",
"priority",
@ -497,6 +501,7 @@ func (r *ActionRepo) Store(ctx context.Context, action domain.Action) (*domain.A
toNullString(action.SavePath),
action.Paused,
action.IgnoreRules,
action.FirstLastPiecePrio,
action.SkipHashCheck,
toNullString(string(action.ContentLayout)),
toNullString(string(action.PriorityLayout)),
@ -548,6 +553,7 @@ func (r *ActionRepo) Update(ctx context.Context, action domain.Action) (*domain.
Set("save_path", toNullString(action.SavePath)).
Set("paused", action.Paused).
Set("ignore_rules", action.IgnoreRules).
Set("first_last_piece_prio", action.FirstLastPiecePrio).
Set("skip_hash_check", action.SkipHashCheck).
Set("content_layout", toNullString(string(action.ContentLayout))).
Set("priority", toNullString(string(action.PriorityLayout))).
@ -609,6 +615,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, filterID int64, act
Set("save_path", toNullString(action.SavePath)).
Set("paused", action.Paused).
Set("ignore_rules", action.IgnoreRules).
Set("first_last_piece_prio", action.FirstLastPiecePrio).
Set("skip_hash_check", action.SkipHashCheck).
Set("content_layout", toNullString(string(action.ContentLayout))).
Set("priority", toNullString(string(action.PriorityLayout))).
@ -657,6 +664,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, filterID int64, act
"save_path",
"paused",
"ignore_rules",
"first_last_piece_prio",
"skip_hash_check",
"content_layout",
"priority",
@ -690,6 +698,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, filterID int64, act
toNullString(action.SavePath),
action.Paused,
action.IgnoreRules,
action.FirstLastPiecePrio,
action.SkipHashCheck,
toNullString(string(action.ContentLayout)),
toNullString(string(action.PriorityLayout)),

View file

@ -31,6 +31,7 @@ func getMockAction() domain.Action {
Paused: false,
IgnoreRules: false,
SkipHashCheck: false,
FirstLastPiecePrio: false,
ContentLayout: domain.ActionContentLayoutOriginal,
LimitUploadSpeed: 0,
LimitDownloadSpeed: 0,

View file

@ -197,6 +197,7 @@ CREATE TABLE action
save_path TEXT,
paused BOOLEAN,
ignore_rules BOOLEAN,
first_last_piece_prio BOOLEAN DEFAULT false,
skip_hash_check BOOLEAN DEFAULT false,
content_layout TEXT,
limit_upload_speed INT,
@ -873,5 +874,8 @@ ALTER TABLE filter
ELSE name
END
WHERE server = 'irc.animebytes.tv';
`,
`ALTER TABLE action
ADD COLUMN first_last_piece_prio BOOLEAN DEFAULT false;
`,
}

View file

@ -197,6 +197,7 @@ CREATE TABLE action
save_path TEXT,
paused BOOLEAN,
ignore_rules BOOLEAN,
first_last_piece_prio BOOLEAN DEFAULT false,
skip_hash_check BOOLEAN DEFAULT false,
content_layout TEXT,
limit_upload_speed INT,
@ -1511,5 +1512,8 @@ ALTER TABLE filter
ELSE name
END
WHERE server = 'irc.animebytes.tv';
`,
`ALTER TABLE action
ADD COLUMN first_last_piece_prio BOOLEAN DEFAULT false;
`,
}