mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-22 08:53:59 +01:00
Ignore bootlegs and similar that have their release group type set to "Album". Fixes Issue #536
This commit is contained in:
+14
-1
@@ -158,6 +158,16 @@ def addArtisttoDB(artistid, extrasonly=False):
|
|||||||
|
|
||||||
myDB.upsert("artists", newValueDict, controlValueDict)
|
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']:
|
for rg in artist['releasegroups']:
|
||||||
|
|
||||||
logger.info("Now adding/updating: " + rg['title'])
|
logger.info("Now adding/updating: " + rg['title'])
|
||||||
@@ -167,7 +177,10 @@ def addArtisttoDB(artistid, extrasonly=False):
|
|||||||
# check if the album already exists
|
# check if the album already exists
|
||||||
rg_exists = myDB.action("SELECT * from albums WHERE AlbumID=?", [rg['id']]).fetchone()
|
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:
|
if not releases:
|
||||||
errors = True
|
errors = True
|
||||||
logger.info('Unable to get release information for %s - there may not be any official releases in this release group' % rg['title'])
|
logger.info('Unable to get release information for %s - there may not be any official releases in this release group' % rg['title'])
|
||||||
|
|||||||
+6
-1
@@ -329,7 +329,7 @@ def getRelease(releaseid, include_artist_info=True):
|
|||||||
|
|
||||||
return release
|
return release
|
||||||
|
|
||||||
def get_all_releases(rgid):
|
def get_all_releases(rgid,includeExtras=False):
|
||||||
results = []
|
results = []
|
||||||
try:
|
try:
|
||||||
limit = 100
|
limit = 100
|
||||||
@@ -352,6 +352,11 @@ def get_all_releases(rgid):
|
|||||||
|
|
||||||
releases = []
|
releases = []
|
||||||
for releasedata in results:
|
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 = {}
|
||||||
release['AlbumTitle'] = unicode(releasedata['title'])
|
release['AlbumTitle'] = unicode(releasedata['title'])
|
||||||
release['AlbumID'] = unicode(rgid)
|
release['AlbumID'] = unicode(rgid)
|
||||||
|
|||||||
Reference in New Issue
Block a user