Skip to content

Commit

Permalink
Increased stability of lastfm covers integration
Browse files Browse the repository at this point in the history
  • Loading branch information
yvg committed Sep 6, 2010
1 parent 36dcdd2 commit 6a95931
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion code/js/mashbox1.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,14 @@ function handleList() {
var lastFmGetCover = function(artist,title,coverimg) {
var artist = artist.text();
var title = title.text();
var data = 'method=track.getinfo&api_key=3c71d615bf24a4a761091967791f9204';
var data = '';
if (artist.length > 2 && title.length > 2) {
data = 'method=track.getinfo';
}
else if (artist.length > 2 && title.length < 2) {
data = 'method=artist.getinfo';
}
data += '&api_key=3c71d615bf24a4a761091967791f9204';
if (artist.length > 2) {
data += '&artist='+artist;
}
Expand All @@ -115,6 +122,9 @@ var lastFmGetCover = function(artist,title,coverimg) {
success:function(xml){
var cover = jQuery(xml).find('image[size="small"]').text();
if (cover == '') cover = 'img/spacer.gif';
else {
cover = 'http://'+cover.split('http://')[1]
}
coverimg[0].src = cover;
}
});
Expand Down

0 comments on commit 6a95931

Please sign in to comment.