Delete failed download link for next retry
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user