mirror of
https://github.com/idanoo/autobrr
synced 2025-07-25 09:49:13 +00:00
Feature: Download client rules (#18)
* feat(web): add and update download client rules * feat: add and update download client rules * feat: add active downloads check * chore: update pkg * feat: deluge max active downloads * feat: use basic rules for deluge * feat: add as paused * refactor: download file if needed * feat: better errors qbit
This commit is contained in:
parent
09eb0b1716
commit
c02f16b64d
25 changed files with 628 additions and 228 deletions
|
@ -27,8 +27,8 @@ func (c *Client) Login() error {
|
|||
return err
|
||||
|
||||
} else if resp.StatusCode != http.StatusOK { // check for correct status code
|
||||
log.Error().Err(err).Msg("login bad status error")
|
||||
return err
|
||||
log.Error().Err(err).Msgf("login bad status %v error", resp.StatusCode)
|
||||
return errors.New("qbittorrent login bad status")
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
@ -220,3 +220,29 @@ func (c *Client) ReAnnounceTorrents(hashes []string) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *Client) GetTransferInfo() (*TransferInfo, error) {
|
||||
var info TransferInfo
|
||||
|
||||
resp, err := c.get("transfer/info", nil)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("get torrents error")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
|
||||
body, readErr := ioutil.ReadAll(resp.Body)
|
||||
if readErr != nil {
|
||||
log.Error().Err(err).Msg("get torrents read error")
|
||||
return nil, readErr
|
||||
}
|
||||
|
||||
err = json.Unmarshal(body, &info)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("get torrents unmarshal error")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &info, nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue