Delete failed download link for next retry

This commit is contained in:
Mukhtar Akere
2025-10-15 11:56:15 +01:00
parent b1b6353fb3
commit 2a4f09c06d
6 changed files with 46 additions and 0 deletions

View File

@@ -497,3 +497,8 @@ func (ad *AllDebrid) AccountManager() *account.Manager {
func (ad *AllDebrid) SyncAccounts() error {
return nil
}
func (ad *AllDebrid) DeleteDownloadLink(account *account.Account, downloadLink types.DownloadLink) error {
account.DeleteDownloadLink(downloadLink.Link)
return nil
}

View File

@@ -518,3 +518,8 @@ func (dl *DebridLink) AccountManager() *account.Manager {
func (dl *DebridLink) SyncAccounts() error {
return nil
}
func (dl *DebridLink) DeleteDownloadLink(account *account.Account, downloadLink types.DownloadLink) error {
account.DeleteDownloadLink(downloadLink.Link)
return nil
}

View File

@@ -986,3 +986,20 @@ func (r *RealDebrid) syncAccount(account *account.Account) error {
//r.accountsManager.Update(account)
return nil
}
func (r *RealDebrid) DeleteDownloadLink(account *account.Account, downloadLink types.DownloadLink) error {
url := fmt.Sprintf("%s/downloads/delete/%s", r.Host, downloadLink.Id)
req, _ := http.NewRequest(http.MethodDelete, url, nil)
resp, err := account.Client().Do(req)
if err != nil {
return err
}
defer func(Body io.ReadCloser) {
_ = Body.Close()
}(resp.Body)
if resp.StatusCode != http.StatusNoContent {
return fmt.Errorf("realdebrid API error: %d", resp.StatusCode)
}
account.DeleteDownloadLink(downloadLink.Link)
return nil
}

View File

@@ -654,3 +654,8 @@ func (tb *Torbox) AccountManager() *account.Manager {
func (tb *Torbox) SyncAccounts() error {
return nil
}
func (tb *Torbox) DeleteDownloadLink(account *account.Account, downloadLink types.DownloadLink) error {
account.DeleteDownloadLink(downloadLink.Link)
return nil
}