mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(downloadclients): arrs change size type to uint64 (#1744)
* fix(downloadclients): arrs change size type to uint64 * fix(downloadclients): check resp.Body
This commit is contained in:
parent
e9726363b4
commit
bf7e1381ac
15 changed files with 98 additions and 10 deletions
|
@ -34,7 +34,7 @@ func (s *service) lidarr(ctx context.Context, action *domain.Action, release dom
|
|||
InfoUrl: release.InfoURL,
|
||||
DownloadUrl: release.DownloadURL,
|
||||
MagnetUrl: release.MagnetURI,
|
||||
Size: int64(release.Size),
|
||||
Size: release.Size,
|
||||
Indexer: release.Indexer.GetExternalIdentifier(),
|
||||
DownloadClientId: client.Settings.ExternalDownloadClientId,
|
||||
DownloadClient: client.Settings.ExternalDownloadClient,
|
||||
|
|
|
@ -34,7 +34,7 @@ func (s *service) radarr(ctx context.Context, action *domain.Action, release dom
|
|||
InfoUrl: release.InfoURL,
|
||||
DownloadUrl: release.DownloadURL,
|
||||
MagnetUrl: release.MagnetURI,
|
||||
Size: int64(release.Size),
|
||||
Size: release.Size,
|
||||
Indexer: release.Indexer.GetExternalIdentifier(),
|
||||
DownloadClientId: client.Settings.ExternalDownloadClientId,
|
||||
DownloadClient: client.Settings.ExternalDownloadClient,
|
||||
|
|
|
@ -34,7 +34,7 @@ func (s *service) readarr(ctx context.Context, action *domain.Action, release do
|
|||
InfoUrl: release.InfoURL,
|
||||
DownloadUrl: release.DownloadURL,
|
||||
MagnetUrl: release.MagnetURI,
|
||||
Size: int64(release.Size),
|
||||
Size: release.Size,
|
||||
Indexer: release.Indexer.GetExternalIdentifier(),
|
||||
DownloadClientId: client.Settings.ExternalDownloadClientId,
|
||||
DownloadClient: client.Settings.ExternalDownloadClient,
|
||||
|
|
|
@ -34,7 +34,7 @@ func (s *service) sonarr(ctx context.Context, action *domain.Action, release dom
|
|||
InfoUrl: release.InfoURL,
|
||||
DownloadUrl: release.DownloadURL,
|
||||
MagnetUrl: release.MagnetURI,
|
||||
Size: int64(release.Size),
|
||||
Size: release.Size,
|
||||
Indexer: release.Indexer.GetExternalIdentifier(),
|
||||
DownloadClientId: client.Settings.ExternalDownloadClientId,
|
||||
DownloadClient: client.Settings.ExternalDownloadClient,
|
||||
|
|
|
@ -34,7 +34,7 @@ func (s *service) whisparr(ctx context.Context, action *domain.Action, release d
|
|||
InfoUrl: release.InfoURL,
|
||||
DownloadUrl: release.DownloadURL,
|
||||
MagnetUrl: release.MagnetURI,
|
||||
Size: int64(release.Size),
|
||||
Size: release.Size,
|
||||
Indexer: release.Indexer.GetExternalIdentifier(),
|
||||
DownloadClientId: client.Settings.ExternalDownloadClientId,
|
||||
DownloadClient: client.Settings.ExternalDownloadClient,
|
||||
|
|
|
@ -17,6 +17,10 @@ import (
|
|||
|
||||
func (c *client) get(ctx context.Context, endpoint string) (int, []byte, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return 0, nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v1/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -38,6 +42,10 @@ func (c *client) get(ctx context.Context, endpoint string) (int, []byte, error)
|
|||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.Body == nil {
|
||||
return resp.StatusCode, nil, errors.New("response body is nil")
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
if _, err = io.Copy(&buf, resp.Body); err != nil {
|
||||
return resp.StatusCode, nil, errors.Wrap(err, "lidarr.io.Copy error")
|
||||
|
@ -48,6 +56,10 @@ func (c *client) get(ctx context.Context, endpoint string) (int, []byte, error)
|
|||
|
||||
func (c *client) post(ctx context.Context, endpoint string, data interface{}) (*http.Response, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v1/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -87,6 +99,10 @@ func (c *client) post(ctx context.Context, endpoint string, data interface{}) (*
|
|||
|
||||
func (c *client) postBody(ctx context.Context, endpoint string, data interface{}) (int, []byte, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return 0, nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v1/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -113,6 +129,10 @@ func (c *client) postBody(ctx context.Context, endpoint string, data interface{}
|
|||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.Body == nil {
|
||||
return resp.StatusCode, nil, errors.New("response body is nil")
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
if _, err = io.Copy(&buf, resp.Body); err != nil {
|
||||
return resp.StatusCode, nil, errors.Wrap(err, "lidarr.io.Copy")
|
||||
|
|
|
@ -66,7 +66,7 @@ type Release struct {
|
|||
InfoUrl string `json:"infoUrl,omitempty"`
|
||||
DownloadUrl string `json:"downloadUrl,omitempty"`
|
||||
MagnetUrl string `json:"magnetUrl,omitempty"`
|
||||
Size int64 `json:"size"`
|
||||
Size uint64 `json:"size"`
|
||||
Indexer string `json:"indexer"`
|
||||
DownloadProtocol string `json:"downloadProtocol"`
|
||||
Protocol string `json:"protocol"`
|
||||
|
|
|
@ -17,6 +17,10 @@ import (
|
|||
|
||||
func (c *client) get(ctx context.Context, endpoint string) (int, []byte, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return 0, nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v3/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -38,6 +42,10 @@ func (c *client) get(ctx context.Context, endpoint string) (int, []byte, error)
|
|||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.Body == nil {
|
||||
return resp.StatusCode, nil, errors.New("response body is nil")
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
if _, err = io.Copy(&buf, resp.Body); err != nil {
|
||||
return resp.StatusCode, nil, errors.Wrap(err, "radarr.io.Copy")
|
||||
|
@ -48,6 +56,10 @@ func (c *client) get(ctx context.Context, endpoint string) (int, []byte, error)
|
|||
|
||||
func (c *client) post(ctx context.Context, endpoint string, data interface{}) (*http.Response, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v3/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -89,6 +101,10 @@ func (c *client) post(ctx context.Context, endpoint string, data interface{}) (*
|
|||
|
||||
func (c *client) postBody(ctx context.Context, endpoint string, data interface{}) (int, []byte, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return 0, nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v3/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -115,6 +131,10 @@ func (c *client) postBody(ctx context.Context, endpoint string, data interface{}
|
|||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.Body == nil {
|
||||
return resp.StatusCode, nil, errors.New("response body is nil")
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
if _, err = io.Copy(&buf, resp.Body); err != nil {
|
||||
return resp.StatusCode, nil, errors.Wrap(err, "radarr.io.Copy")
|
||||
|
|
|
@ -65,7 +65,7 @@ type Release struct {
|
|||
InfoUrl string `json:"infoUrl,omitempty"`
|
||||
DownloadUrl string `json:"downloadUrl,omitempty"`
|
||||
MagnetUrl string `json:"magnetUrl,omitempty"`
|
||||
Size int64 `json:"size"`
|
||||
Size uint64 `json:"size"`
|
||||
Indexer string `json:"indexer"`
|
||||
DownloadProtocol string `json:"downloadProtocol"`
|
||||
Protocol string `json:"protocol"`
|
||||
|
|
|
@ -17,6 +17,10 @@ import (
|
|||
|
||||
func (c *client) get(ctx context.Context, endpoint string) (int, []byte, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return 0, nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v1/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -38,6 +42,10 @@ func (c *client) get(ctx context.Context, endpoint string) (int, []byte, error)
|
|||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.Body == nil {
|
||||
return resp.StatusCode, nil, errors.New("response body is nil")
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
if _, err = io.Copy(&buf, resp.Body); err != nil {
|
||||
return resp.StatusCode, nil, errors.Wrap(err, "readarr.io.Copy")
|
||||
|
@ -48,6 +56,10 @@ func (c *client) get(ctx context.Context, endpoint string) (int, []byte, error)
|
|||
|
||||
func (c *client) post(ctx context.Context, endpoint string, data interface{}) (*http.Response, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v1/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -87,6 +99,10 @@ func (c *client) post(ctx context.Context, endpoint string, data interface{}) (*
|
|||
|
||||
func (c *client) postBody(ctx context.Context, endpoint string, data interface{}) (int, []byte, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return 0, nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v1/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -115,6 +131,10 @@ func (c *client) postBody(ctx context.Context, endpoint string, data interface{}
|
|||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.Body == nil {
|
||||
return resp.StatusCode, nil, errors.New("response body is nil")
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
if _, err = io.Copy(&buf, resp.Body); err != nil {
|
||||
return resp.StatusCode, nil, errors.Wrap(err, "readarr.io.Copy")
|
||||
|
|
|
@ -67,7 +67,7 @@ type Release struct {
|
|||
InfoUrl string `json:"infoUrl,omitempty"`
|
||||
DownloadUrl string `json:"downloadUrl,omitempty"`
|
||||
MagnetUrl string `json:"magnetUrl,omitempty"`
|
||||
Size int64 `json:"size"`
|
||||
Size uint64 `json:"size"`
|
||||
Indexer string `json:"indexer"`
|
||||
DownloadProtocol string `json:"downloadProtocol"`
|
||||
Protocol string `json:"protocol"`
|
||||
|
|
|
@ -17,6 +17,10 @@ import (
|
|||
|
||||
func (c *client) get(ctx context.Context, endpoint string) (int, []byte, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return 0, nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v3/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -38,6 +42,10 @@ func (c *client) get(ctx context.Context, endpoint string) (int, []byte, error)
|
|||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.Body == nil {
|
||||
return resp.StatusCode, nil, errors.New("response body is nil")
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
if _, err = io.Copy(&buf, resp.Body); err != nil {
|
||||
return resp.StatusCode, nil, errors.Wrap(err, "sonarr.io.Copy")
|
||||
|
@ -48,6 +56,10 @@ func (c *client) get(ctx context.Context, endpoint string) (int, []byte, error)
|
|||
|
||||
func (c *client) post(ctx context.Context, endpoint string, data interface{}) (*http.Response, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v3/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -87,6 +99,10 @@ func (c *client) post(ctx context.Context, endpoint string, data interface{}) (*
|
|||
|
||||
func (c *client) postBody(ctx context.Context, endpoint string, data interface{}) (int, []byte, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return 0, nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v3/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -113,6 +129,10 @@ func (c *client) postBody(ctx context.Context, endpoint string, data interface{}
|
|||
|
||||
defer resp.Body.Close()
|
||||
|
||||
if resp.Body == nil {
|
||||
return resp.StatusCode, nil, errors.New("response body is nil")
|
||||
}
|
||||
|
||||
var buf bytes.Buffer
|
||||
if _, err = io.Copy(&buf, resp.Body); err != nil {
|
||||
return resp.StatusCode, nil, errors.Wrap(err, "sonarr.io.Copy")
|
||||
|
|
|
@ -67,7 +67,7 @@ type Release struct {
|
|||
InfoUrl string `json:"infoUrl,omitempty"`
|
||||
DownloadUrl string `json:"downloadUrl,omitempty"`
|
||||
MagnetUrl string `json:"magnetUrl,omitempty"`
|
||||
Size int64 `json:"size"`
|
||||
Size uint64 `json:"size"`
|
||||
Indexer string `json:"indexer"`
|
||||
DownloadProtocol string `json:"downloadProtocol"`
|
||||
Protocol string `json:"protocol"`
|
||||
|
|
|
@ -16,6 +16,10 @@ import (
|
|||
|
||||
func (c *client) get(ctx context.Context, endpoint string) (*http.Response, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v3/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
@ -45,6 +49,10 @@ func (c *client) get(ctx context.Context, endpoint string) (*http.Response, erro
|
|||
|
||||
func (c *client) post(ctx context.Context, endpoint string, data interface{}) (*http.Response, error) {
|
||||
u, err := url.Parse(c.config.Hostname)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not parse url: %s", c.config.Hostname)
|
||||
}
|
||||
|
||||
u.Path = path.Join(u.Path, "/api/v3/", endpoint)
|
||||
reqUrl := u.String()
|
||||
|
||||
|
|
|
@ -65,7 +65,7 @@ type Release struct {
|
|||
InfoUrl string `json:"infoUrl,omitempty"`
|
||||
DownloadUrl string `json:"downloadUrl,omitempty"`
|
||||
MagnetUrl string `json:"magnetUrl,omitempty"`
|
||||
Size int64 `json:"size"`
|
||||
Size uint64 `json:"size"`
|
||||
Indexer string `json:"indexer"`
|
||||
DownloadProtocol string `json:"downloadProtocol"`
|
||||
Protocol string `json:"protocol"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue