mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-21 20:29:27 +00:00
Ignore bootlegs and similar that have their release group type set to "Album". Fixes Issue #536
This commit is contained in:
@@ -158,6 +158,16 @@ def addArtisttoDB(artistid, extrasonly=False):
|
||||
|
||||
myDB.upsert("artists", newValueDict, controlValueDict)
|
||||
|
||||
# See if we need to grab extras. Artist specific extras take precedence over global option
|
||||
# Global options are set when adding a new artist
|
||||
myDB = db.DBConnection()
|
||||
|
||||
try:
|
||||
db_artist = myDB.action('SELECT IncludeExtras, Extras from artists WHERE ArtistID=?', [artistid]).fetchone()
|
||||
includeExtras = db_artist['IncludeExtras']
|
||||
except IndexError:
|
||||
includeExtras = False
|
||||
|
||||
for rg in artist['releasegroups']:
|
||||
|
||||
logger.info("Now adding/updating: " + rg['title'])
|
||||
@@ -167,7 +177,10 @@ def addArtisttoDB(artistid, extrasonly=False):
|
||||
# check if the album already exists
|
||||
rg_exists = myDB.action("SELECT * from albums WHERE AlbumID=?", [rg['id']]).fetchone()
|
||||
|
||||
releases = mb.get_all_releases(rgid)
|
||||
releases = mb.get_all_releases(rgid,includeExtras)
|
||||
if releases == []:
|
||||
logger.info('No official releases in release group %s' % rg['title'])
|
||||
continue
|
||||
if not releases:
|
||||
errors = True
|
||||
logger.info('Unable to get release information for %s - there may not be any official releases in this release group' % rg['title'])
|
||||
|
||||
@@ -329,7 +329,7 @@ def getRelease(releaseid, include_artist_info=True):
|
||||
|
||||
return release
|
||||
|
||||
def get_all_releases(rgid):
|
||||
def get_all_releases(rgid,includeExtras=False):
|
||||
results = []
|
||||
try:
|
||||
limit = 100
|
||||
@@ -352,6 +352,11 @@ def get_all_releases(rgid):
|
||||
|
||||
releases = []
|
||||
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 = {}
|
||||
release['AlbumTitle'] = unicode(releasedata['title'])
|
||||
release['AlbumID'] = unicode(rgid)
|
||||
|
||||
Reference in New Issue
Block a user