fix(pvr): only support v3 arrs (#30)
* fix(pvr): only support v3 apis * fix(pvr): support v3 sonarr add series
This commit is contained in:
@@ -14,12 +14,14 @@ import (
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
pvrType string
|
||||
name string
|
||||
testMode bool
|
||||
pvrType string
|
||||
name string
|
||||
testMode bool
|
||||
testModeAdd bool
|
||||
|
||||
rootFolder string
|
||||
qualityProfileId int
|
||||
rootFolder string
|
||||
qualityProfileId int
|
||||
languageProfileId int
|
||||
|
||||
// options
|
||||
searchMissing bool
|
||||
@@ -57,7 +59,7 @@ func New(c nabarr.PvrConfig, mode string, m *media.Client, cc *cache.Client) (*C
|
||||
if strings.Contains(strings.ToLower(c.URL), "/api") {
|
||||
apiURL = c.URL
|
||||
} else {
|
||||
apiURL = util.JoinURL(c.URL, "api")
|
||||
apiURL = util.JoinURL(c.URL, "api", "v3")
|
||||
}
|
||||
|
||||
// set api headers
|
||||
@@ -67,9 +69,10 @@ func New(c nabarr.PvrConfig, mode string, m *media.Client, cc *cache.Client) (*C
|
||||
|
||||
// create client
|
||||
cl := &Client{
|
||||
pvrType: "sonarr",
|
||||
name: strings.ToLower(c.Name),
|
||||
testMode: strings.EqualFold(mode, "test"),
|
||||
pvrType: "sonarr",
|
||||
name: strings.ToLower(c.Name),
|
||||
testMode: util.StringSliceContains([]string{"test", "test-add"}, mode),
|
||||
testModeAdd: strings.EqualFold(mode, "test-add"),
|
||||
|
||||
rootFolder: c.RootFolder,
|
||||
|
||||
@@ -109,6 +112,13 @@ func New(c nabarr.PvrConfig, mode string, m *media.Client, cc *cache.Client) (*C
|
||||
cl.qualityProfileId = qid
|
||||
}
|
||||
|
||||
// get language profile
|
||||
if lid, err := cl.getLanguageProfileId(c.LanguageProfile); err != nil {
|
||||
return nil, fmt.Errorf("get language profile: %v: %w", c.LanguageProfile, err)
|
||||
} else {
|
||||
cl.languageProfileId = lid
|
||||
}
|
||||
|
||||
cl.log.Info().
|
||||
Str("pvr_version", ss.Version).
|
||||
Msg("Initialised")
|
||||
|
||||
Reference in New Issue
Block a user