From cda2d5ddf3dd623b3dc0e79990d78d639b63595c Mon Sep 17 00:00:00 2001 From: Patrick Speiser Date: Sun, 7 Oct 2012 06:22:03 +0200 Subject: [PATCH] Special purpose artists can have multiple ids, 0035056d-72ac-41fa-8ea6-0e27e55f42f7 and 125ec42a-7229-4250-afc5-e057484327fe, added a ban by name in addition to the existing id bans, also removes the artist if its already in the db --- headphones/importer.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/headphones/importer.py b/headphones/importer.py index 404ffe7e..158d703f 100644 --- a/headphones/importer.py +++ b/headphones/importer.py @@ -21,7 +21,7 @@ from lib.beets.mediafile import MediaFile import headphones from headphones import logger, helpers, db, mb, albumart, lastfm -#[anonymous],[data],[no artist],[traditional],[unknown],Various Artists +blacklisted_special_artist_names = ['[anonymous]','[data]','[no artist]','[traditional]','[unknown]','Various Artists'] blacklisted_special_artists = ['f731ccc4-e22a-43af-a747-64213329e088','33cf029c-63b0-41a0-9855-be2a3665fb3b',\ '314e1c25-dde7-4e4d-b2f4-0a7b9f7c56dc','eec63d3c-3b81-4ad4-b1e4-7c147d4d2b61',\ '9be7f096-97ec-4615-8957-8d40b5dcbc41','125ec42a-7229-4250-afc5-e057484327fe',\ @@ -138,6 +138,14 @@ def addArtisttoDB(artistid, extrasonly=False): artist = mb.getArtist(artistid, extrasonly) + if artist and artist.get('artist_name') in blacklisted_special_artist_names: + logger.warn('Cannot import blocked special purpose artist: %s' % artist.get('artist_name')) + myDB.action('DELETE from artists WHERE ArtistID=?', [artistid]) + #in case it's already in the db + myDB.action('DELETE from albums WHERE ArtistID=?', [artistid]) + myDB.action('DELETE from tracks WHERE ArtistID=?', [artistid]) + return + if not artist: logger.warn("Error fetching artist info. ID: " + artistid) if dbartist is None: