From a14369cb7dd1ca0a6e72f654f87d80971512834a Mon Sep 17 00:00:00 2001 From: rembo10 Date: Sat, 4 Jul 2015 00:47:02 -0700 Subject: [PATCH] Added option to only include 'official' extras, rather than everything (bootlegs, promos, etc) --- data/interfaces/default/config.html | 3 +++ headphones/config.py | 1 + headphones/mb.py | 10 ++++++---- headphones/webserve.py | 3 ++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/data/interfaces/default/config.html b/data/interfaces/default/config.html index 55f0eae9..f380c7d6 100644 --- a/data/interfaces/default/config.html +++ b/data/interfaces/default/config.html @@ -1372,6 +1372,9 @@ %endfor +
+ +
diff --git a/headphones/config.py b/headphones/config.py index bc499fce..dec8c741 100644 --- a/headphones/config.py +++ b/headphones/config.py @@ -154,6 +154,7 @@ _CONFIG_DEFINITIONS = { 'NZBSORG_HASH': (str, 'NZBsorg', ''), 'NZBSORG_UID': (str, 'NZBsorg', ''), 'NZB_DOWNLOADER': (int, 'General', 0), + 'OFFICIAL_RELEASES_ONLY': (int, 'General', 0), 'OMGWTFNZBS': (int, 'omgwtfnzbs', 0), 'OMGWTFNZBS_APIKEY': (str, 'omgwtfnzbs', ''), 'OMGWTFNZBS_UID': (str, 'omgwtfnzbs', ''), diff --git a/headphones/mb.py b/headphones/mb.py index 5aa71143..d83b4572 100644 --- a/headphones/mb.py +++ b/headphones/mb.py @@ -466,6 +466,11 @@ def get_new_releases(rgid, includeExtras=False, forcefull=False): myDB = db.DBConnection() results = [] + + release_status = "official" + if includeExtras and not headphones.CONFIG.OFFICIAL_RELEASES_ONLY: + release_status = [] + try: limit = 100 newResults = None @@ -474,6 +479,7 @@ def get_new_releases(rgid, includeExtras=False, forcefull=False): newResults = musicbrainzngs.browse_releases( release_group=rgid, includes=['artist-credits', 'labels', 'recordings', 'release-groups', 'media'], + release_status = release_status, limit=limit, offset=len(results)) if 'release-list' not in newResults: @@ -513,10 +519,6 @@ def get_new_releases(rgid, includeExtras=False, forcefull=False): num_new_releases = 0 for releasedata in results: - #releasedata.get will return None if it doesn't have a status - #all official releases should have the Official status included - if not includeExtras and releasedata.get('status') != 'Official': - continue release = {} rel_id_check = releasedata['id'] diff --git a/headphones/webserve.py b/headphones/webserve.py index 164895db..9b2a86e4 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -1073,6 +1073,7 @@ class WebInterface(object): "file_format": headphones.CONFIG.FILE_FORMAT, "file_underscores": checked(headphones.CONFIG.FILE_UNDERSCORES), "include_extras": checked(headphones.CONFIG.INCLUDE_EXTRAS), + "official_releases_only": checked(headphones.CONFIG.OFFICIAL_RELEASES_ONLY), "autowant_upcoming": checked(headphones.CONFIG.AUTOWANT_UPCOMING), "autowant_all": checked(headphones.CONFIG.AUTOWANT_ALL), "autowant_manually_added": checked(headphones.CONFIG.AUTOWANT_MANUALLY_ADDED), @@ -1220,7 +1221,7 @@ class WebInterface(object): "use_nzbsorg", "use_omgwtfnzbs", "use_kat", "use_piratebay", "use_oldpiratebay", "use_mininova", "use_waffles", "use_rutracker", "use_whatcd", "preferred_bitrate_allow_lossless", "detect_bitrate", "ignore_clean_releases", "freeze_db", "cue_split", "move_files", "rename_files", "correct_metadata", "cleanup_files", "keep_nfo", "add_album_art", "embed_album_art", "embed_lyrics", "replace_existing_folders", "keep_original_folder", - "file_underscores", "include_extras", "autowant_upcoming", "autowant_all", "autowant_manually_added", "keep_torrent_files", "music_encoder", + "file_underscores", "include_extras", "official_releases_only", "autowant_upcoming", "autowant_all", "autowant_manually_added", "keep_torrent_files", "music_encoder", "encoderlossless", "encoder_multicore", "delete_lossless_files", "growl_enabled", "growl_onsnatch", "prowl_enabled", "prowl_onsnatch", "xbmc_enabled", "xbmc_update", "xbmc_notify", "lms_enabled", "plex_enabled", "plex_update", "plex_notify", "nma_enabled", "nma_onsnatch", "pushalot_enabled", "pushalot_onsnatch", "synoindex_enabled", "pushover_enabled",