mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-21 16:34:01 +01:00
Don't mark albums as wanted if it's already Downloaded (with AUTOWANT_ALL selected). Don't search until after track info is populated
This commit is contained in:
@@ -375,13 +375,6 @@ def addArtisttoDB(artistid, extrasonly=False):
|
|||||||
|
|
||||||
myDB.upsert("albums", newValueDict, controlValueDict)
|
myDB.upsert("albums", newValueDict, controlValueDict)
|
||||||
|
|
||||||
#start a search for the album if it's new and autowant_all is selected:
|
|
||||||
# Should this run in a background thread? Don't know if we want to have a bunch of
|
|
||||||
# simultaneous threads running
|
|
||||||
if not rg_exists and headphones.AUTOWANT_ALL:
|
|
||||||
from headphones import searcher
|
|
||||||
searcher.searchforalbum(albumid=rg['id'])
|
|
||||||
|
|
||||||
myDB.action('DELETE from tracks WHERE AlbumID=?', [rg['id']])
|
myDB.action('DELETE from tracks WHERE AlbumID=?', [rg['id']])
|
||||||
tracks = myDB.action('SELECT * from alltracks WHERE ReleaseID=?', [releaseid]).fetchall()
|
tracks = myDB.action('SELECT * from alltracks WHERE ReleaseID=?', [releaseid]).fetchall()
|
||||||
|
|
||||||
@@ -411,17 +404,25 @@ def addArtisttoDB(artistid, extrasonly=False):
|
|||||||
|
|
||||||
# Mark albums as downloaded if they have at least 80% (by default, configurable) of the album
|
# Mark albums as downloaded if they have at least 80% (by default, configurable) of the album
|
||||||
have_track_count = len(myDB.select('SELECT * from tracks WHERE AlbumID=? AND Location IS NOT NULL', [rg['id']]))
|
have_track_count = len(myDB.select('SELECT * from tracks WHERE AlbumID=? AND Location IS NOT NULL', [rg['id']]))
|
||||||
|
marked_as_downloaded = False
|
||||||
|
|
||||||
if rg_exists:
|
if rg_exists:
|
||||||
if rg_exists['Status'] == 'Skipped' and ((have_track_count/float(total_track_count)) >= (headphones.ALBUM_COMPLETION_PCT/100.0)):
|
if rg_exists['Status'] == 'Skipped' and ((have_track_count/float(total_track_count)) >= (headphones.ALBUM_COMPLETION_PCT/100.0)):
|
||||||
myDB.action('UPDATE albums SET Status=? WHERE AlbumID=?', ['Downloaded', rg['id']])
|
myDB.action('UPDATE albums SET Status=? WHERE AlbumID=?', ['Downloaded', rg['id']])
|
||||||
|
marked_as_downloaded = True
|
||||||
else:
|
else:
|
||||||
if ((have_track_count/float(total_track_count)) >= (headphones.ALBUM_COMPLETION_PCT/100.0)):
|
if ((have_track_count/float(total_track_count)) >= (headphones.ALBUM_COMPLETION_PCT/100.0)):
|
||||||
myDB.action('UPDATE albums SET Status=? WHERE AlbumID=?', ['Downloaded', rg['id']])
|
myDB.action('UPDATE albums SET Status=? WHERE AlbumID=?', ['Downloaded', rg['id']])
|
||||||
|
marked_as_downloaded = True
|
||||||
|
|
||||||
logger.info(u"Seeing if we need album art for " + rg['title'])
|
logger.info(u"Seeing if we need album art for " + rg['title'])
|
||||||
cache.getThumb(AlbumID=rg['id'])
|
cache.getThumb(AlbumID=rg['id'])
|
||||||
|
|
||||||
|
#start a search for the album if it's new, hasn't been marked as downloaded and autowant_all is selected:
|
||||||
|
if not rg_exists and not marked_as_downloaded and headphones.AUTOWANT_ALL:
|
||||||
|
from headphones import searcher
|
||||||
|
searcher.searchforalbum(albumid=rg['id'])
|
||||||
|
|
||||||
latestalbum = myDB.action('SELECT AlbumTitle, ReleaseDate, AlbumID from albums WHERE ArtistID=? order by ReleaseDate DESC', [artistid]).fetchone()
|
latestalbum = myDB.action('SELECT AlbumTitle, ReleaseDate, AlbumID from albums WHERE ArtistID=? order by ReleaseDate DESC', [artistid]).fetchone()
|
||||||
totaltracks = len(myDB.select('SELECT TrackTitle from tracks WHERE ArtistID=?', [artistid]))
|
totaltracks = len(myDB.select('SELECT TrackTitle from tracks WHERE ArtistID=?', [artistid]))
|
||||||
havetracks = len(myDB.select('SELECT TrackTitle from tracks WHERE ArtistID=? AND Location IS NOT NULL', [artistid])) + len(myDB.select('SELECT TrackTitle from have WHERE ArtistName like ?', [artist['artist_name']]))
|
havetracks = len(myDB.select('SELECT TrackTitle from tracks WHERE ArtistID=? AND Location IS NOT NULL', [artistid])) + len(myDB.select('SELECT TrackTitle from have WHERE ArtistName like ?', [artist['artist_name']]))
|
||||||
|
|||||||
Reference in New Issue
Block a user