From 33c5229c6ddbde0123ac9d3b9623f15468c058ee Mon Sep 17 00:00:00 2001 From: Austin Best Date: Wed, 18 Sep 2024 18:15:38 -0400 Subject: [PATCH] Add support for new quality profile field minUpgradeFormatScore --- lidarr/qualityprofile.go | 17 ++++++------- radarr/qualityprofile.go | 19 ++++++++------- radarr/qualityprofile_test.go | 45 +++++++++++++++++++++-------------- readarr/qualityprofile.go | 17 ++++++------- sonarr/qualityprofile.go | 19 ++++++++------- 5 files changed, 65 insertions(+), 52 deletions(-) diff --git a/lidarr/qualityprofile.go b/lidarr/qualityprofile.go index d798abb..831da50 100644 --- a/lidarr/qualityprofile.go +++ b/lidarr/qualityprofile.go @@ -14,14 +14,15 @@ const bpQualityProfile = APIver + "/qualityProfile" // QualityProfile is the /api/v1/qualityprofile endpoint. type QualityProfile struct { - ID int64 `json:"id"` - Name string `json:"name"` - UpgradeAllowed bool `json:"upgradeAllowed"` - Cutoff int64 `json:"cutoff"` - Qualities []*starr.Quality `json:"items"` - MinFormatScore int64 `json:"minFormatScore"` - CutoffFormatScore int64 `json:"cutoffFormatScore"` - FormatItems []*starr.FormatItem `json:"formatItems"` + ID int64 `json:"id"` + Name string `json:"name"` + UpgradeAllowed bool `json:"upgradeAllowed"` + Cutoff int64 `json:"cutoff"` + Qualities []*starr.Quality `json:"items"` + MinFormatScore int64 `json:"minFormatScore"` + MinUpgradeFormatScore int64 `json:"minUpgradeFormatScore"` + CutoffFormatScore int64 `json:"cutoffFormatScore"` + FormatItems []*starr.FormatItem `json:"formatItems"` } // GetQualityProfiles returns the quality profiles. diff --git a/radarr/qualityprofile.go b/radarr/qualityprofile.go index e3e0893..a9b867e 100644 --- a/radarr/qualityprofile.go +++ b/radarr/qualityprofile.go @@ -14,15 +14,16 @@ const bpQualityProfile = APIver + "/qualityProfile" // QualityProfile is applied to Movies. type QualityProfile struct { - ID int64 `json:"id,omitempty"` - Name string `json:"name,omitempty"` - UpgradeAllowed bool `json:"upgradeAllowed"` - Cutoff int64 `json:"cutoff"` - Qualities []*starr.Quality `json:"items,omitempty"` - MinFormatScore int64 `json:"minFormatScore"` - CutoffFormatScore int64 `json:"cutoffFormatScore"` - FormatItems []*starr.FormatItem `json:"formatItems"` - Language *starr.Value `json:"language,omitempty"` + ID int64 `json:"id,omitempty"` + Name string `json:"name,omitempty"` + UpgradeAllowed bool `json:"upgradeAllowed"` + Cutoff int64 `json:"cutoff"` + Qualities []*starr.Quality `json:"items,omitempty"` + MinFormatScore int64 `json:"minFormatScore"` + MinUpgradeFormatScore int64 `json:"minUpgradeFormatScore"` + CutoffFormatScore int64 `json:"cutoffFormatScore"` + FormatItems []*starr.FormatItem `json:"formatItems"` + Language *starr.Value `json:"language,omitempty"` } // GetQualityProfiles returns all configured quality profiles. diff --git a/radarr/qualityprofile_test.go b/radarr/qualityprofile_test.go index 215b0da..4bd4790 100644 --- a/radarr/qualityprofile_test.go +++ b/radarr/qualityprofile_test.go @@ -47,6 +47,7 @@ const ( } ], "minFormatScore": 0, + "minUpgradeFormatScore": 1, "cutoffFormatScore": 0, "formatItems": [], "language": { @@ -59,12 +60,12 @@ const ( addQualityProfileRequest = `{"name":"test","upgradeAllowed":false,"cutoff":1003,"items":[{"name":"WEB 2160p",` + `"id":1003,"items":[{"quality":{"id":18,"name":"WEBDL-2160p","source":"webdl","resolution":2160,"modifier":"none"},` + `"allowed":true},{"quality":{"id":17,"name":"WEBRip-2160p","source":"webrip","resolution":2160,"modifier":"none"},` + - `"allowed":true}],"allowed":true}],"minFormatScore":0,"cutoffFormatScore":0,"formatItems":null,` + + `"allowed":true}],"allowed":true}],"minFormatScore":0,"minUpgradeFormatScore":1,"cutoffFormatScore":0,"formatItems":null,` + `"language":{"id":1,"name":"English"}}` + "\n" updateQualityProfileRequest = `{"id":7,"name":"test","upgradeAllowed":false,"cutoff":1003,"items":` + `[{"name":"WEB 2160p","id":1003,"items":[{"quality":{"id":18,"name":"WEBDL-2160p","source":"webdl",` + `"resolution":2160,"modifier":"none"},"allowed":true},{"quality":{"id":17,"name":"WEBRip-2160p","source":"webrip",` + - `"resolution":2160,"modifier":"none"},"allowed":true}],"allowed":true}],"minFormatScore":0,` + + `"resolution":2160,"modifier":"none"},"allowed":true}],"allowed":true}],"minFormatScore":0,"minUpgradeFormatScore":1,` + `"cutoffFormatScore":0,"formatItems":null,"language":{"id":1,"name":"English"}}` + "\n" ) @@ -114,8 +115,9 @@ func TestGetQualityProfiles(t *testing.T) { Allowed: true, }, }, - MinFormatScore: 0, - CutoffFormatScore: 0, + MinFormatScore: 0, + MinUpgradeFormatScore: 1, + CutoffFormatScore: 0, Language: &starr.Value{ ID: 1, Name: "English", @@ -194,8 +196,9 @@ func TestGetQualityProfile(t *testing.T) { Allowed: true, }, }, - MinFormatScore: 0, - CutoffFormatScore: 0, + MinFormatScore: 0, + CutoffFormatScore: 0, + MinUpgradeFormatScore: 1, Language: &starr.Value{ ID: 1, Name: "English", @@ -269,8 +272,9 @@ func TestAddQualityProfile(t *testing.T) { Allowed: true, }, }, - MinFormatScore: 0, - CutoffFormatScore: 0, + MinFormatScore: 0, + MinUpgradeFormatScore: 1, + CutoffFormatScore: 0, Language: &starr.Value{ ID: 1, Name: "English", @@ -313,8 +317,9 @@ func TestAddQualityProfile(t *testing.T) { Allowed: true, }, }, - MinFormatScore: 0, - CutoffFormatScore: 0, + MinFormatScore: 0, + MinUpgradeFormatScore: 1, + CutoffFormatScore: 0, Language: &starr.Value{ ID: 1, Name: "English", @@ -358,8 +363,9 @@ func TestAddQualityProfile(t *testing.T) { Allowed: true, }, }, - MinFormatScore: 0, - CutoffFormatScore: 0, + MinFormatScore: 0, + MinUpgradeFormatScore: 1, + CutoffFormatScore: 0, Language: &starr.Value{ ID: 1, Name: "English", @@ -427,8 +433,9 @@ func TestUpdateQualityProfile(t *testing.T) { Allowed: true, }, }, - MinFormatScore: 0, - CutoffFormatScore: 0, + MinFormatScore: 0, + MinUpgradeFormatScore: 1, + CutoffFormatScore: 0, Language: &starr.Value{ ID: 1, Name: "English", @@ -472,8 +479,9 @@ func TestUpdateQualityProfile(t *testing.T) { Allowed: true, }, }, - MinFormatScore: 0, - CutoffFormatScore: 0, + MinFormatScore: 0, + MinUpgradeFormatScore: 1, + CutoffFormatScore: 0, Language: &starr.Value{ ID: 1, Name: "English", @@ -517,8 +525,9 @@ func TestUpdateQualityProfile(t *testing.T) { Allowed: true, }, }, - MinFormatScore: 0, - CutoffFormatScore: 0, + MinFormatScore: 0, + MinUpgradeFormatScore: 1, + CutoffFormatScore: 0, Language: &starr.Value{ ID: 1, Name: "English", diff --git a/readarr/qualityprofile.go b/readarr/qualityprofile.go index e49d382..39bb1e3 100644 --- a/readarr/qualityprofile.go +++ b/readarr/qualityprofile.go @@ -14,14 +14,15 @@ const bpQualityProfile = APIver + "/qualityProfile" // QualityProfile is the /api/v1/qualityprofile endpoint. type QualityProfile struct { - ID int64 `json:"id"` - Name string `json:"name"` - UpgradeAllowed bool `json:"upgradeAllowed"` - Cutoff int64 `json:"cutoff"` - Qualities []*starr.Quality `json:"items"` - MinFormatScore int64 `json:"minFormatScore"` - CutoffFormatScore int64 `json:"cutoffFormatScore"` - FormatItems []*starr.FormatItem `json:"formatItems"` + ID int64 `json:"id"` + Name string `json:"name"` + UpgradeAllowed bool `json:"upgradeAllowed"` + Cutoff int64 `json:"cutoff"` + Qualities []*starr.Quality `json:"items"` + MinFormatScore int64 `json:"minFormatScore"` + MinUpgradeFormatScore int64 `json:"minUpgradeFormatScore"` + CutoffFormatScore int64 `json:"cutoffFormatScore"` + FormatItems []*starr.FormatItem `json:"formatItems"` } // GetQualityProfiles returns the quality profiles. diff --git a/sonarr/qualityprofile.go b/sonarr/qualityprofile.go index 0ad17ff..3b8eab1 100644 --- a/sonarr/qualityprofile.go +++ b/sonarr/qualityprofile.go @@ -15,15 +15,16 @@ const bpQualityProfile = APIver + "/qualityProfile" // QualityProfile is the /api/v3/qualityprofile endpoint. type QualityProfile struct { - UpgradeAllowed bool `json:"upgradeAllowed"` - ID int64 `json:"id"` - Cutoff int64 `json:"cutoff"` - Name string `json:"name"` - Qualities []*starr.Quality `json:"items"` - MinFormatScore int64 `json:"minFormatScore"` // v4 only. - CutoffFormatScore int64 `json:"cutoffFormatScore"` // v4 only. - FormatItems []*starr.FormatItem `json:"formatItems,omitempty"` // v4 only. - Language *starr.Value `json:"language,omitempty"` // v4 only. + UpgradeAllowed bool `json:"upgradeAllowed"` + ID int64 `json:"id"` + Cutoff int64 `json:"cutoff"` + Name string `json:"name"` + Qualities []*starr.Quality `json:"items"` + MinFormatScore int64 `json:"minFormatScore"` // v4 only. + MinUpgradeFormatScore int64 `json:"minUpgradeFormatScore"` // v4 only. + CutoffFormatScore int64 `json:"cutoffFormatScore"` // v4 only. + FormatItems []*starr.FormatItem `json:"formatItems,omitempty"` // v4 only. + Language *starr.Value `json:"language,omitempty"` // v4 only. } // GetQualityProfiles returns all configured quality profiles.