Skip to content

Commit

Permalink
Add support for new quality profile field minUpgradeFormatScore
Browse files Browse the repository at this point in the history
  • Loading branch information
austinwbest committed Sep 18, 2024
1 parent 9ab5f90 commit 33c5229
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 52 deletions.
17 changes: 9 additions & 8 deletions lidarr/qualityprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 10 additions & 9 deletions radarr/qualityprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
45 changes: 27 additions & 18 deletions radarr/qualityprofile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
}
],
"minFormatScore": 0,
"minUpgradeFormatScore": 1,
"cutoffFormatScore": 0,
"formatItems": [],
"language": {
Expand All @@ -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"
)

Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
17 changes: 9 additions & 8 deletions readarr/qualityprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
19 changes: 10 additions & 9 deletions sonarr/qualityprofile.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 33c5229

Please sign in to comment.