(Album information for this artist is currently being loaded)
')
+ loadingtext_active = true;
+ }
+ }
+ else{
+ $('#artistnamespinner').remove()
+ $('#loadingtext').remove()
+ $('#ajaxMsg').empty()
+ $('#ajaxMsg').removeAttr('style')
+ spinner_active = false
+ loadingtext_active = false
+ loadingMessage = false
+ }
+ });
+ }
+
function initThisPage() {
$('#menu_link_getextra').click(function() {
$('#dialog').dialog();
@@ -248,10 +272,6 @@
$('#menu_link_modifyextra').click(function() {
$('#dialog').dialog();
});
-
- %if artist['Status'] == 'Loading':
- showMsg("Getting artist information",true);
- %endif
$('#album_table').dataTable({
"bDestroy": true,
"aoColumns": [
@@ -291,8 +311,12 @@
initThisPage();
getArtistBio();
if( ${songkick_enabled} ){
- getArtistsCalendar();
- }
+ getArtistsCalendar();
+ }
+ checkArtistStatus();
+ setInterval(function(){
+ checkArtistStatus();
+ }, 1500);
});
diff --git a/data/interfaces/default/js/script.js b/data/interfaces/default/js/script.js
index c28faf15..b2e56b52 100644
--- a/data/interfaces/default/js/script.js
+++ b/data/interfaces/default/js/script.js
@@ -334,6 +334,10 @@ function doAjaxCall(url,elem,reload,form) {
});
}
+function doSimpleAjaxCall(url) {
+ $.ajax(url);
+}
+
function resetFilters(text){
if ( $(".dataTables_filter").length > 0 ) {
$(".dataTables_filter input").attr("placeholder","filter " + text + "");
diff --git a/headphones/importer.py b/headphones/importer.py
index 79026040..d73293ef 100644
--- a/headphones/importer.py
+++ b/headphones/importer.py
@@ -226,15 +226,16 @@ def addArtisttoDB(artistid, extrasonly=False, forcefull=False):
skip_log = 0
#Make a user configurable variable to skip update of albums with release dates older than this date (in days)
pause_delta = headphones.MB_IGNORE_AGE
-
- check_release_date = myDB.action("SELECT ReleaseDate, Status from albums WHERE ArtistID=? AND AlbumTitle=?", (artistid, al_title)).fetchone()
-
- #Skip update if Status set
- if check_release_date and check_release_date[1]:
- logger.info("[%s] Not updating: %s (Status is %s, skipping)" % (artist['artist_name'], rg['title'], check_release_date[1]))
- continue
+
+ rg_exists = myDB.action("SELECT * from albums WHERE AlbumID=?", [rg['id']]).fetchone()
if not forcefull:
+
+ try:
+ check_release_date = rg_exists['ReleaseDate']
+ except TypeError:
+ check_release_date = None
+
if check_release_date:
if check_release_date[0] is None:
logger.info("[%s] Now updating: %s (No Release Date)" % (artist['artist_name'], rg['title']))
@@ -268,11 +269,6 @@ def addArtisttoDB(artistid, extrasonly=False, forcefull=False):
logger.info("[%s] Now adding/updating: %s (Comprehensive Force)" % (artist['artist_name'], rg['title']))
new_releases = mb.get_new_releases(rgid,includeExtras,forcefull)
- #What this does is adds new releases per artist to the allalbums + alltracks databases
- #new_releases = mb.get_new_releases(rgid,includeExtras)
- #print al_title
- #print new_releases
-
if new_releases != 0:
#Dump existing hybrid release since we're repackaging/replacing it
myDB.action("DELETE from albums WHERE ReleaseID=?", [rg['id']])
@@ -381,7 +377,7 @@ def addArtisttoDB(artistid, extrasonly=False, forcefull=False):
# If there's no release in the main albums tables, add the default (hybrid)
# If there is a release, check the ReleaseID against the AlbumID to see if they differ (user updated)
# check if the album already exists
- rg_exists = myDB.action("SELECT * from albums WHERE AlbumID=?", [rg['id']]).fetchone()
+
if not rg_exists:
releaseid = rg['id']
else:
@@ -402,11 +398,14 @@ def addArtisttoDB(artistid, extrasonly=False, forcefull=False):
"ReleaseFormat": album['ReleaseFormat']
}
- if not rg_exists:
-
+ if rg_exists:
+ newValueDict['DateAdded'] = rg_exists['DateAdded']
+ newValueDict['Status'] = rg_exists['Status']
+
+ else:
today = helpers.today()
- newValueDict['DateAdded']= today
+ newValueDict['DateAdded'] = today
if headphones.AUTOWANT_ALL:
newValueDict['Status'] = "Wanted"
diff --git a/headphones/librarysync.py b/headphones/librarysync.py
index 2371d918..4a4a4e16 100644
--- a/headphones/librarysync.py
+++ b/headphones/librarysync.py
@@ -328,12 +328,12 @@ def libraryScan(dir=None, append=False, ArtistID=None, ArtistName=None, cron=Fal
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 ? AND Matched = "Failed"', [ArtistName]))
myDB.action('UPDATE artists SET HaveTracks=? WHERE ArtistID=?', [havetracks, ArtistID])
- update_album_status()
if not append:
+ update_album_status()
lastfm.getSimilar()
logger.info('Library scan complete')
- #ADDED THIS SECTION TO MARK ALBUMS AS DOWNLOADED IF ARTISTS ARE ADDED EN MASSE BEFORE LIBRARY IS SCANNED
+#ADDED THIS SECTION TO MARK ALBUMS AS DOWNLOADED IF ARTISTS ARE ADDED EN MASSE BEFORE LIBRARY IS SCANNED
def update_album_status(AlbumID=None):
myDB = db.DBConnection()
logger.info('Counting matched tracks to mark albums as skipped/downloaded')
@@ -355,13 +355,21 @@ def update_album_status(AlbumID=None):
album_completion = 0
logger.info('Album %s does not have any tracks in database' % album['AlbumTitle'])
- if album_completion >= headphones.ALBUM_COMPLETION_PCT:
+ if album_completion >= headphones.ALBUM_COMPLETION_PCT and album['Status'] == 'Skipped':
new_album_status = "Downloaded"
+
+ # I don't think we want to change Downloaded->Skipped.....
+ # I think we can only automatically change Skipped->Downloaded when updating
+ # There was a bug report where this was causing infinite downloads if the album was
+ # recent, but matched to less than 80%. It would go Downloaded->Skipped->Wanted->Downloaded->Skipped->Wanted->etc....
+ #else:
+ # if album['Status'] == "Skipped" or album['Status'] == "Downloaded":
+ # new_album_status = "Skipped"
+ # else:
+ # new_album_status = album['Status']
else:
- if album['Status'] == "Skipped" or album['Status'] == "Downloaded":
- new_album_status = "Skipped"
- else:
- new_album_status = album['Status']
+ new_album_status = album['Status']
+
myDB.upsert("albums", {'Status' : new_album_status}, {'AlbumID' : album['AlbumID']})
if new_album_status != album['Status']:
logger.info('Album %s changed to %s' % (album['AlbumTitle'], new_album_status))
diff --git a/headphones/postprocessor.py b/headphones/postprocessor.py
index 05e90880..787db7a8 100644
--- a/headphones/postprocessor.py
+++ b/headphones/postprocessor.py
@@ -71,17 +71,21 @@ def verify(albumid, albumpath, Kind=None, forced=False):
try:
release_list = mb.getReleaseGroup(albumid)
except Exception, e:
- logger.info('Unable to get release information for manual album with rgid: %s. Error: %s' % (albumid, e))
+ logger.error('Unable to get release information for manual album with rgid: %s. Error: %s' % (albumid, e))
return
if not release_list:
- logger.info('Unable to get release information for manual album with rgid: %s' % albumid)
+ logger.error('Unable to get release information for manual album with rgid: %s' % albumid)
return
# Since we're just using this to create the bare minimum information to insert an artist/album combo, use the first release
releaseid = release_list[0]['id']
release_dict = mb.getRelease(releaseid)
+
+ if not release_dict:
+ logger.error('Unable to get release information for manual album with rgid: %s. Cannot continue' % albumid)
+ return
logger.info(u"Now adding/updating artist: " + release_dict['artist_name'])
diff --git a/headphones/versioncheck.py b/headphones/versioncheck.py
index e7bd8fd8..e1221c6d 100644
--- a/headphones/versioncheck.py
+++ b/headphones/versioncheck.py
@@ -76,7 +76,7 @@ def getVersion():
logger.error('Couldn\'t find latest installed version.')
cur_commit_hash = None
- cur_commit_hash = output
+ cur_commit_hash = str(output)
if not re.match('^[a-z0-9]+$', cur_commit_hash):
logger.error('Output doesn\'t look like a hash, not using it')
diff --git a/headphones/webserve.py b/headphones/webserve.py
index 39ddb88f..6db4c1f3 100644
--- a/headphones/webserve.py
+++ b/headphones/webserve.py
@@ -854,6 +854,16 @@ class WebInterface(object):
return json_albums
getAlbumsByArtist_json.exposed=True
+ def getArtistjson(self, ArtistID, **kwargs):
+ myDB = db.DBConnection()
+ artist = myDB.action('SELECT * FROM artists WHERE ArtistID=?', [ArtistID]).fetchone()
+ artist_json = json.dumps({
+ 'ArtistName': artist['ArtistName'],
+ 'Status': artist['Status']
+ })
+ return artist_json
+ getArtistjson.exposed=True
+
def clearhistory(self, type=None, date_added=None, title=None):
myDB = db.DBConnection()
if type: