Commit 9c0d766a authored by user's avatar user
Browse files

Added new filter option to reject releases marked as trumpable.

parent 8d9390e6
......@@ -538,6 +538,7 @@ type ConfigFilter struct {
Tracker []string `yaml:"tracker"`
Uploader []string `yaml:"uploader"`
RejectUnknown bool `yaml:"reject_unknown_releases"`
RejectTrumpable bool `yaml:"reject_trumpable_releases"`
BlacklistedUploaders []string `yaml:"blacklisted_uploaders"`
}
......@@ -770,6 +771,7 @@ func (cf *ConfigFilter) String() string {
description += "\tEdition Year(s): " + strings.Join(intslice.ToStringSlice(cf.EditionYear), ", ") + "\n"
}
description += "\tReject unknown releases: " + fmt.Sprintf("%v", cf.RejectUnknown) + "\n"
description += "\tReject trumpable releases: " + fmt.Sprintf("%v", cf.RejectTrumpable) + "\n"
if len(cf.BlacklistedUploaders) != 0 {
description += "\tBlacklisted uploaders: " + strings.Join(cf.BlacklistedUploaders, ",") + "\n"
} else {
......
......@@ -183,6 +183,7 @@ func TestConfig(t *testing.T) {
check.Equal([]string{"blue"}, f.Tracker)
check.Equal([]string{"best_uploader_ever", "this other guy"}, f.Uploader)
check.True(f.RejectUnknown)
check.True(f.RejectTrumpable)
check.Equal([]string{"This Very Specific Release", "r/[dD]eluxe", "xr/Ibiza"}, f.Title)
check.Equal([]string{"Bonus", "Anniversary", "r/[dD]eluxe", "xr/[cC][lL][eE][aA][nN]"}, f.Edition)
// test must be valid next year...
......@@ -230,6 +231,7 @@ func TestConfig(t *testing.T) {
check.Nil(f.Tracker)
check.Nil(f.Uploader)
check.False(f.RejectUnknown)
check.False(f.RejectTrumpable)
check.Nil(f.Edition)
check.Nil(f.EditionYear)
......
......@@ -55,7 +55,7 @@ func analyzeAnnounce(announced string, e *Environment, t *tracker.Gazelle, autos
}
// checking if a filter is triggered
if release.Satisfies(filter) {
// get torrent info!
// getting torrent info
if !downloadedInfo {
if err := info.LoadFromID(t, release.TorrentID); err != nil {
return errors.New(errorCouldNotGetTorrentInfo)
......
......@@ -297,11 +297,14 @@ func (r *Release) HasCompatibleTrackerInfo(filter *ConfigFilter, blacklistedUplo
return false
}
}
if filter.RejectUnknown && info.CatalogNumber == "" && info.RecordLabel == "" {
logthis.Info(filter.Name+": Release has neither a record label or catalog number, rejected.", logthis.VERBOSE)
return false
}
if filter.RejectTrumpable && info.Trumpable {
logthis.Info(filter.Name+": Release is marked as trumpable, rejected.", logthis.VERBOSE)
return false
}
// taking the opportunity to retrieve and save some info
r.Size = info.Size
r.LogScore = info.LogScore
......
......@@ -117,6 +117,7 @@ filters:
excluded_type:
- Concert Recording
reject_unknown_releases: true
reject_trumpable_releases: true
title:
- This Very Specific Release
- r/[dD]eluxe
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment