mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
fix(filters): RED and OPS lossless parsing and filtering (#1373)
* fix(filters): RED and OPS lossless parsing and filtering * fix(filters): logscore and EP parsing * fix(filters): tests * fix(filters): tests * feat(definitions): RED parse title variable * feat(indexers): setup indexer to filter tests * feat(indexers): tests and improve parsing * feat(indexers): improve tests
This commit is contained in:
parent
9db5a8b116
commit
5328078b32
15 changed files with 1093 additions and 360 deletions
|
@ -475,7 +475,7 @@ func (f *Filter) CheckFilter(r *Release) ([]string, bool) {
|
|||
f.addRejectionF("formats not matching. got: %v want: %v", r.Audio, f.Formats)
|
||||
}
|
||||
|
||||
if len(f.Quality) > 0 && !sliceContainsSlice(r.Audio, f.Quality) {
|
||||
if len(f.Quality) > 0 && !containsMatchBasic(r.Audio, f.Quality) {
|
||||
f.addRejectionF("quality not matching. got: %v want: %v", r.Audio, f.Quality)
|
||||
}
|
||||
|
||||
|
@ -547,7 +547,7 @@ func (f *Filter) CheckFilter(r *Release) ([]string, bool) {
|
|||
return nil, true
|
||||
}
|
||||
|
||||
func (f Filter) checkMaxDownloads() bool {
|
||||
func (f *Filter) checkMaxDownloads() bool {
|
||||
if f.Downloads == nil {
|
||||
return false
|
||||
}
|
||||
|
@ -580,7 +580,7 @@ func (f *Filter) isPerfectFLAC(r *Release) bool {
|
|||
if !containsAny(r.Audio, "Log") {
|
||||
return false
|
||||
}
|
||||
if !containsAny(r.Audio, "Log100") {
|
||||
if !containsAny(r.Audio, "Log100") || r.LogScore != 100 {
|
||||
return false
|
||||
}
|
||||
if !containsAny(r.Audio, "FLAC") {
|
||||
|
@ -616,6 +616,32 @@ func (f *Filter) checkSizeFilter(r *Release) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// IsPerfectFLAC Perfect is "CD FLAC Cue Log 100% Lossless or 24bit Lossless"
|
||||
func (f *Filter) IsPerfectFLAC(r *Release) ([]string, bool) {
|
||||
rejections := []string{}
|
||||
|
||||
if r.Source != "CD" {
|
||||
rejections = append(rejections, fmt.Sprintf("wanted Source CD, got %s", r.Source))
|
||||
}
|
||||
if r.AudioFormat != "FLAC" {
|
||||
rejections = append(rejections, fmt.Sprintf("wanted Format FLAC, got %s", r.AudioFormat))
|
||||
}
|
||||
if !r.HasCue {
|
||||
rejections = append(rejections, fmt.Sprintf("wanted Cue, got %t", r.HasCue))
|
||||
}
|
||||
if !r.HasLog {
|
||||
rejections = append(rejections, fmt.Sprintf("wanted Log, got %t", r.HasLog))
|
||||
}
|
||||
if r.LogScore != 100 {
|
||||
rejections = append(rejections, fmt.Sprintf("wanted Log Score 100, got %d", r.LogScore))
|
||||
}
|
||||
if !containsSlice(r.Bitrate, []string{"Lossless", "24bit Lossless"}) {
|
||||
rejections = append(rejections, fmt.Sprintf("wanted Bitrate Lossless / 24bit Lossless, got %s", r.Bitrate))
|
||||
}
|
||||
|
||||
return rejections, len(rejections) == 0
|
||||
}
|
||||
|
||||
func (f *Filter) addRejection(reason string) {
|
||||
f.Rejections = append(f.Rejections, reason)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue