Skip to content

Commit 47a6e31

Browse files
committed
Using LastFM for biographies, Echonest was returning useless ones like MySpace
1 parent d62840d commit 47a6e31

2 files changed

Lines changed: 30 additions & 9 deletions

File tree

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
<div class="biography">
22

33
<h4 class="section-title">Biography</h4>
4-
<div class="content" ng-bind="artist.biography.text"></div>
4+
<div class="content" ng-bind="artist.biography.content"></div>
55

66
<div class="details">
7-
Origin: <a href="{{ artist.biography.url }}" target="_blank" ng-bind="artist.biography.site" class="italic-text"></a>
7+
<p>
8+
Origin: <a href="{{ artist.biography.links.link.href }}" target="_blank" ng-bind="artist.biography.links.link.href" class="italic-text"></a>
9+
</p>
10+
<p>
11+
Published: <span ng-bind="artist.biography.published" class="italic-text"></span>
12+
</p>
813
</div>
914

1015
</div>

src/app/browse/artist/controller.js

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -173,12 +173,28 @@ angular.module('spotmop.browse.artist.overview({', [])
173173
/**
174174
* Biography controller
175175
**/
176-
.controller('ArtistBiographyController', function ArtistBiographyController( $scope, $timeout, $rootScope, $stateParams, EchonestService ){
176+
.controller('ArtistBiographyController', function ArtistBiographyController( $scope, $timeout, $rootScope, $stateParams, SpotifyService, LastfmService ){
177177

178-
// get the biography
179-
EchonestService.getArtistBiography( $stateParams.uri )
180-
.then( function( response ){
181-
$scope.artist.biography = response.response.biographies[0];
182-
});
178+
// check if we know the artist name yet. If not, go find the artist on Spotify first
179+
if( typeof($scope.artist.name) === 'undefined' ){
180+
181+
// get the artist from Spotify
182+
SpotifyService.getArtist( $stateParams.uri )
183+
.then( function( response ){
184+
getBio( response.name );
185+
});
186+
}else{
187+
getBio( $scope.artist.name );
188+
}
183189

184-
});
190+
// go get the biography
191+
function getBio( name ){
192+
LastfmService.artistInfo( name )
193+
.then( function( response ){
194+
$scope.artist.biography = response.artist.bio;
195+
});
196+
}
197+
});
198+
199+
200+

0 commit comments

Comments
 (0)