Fall back for searching for artist/album art. Minor layout changes

Fallback: Search for Artist ID, if can not find search by name in
LastFM API.

Good to go for a merge…

Need to change to default template? :)
This commit is contained in:
Elmar Kouwenhoven
2012-05-09 00:10:43 +02:00
parent 64aba8bb5f
commit fa87875637
10 changed files with 231 additions and 80 deletions
+23 -10
View File
@@ -1,4 +1,4 @@
lossless<%inherit file="base.html" />
<%inherit file="base.html" />
<%def name="body()">
<div class="table_wrapper">
@@ -8,10 +8,10 @@ lossless<%inherit file="base.html" />
<table class="display" id="searchresults_table">
<thead>
<tr>
%if type == 'album':
<th id="albumname">Album Name</th>
%endif
<th id="albumart"></th>
%if type == 'album':
<th id="albumname">Album Name</th>
%endif
<th id="artistname">Artist Name</th>
<th id="score">Score</th>
<th id="add"></th>
@@ -26,12 +26,12 @@ lossless<%inherit file="base.html" />
else:
grade = 'Z'
%>
<tr class="grade${grade}">
<tr class="grade${grade}">
<td id="albumart"><div id="artistImg"><img class="albumArt" src="http://ec1.images-amazon.com/images/P/${result['uniquename']}.01.MZZZZZZZ.jpg" height="50" width="50"></div></td>
%if type == 'album':
<td id="albumname"><a href="${result['albumurl']}">${result['title']}</a></td>
%endif
<td id="albumart"><div id="artistImg"><img class="albumArt" src="http://ec1.images-amazon.com/images/P/${result['uniquename']}.01.MZZZZZZZ.jpg" height="50" width="50"></div></td>
<td id="artistname"><a href="${result['url']}">${result['uniquename']}</a></td>
<td id="artistname"><a href="${result['url']}" title="${result['uniquename']}">${result['uniquename']}</a></td>
<td id="score"><div class="bar"><div class="score" style="width: ${result['score']}px">${result['score']}</div></div></td>
%if type == 'album':
<td id="add"><a href="#" onclick="doAjaxCall('addReleaseById?rid=${result['albumid']}',$(this));" data-success="Album '${result['title']}' added"><span class="ui-icon ui-icon-plus"></span> Add this album</a></td>
@@ -51,16 +51,29 @@ lossless<%inherit file="base.html" />
</%def>
<%def name="javascriptIncludes()">
<script src="js/libs/jquery.dataTables.min.js"></script>
<script>
$(document).ready(function(){
$("table#searchresults_table tr td#artistname").each(function(){
var artist = $(this).children('a').text();
var artist = $(this).children('a').attr('title');
var image = $(this).parent().find("td#albumart img");
getArtistInfo(artist,image,1);
var album = $(this).prev().text();
var getId = $(this).children('a').attr('href');
var id = getId.substr(30);
%if type == 'artist':
getArtistInfo(artist,image,1,id);
%endif
%if type == 'album':
getAlbumInfo(artist,album,image,1);
%endif
});
$('#searchresults_table').dataTable(
{
"aoColumnDefs": [
{ 'bSortable': false, 'aTargets': [ 0,3 ] }
],
"oLanguage": {
"sLengthMenu":"Show _MENU_ results per page",
"sEmptyTable": "No results",
@@ -71,8 +84,8 @@ lossless<%inherit file="base.html" />
"iDisplayLength": 25,
"sPaginationType": "full_numbers",
"aaSorting": []
});
resetFilters("album");
});
$(window).load(function(){
initFancybox();