mirror of
https://github.com/rembo10/headphones.git
synced 2026-03-20 11:49:27 +00:00
Bug fixes, moved delete from newartists to the artistlist_to_mbids function, don't check if blacklisted
This commit is contained in:
@@ -22,8 +22,8 @@
|
||||
<tbody>
|
||||
%for artist in newartists:
|
||||
<tr class="gradeZ">
|
||||
<td id="select"><input type="checkbox" name="${artist}" class="checkbox" /></td>
|
||||
<td id="name">${artist}</a></td>
|
||||
<td id="select"><input type="checkbox" name="${artist['ArtistName']}" class="checkbox" /></td>
|
||||
<td id="name">${artist['ArtistName']}</a></td>
|
||||
</tr>
|
||||
%endfor
|
||||
</tbody>
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
<tbody>
|
||||
%for artist in newartists:
|
||||
<tr class="gradeZ">
|
||||
<td id="select"><input type="checkbox" name="${artist}" class="checkbox" /></td>
|
||||
<td id="name">${artist}</a></td>
|
||||
<td id="select"><input type="checkbox" name="${artist['ArtistName']}" class="checkbox" /></td>
|
||||
<td id="name">${artist['ArtistName']}</a></td>
|
||||
</tr>
|
||||
%endfor
|
||||
</tbody>
|
||||
|
||||
@@ -33,8 +33,8 @@
|
||||
<tbody>
|
||||
%for artist in newartists:
|
||||
<tr class="gradeZ">
|
||||
<td id="select"><input type="checkbox" name="${artist}" class="checkbox" /></td>
|
||||
<td id="name">${artist}</a></td>
|
||||
<td id="select"><input type="checkbox" name="${artist['ArtistName']}" class="checkbox" /></td>
|
||||
<td id="name">${artist['ArtistName']}</a></td>
|
||||
</tr>
|
||||
%endfor
|
||||
</tbody>
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
<tbody>
|
||||
%for artist in newartists:
|
||||
<tr class="gradeZ">
|
||||
<td id="select"><input type="checkbox" name="${artist}" class="checkbox" /></td>
|
||||
<td id="name">${artist}</a></td>
|
||||
<td id="select"><input type="checkbox" name="${artist['ArtistName']}" class="checkbox" /></td>
|
||||
<td id="name">${artist['ArtistName']}</a></td>
|
||||
</tr>
|
||||
%endfor
|
||||
</tbody>
|
||||
|
||||
@@ -40,9 +40,6 @@ def is_exists(artistid):
|
||||
def artistlist_to_mbids(artistlist, forced=False):
|
||||
|
||||
for artist in artistlist:
|
||||
|
||||
if forced:
|
||||
artist = unicode(artist, 'utf-8')
|
||||
|
||||
results = mb.findArtist(artist, limit=1)
|
||||
|
||||
@@ -57,12 +54,15 @@ def artistlist_to_mbids(artistlist, forced=False):
|
||||
logger.info('MusicBrainz query turned up no matches for: %s' % artist)
|
||||
continue
|
||||
|
||||
# Check if it's blacklisted/various artists
|
||||
# Check if it's blacklisted/various artists (only check if it's not forced, e.g. through library scan auto-add.)
|
||||
# Forced example = Adding an artist from Manage New Artists
|
||||
myDB = db.DBConnection()
|
||||
bl_artist = myDB.action('SELECT * FROM blacklist WHERE ArtistID=?', [artistid]).fetchone()
|
||||
if bl_artist or artistid == various_artists_mbid:
|
||||
logger.info("Artist ID for '%s' is either blacklisted or Various Artists. To add artist, you must do it manually (Artist ID: %s)" % (artist, artistid))
|
||||
continue
|
||||
|
||||
if not forced:
|
||||
bl_artist = myDB.action('SELECT * FROM blacklist WHERE ArtistID=?', [artistid]).fetchone()
|
||||
if bl_artist or artistid == various_artists_mbid:
|
||||
logger.info("Artist ID for '%s' is either blacklisted or Various Artists. To add artist, you must do it manually (Artist ID: %s)" % (artist, artistid))
|
||||
continue
|
||||
|
||||
# Add to database if it doesn't exist
|
||||
if not is_exists(artistid):
|
||||
@@ -73,6 +73,10 @@ def artistlist_to_mbids(artistlist, forced=False):
|
||||
havetracks = len(myDB.select('SELECT TrackTitle from tracks WHERE ArtistID=?', [artistid])) + len(myDB.select('SELECT TrackTitle from have WHERE ArtistName like ?', [artist]))
|
||||
myDB.action('UPDATE artists SET HaveTracks=? WHERE ArtistID=?', [havetracks, artistid])
|
||||
|
||||
# Delete it from the New Artists if the request came from there
|
||||
if forced:
|
||||
myDB.action('DELETE from newartists WHERE ArtistName=?', [artist])
|
||||
|
||||
# Update the similar artist tag cloud:
|
||||
logger.info('Updating artist information from Last.fm')
|
||||
try:
|
||||
@@ -245,8 +249,6 @@ def addArtisttoDB(artistid, extrasonly=False):
|
||||
|
||||
myDB.upsert("artists", newValueDict, controlValueDict)
|
||||
|
||||
myDB.action('DELETE from newartists WHERE ArtistName=?', [artist['artist_name']])
|
||||
|
||||
logger.debug(u"Updating cache for: " + artist['artist_name'])
|
||||
cache.getThumb(ArtistID=artistid)
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ def libraryScan(dir=None):
|
||||
importer.artistlist_to_mbids(artist_list)
|
||||
else:
|
||||
logger.info('To add these artists, go to Manage->Manage New Artists')
|
||||
myDB.action('DELETE * from newartists')
|
||||
myDB.action('DELETE from newartists')
|
||||
for artist in artist_list:
|
||||
myDB.action('INSERT into newartists VALUES (?)', [artist])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user