Skip to content

Commit 28101cc

Browse files
committed
Featured users in Discovery
1 parent ef88527 commit 28101cc

16 files changed

Lines changed: 277 additions & 105 deletions

File tree

mopidy_spotmop/static/app-annotated.js

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33633,13 +33633,44 @@ angular.module('spotmop.discover', [])
3363333633
$scope.current = [];
3363433634
$scope.sections = [];
3363533635

33636-
// get my old favorites
33636+
// Get recommended users
33637+
// Currently this is a hardcoded list of user ids as there isn't a clean API that provides
33638+
// a list of 'professional' Spotify users
33639+
var userURIs = ['spotify:user:bbc','spotify:user:filtr'];
33640+
var users = [];
33641+
var requestsCompleted = 0;
33642+
for( var i = 0; i < userURIs.length; i++ ){
33643+
33644+
// process extra playlist data and add to our $scope
33645+
var callback = function(i){
33646+
return function( response ){
33647+
33648+
requestsCompleted++;
33649+
33650+
// make sure our response was not an error
33651+
if( typeof(response.error) === 'undefined' ) users.push( response );
33652+
33653+
// we've just completed our last request
33654+
if( requestsCompleted == userURIs.length - 1 ){
33655+
var section = {
33656+
title: 'Featured users',
33657+
artists: '',
33658+
items: users
33659+
}
33660+
$scope.sections.push( section );
33661+
}
33662+
};
33663+
}(i);
33664+
33665+
SpotifyService.getUser( userURIs[i] ).then( callback );
33666+
}
33667+
33668+
// Get my old favorites
3363733669
SpotifyService.getMyFavorites('artists', 50, false, 'long_term').then( function(response){
3363833670
$scope.favorites.items = $filter('shuffle')(response.items);
33639-
});
33640-
33671+
});
3364133672

33642-
// get my short-term top tracks
33673+
// Get my short-term top tracks
3364333674
SpotifyService.getMyFavorites('tracks', 50, false, 'short_term').then( function(response){
3364433675

3364533676
// shuffle our tracks for interest, and limit to 5

mopidy_spotmop/static/app.css

Lines changed: 16 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mopidy_spotmop/static/app.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mopidy_spotmop/static/app.js

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33633,13 +33633,44 @@ angular.module('spotmop.discover', [])
3363333633
$scope.current = [];
3363433634
$scope.sections = [];
3363533635

33636-
// get my old favorites
33636+
// Get recommended users
33637+
// Currently this is a hardcoded list of user ids as there isn't a clean API that provides
33638+
// a list of 'professional' Spotify users
33639+
var userURIs = ['spotify:user:bbc','spotify:user:filtr'];
33640+
var users = [];
33641+
var requestsCompleted = 0;
33642+
for( var i = 0; i < userURIs.length; i++ ){
33643+
33644+
// process extra playlist data and add to our $scope
33645+
var callback = function(i){
33646+
return function( response ){
33647+
33648+
requestsCompleted++;
33649+
33650+
// make sure our response was not an error
33651+
if( typeof(response.error) === 'undefined' ) users.push( response );
33652+
33653+
// we've just completed our last request
33654+
if( requestsCompleted == userURIs.length - 1 ){
33655+
var section = {
33656+
title: 'Featured users',
33657+
artists: '',
33658+
items: users
33659+
}
33660+
$scope.sections.push( section );
33661+
}
33662+
};
33663+
}(i);
33664+
33665+
SpotifyService.getUser( userURIs[i] ).then( callback );
33666+
}
33667+
33668+
// Get my old favorites
3363733669
SpotifyService.getMyFavorites('artists', 50, false, 'long_term').then( function(response){
3363833670
$scope.favorites.items = $filter('shuffle')(response.items);
33639-
});
33640-
33671+
});
3364133672

33642-
// get my short-term top tracks
33673+
// Get my short-term top tracks
3364333674
SpotifyService.getMyFavorites('tracks', 50, false, 'short_term').then( function(response){
3364433675

3364533676
// shuffle our tracks for interest, and limit to 5

mopidy_spotmop/static/app.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mopidy_spotmop/static/app.min.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mopidy_spotmop/static/app.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mopidy_spotmop/static/app.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

mopidy_spotmop/static/app/browse/user/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ <h1>User</h1>
88

99
<div class="user-intro">
1010
<div class="image-container">
11-
<thumbnail size="medium" images="user.images"></thumbnail>
11+
<thumbnail size="medium" images="user.images" circle></thumbnail>
1212
</div>
1313
<div class="info">
1414
<h1>

mopidy_spotmop/static/app/common/slider.template.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,22 @@
44
<div class="slides swipedisabled">
55
<div class="slides-content">
66
<div class="item-container" ng-repeat="item in items track by $index">
7+
<a ui-sref="browse.user({ uri: item.uri })" ng-if="item.type == 'user'"
8+
class="square-panel circle user draggable"
9+
data-id="{{ item.id }}"
10+
draggable="false"
11+
candrag
12+
dragobj="item">
13+
<div class="image-container">
14+
<thumbnail images="item.images" size="medium" circle></thumbnail>
15+
</div>
16+
<div class="info smaller animate">
17+
<div class="name">
18+
<span ng-bind="item.display_name" ng-if="item.display_name"></span>
19+
<span ng-bind="item.id" ng-if="!item.display_name"></span>
20+
</div>
21+
</div>
22+
</a>
723
<a ui-sref="browse.artist.overview({ uri: item.uri })" ng-if="item.type == 'artist'"
824
class="square-panel artists draggable"
925
data-id="{{ item.id }}"

0 commit comments

Comments
 (0)