mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-22 00:44:00 +01:00
Initial changes to stop artist page from refreshing when artist is loading
This commit is contained in:
@@ -42,14 +42,8 @@
|
|||||||
<div id="artistImg">
|
<div id="artistImg">
|
||||||
<img id="artistImage" class="albumArt" alt="" src="artwork/artist/${artist['ArtistID']}"/>
|
<img id="artistImage" class="albumArt" alt="" src="artwork/artist/${artist['ArtistID']}"/>
|
||||||
</div>
|
</div>
|
||||||
<h1>
|
<h1 id="artistname">
|
||||||
%if artist['Status'] == 'Loading':
|
|
||||||
<i class="fa fa-refresh fa-spin"></i>
|
|
||||||
%endif
|
|
||||||
<a href="http://musicbrainz.org/artist/${artist['ArtistID']}">${artist['ArtistName']}</a>
|
<a href="http://musicbrainz.org/artist/${artist['ArtistID']}">${artist['ArtistName']}</a>
|
||||||
%if artist['Status'] == 'Loading':
|
|
||||||
<h3><i>(Album information for this artist is currently being loaded)</i></h3>
|
|
||||||
%endif
|
|
||||||
</h1>
|
</h1>
|
||||||
<div id="artistBio"></div>
|
<div id="artistBio"></div>
|
||||||
</div>
|
</div>
|
||||||
@@ -156,9 +150,6 @@
|
|||||||
|
|
||||||
<%def name="headIncludes()">
|
<%def name="headIncludes()">
|
||||||
<link rel="stylesheet" href="interfaces/default/css/data_table.css">
|
<link rel="stylesheet" href="interfaces/default/css/data_table.css">
|
||||||
%if artist['Status'] == 'Loading':
|
|
||||||
<meta http-equiv="refresh" content="5">
|
|
||||||
%endif
|
|
||||||
</%def>
|
</%def>
|
||||||
|
|
||||||
<%def name="javascriptIncludes()">
|
<%def name="javascriptIncludes()">
|
||||||
@@ -171,7 +162,6 @@
|
|||||||
getInfo(elem,id,'artist');
|
getInfo(elem,id,'artist');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
<%
|
<%
|
||||||
if headphones.SONGKICK_FILTER_ENABLED:
|
if headphones.SONGKICK_FILTER_ENABLED:
|
||||||
songkick_filter_enabled = "true"
|
songkick_filter_enabled = "true"
|
||||||
@@ -240,6 +230,41 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var loadingMessage = false;
|
||||||
|
var spinner_active = false;
|
||||||
|
var loadingtext_active = false;
|
||||||
|
|
||||||
|
function checkArtistStatus() {
|
||||||
|
$.ajax({
|
||||||
|
url: "getArtistStatus?ArtistID=${artist['ArtistID']}",
|
||||||
|
complete: function(result) {
|
||||||
|
if (result.responseText == "Loading"){
|
||||||
|
refreshTable();
|
||||||
|
if (loadingMessage == false){
|
||||||
|
showMsg("Getting artist information",true);
|
||||||
|
loadingMessage = true;
|
||||||
|
}
|
||||||
|
if (spinner_active == false){
|
||||||
|
$('#artistname').prepend('<i class="fa fa-refresh fa-spin" id="artistnamespinner"></i>')
|
||||||
|
spinner_active = true;
|
||||||
|
}
|
||||||
|
if (loadingtext_active == false){
|
||||||
|
$('#artistname').append('<h3 id="loadingtext"><i>(Album information for this artist is currently being loaded)</i></h3>')
|
||||||
|
loadingtext_active = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$('#artistnamespinner').remove()
|
||||||
|
$('#loadingtext').remove()
|
||||||
|
$('#ajaxMsg').remove()
|
||||||
|
spinner_active = false
|
||||||
|
loadingtext_active = false
|
||||||
|
loadingMessage = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function initThisPage() {
|
function initThisPage() {
|
||||||
$('#menu_link_getextra').click(function() {
|
$('#menu_link_getextra').click(function() {
|
||||||
$('#dialog').dialog();
|
$('#dialog').dialog();
|
||||||
@@ -248,10 +273,6 @@
|
|||||||
$('#menu_link_modifyextra').click(function() {
|
$('#menu_link_modifyextra').click(function() {
|
||||||
$('#dialog').dialog();
|
$('#dialog').dialog();
|
||||||
});
|
});
|
||||||
|
|
||||||
%if artist['Status'] == 'Loading':
|
|
||||||
showMsg("Getting artist information",true);
|
|
||||||
%endif
|
|
||||||
$('#album_table').dataTable({
|
$('#album_table').dataTable({
|
||||||
"bDestroy": true,
|
"bDestroy": true,
|
||||||
"aoColumns": [
|
"aoColumns": [
|
||||||
@@ -291,8 +312,12 @@
|
|||||||
initThisPage();
|
initThisPage();
|
||||||
getArtistBio();
|
getArtistBio();
|
||||||
if( ${songkick_enabled} ){
|
if( ${songkick_enabled} ){
|
||||||
getArtistsCalendar();
|
getArtistsCalendar();
|
||||||
}
|
}
|
||||||
|
checkArtistStatus();
|
||||||
|
setInterval(function(){
|
||||||
|
checkArtistStatus();
|
||||||
|
}, 3000);
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -854,6 +854,12 @@ class WebInterface(object):
|
|||||||
return json_albums
|
return json_albums
|
||||||
getAlbumsByArtist_json.exposed=True
|
getAlbumsByArtist_json.exposed=True
|
||||||
|
|
||||||
|
def getArtistStatus(self, ArtistID):
|
||||||
|
myDB = db.DBConnection()
|
||||||
|
artist = myDB.action('SELECT Status FROM artists WHERE ArtistID=?', [ArtistID]).fetchone()
|
||||||
|
return artist['Status']
|
||||||
|
getArtistStatus.exposed=True
|
||||||
|
|
||||||
def clearhistory(self, type=None, date_added=None, title=None):
|
def clearhistory(self, type=None, date_added=None, title=None):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
if type:
|
if type:
|
||||||
|
|||||||
Reference in New Issue
Block a user