Skip to content

Commit

Permalink
Buildout 2.7.4
Browse files Browse the repository at this point in the history
  • Loading branch information
jaedb committed Jul 22, 2016
1 parent 6091742 commit 0885333
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 41 deletions.
9 changes: 4 additions & 5 deletions mopidy_spotmop/services/queuer/queuer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
from tornado.escape import json_encode
import subprocess

state = {}
state = {
'mode': 'normal'
}

class QueuerRequestHandler(tornado.web.RequestHandler):

Expand All @@ -17,17 +19,14 @@ def set_default_headers(self):
def initialize(self, core, config):
self.core = core
self.config = config
state = {
'mode': 'normal'
}

## get the current state
def get(self, action):
self.write(json_encode(state))

## post to update the state
def post(self, mode):
state[mode] = 'radio'
state['mode'] = 'radio'
self.write(json_encode(state))


Expand Down
49 changes: 21 additions & 28 deletions mopidy_spotmop/static/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -30625,7 +30625,7 @@ angular.module('spotmop.browse.artist', [])
}
$scope.playArtistRadio = function(){

NotifyService.notify('Starting artist radio');
NotifyService.notify('Starting artist radio (beta)');

// get the artist's top tracks
SpotifyService.getRecommendations( 5, 0, $scope.artist.id )
Expand Down Expand Up @@ -35251,6 +35251,7 @@ angular.module('spotmop.search', [])
case 'album' :
SpotifyService.getSearchResults( 'album', query, 50 )
.then( function(response){
console.log( response );
$scope.albums = response.albums;
if( response.albums.next )
nextOffset = response.albums.offset + response.albums.limit;
Expand Down Expand Up @@ -35288,28 +35289,15 @@ angular.module('spotmop.search', [])
break;

default :
SpotifyService.getSearchResults( 'track', query, 50 )
SpotifyService.getSearchResults( 'track,album,artist,playlist', query, 50 )
.then( function(response){
$scope.albums = response.albums;
$scope.artists = response.artists;
$scope.playlists = response.playlists;
$scope.tracklist = response.tracks;
$scope.tracklist.type = 'track';
$scope.tracklist.tracks = response.tracks.items;
});

SpotifyService.getSearchResults( 'album', query, 50 )
.then( function(response){
$scope.albums = response.albums;
});

SpotifyService.getSearchResults( 'artist', query, 50 )
.then( function(response){
$scope.artists = response.artists;
});

SpotifyService.getSearchResults( 'playlist', query, 50 )
.then( function(response){
$scope.playlists = response.playlists;

});
break;
}
}
Expand Down Expand Up @@ -37883,27 +37871,32 @@ angular.module('spotmop.services.spotify', [])
.success(function( response ){

if( type == 'album' ){

var readyToResolve = false;
var completeAlbums = [];
var batchesRequired = Math.ceil( response.albums.items.length / 20 );
var batches = [];

// batch our requests - Spotify only allows a max of 20 albums per request, d'oh!
for( var batchCounter = 1; batchCounter < batchesRequired; batchCounter++ ){

var batch = response.albums.items.splice(0,20);
var albumids = [];
while( response.albums.items.length ){
batches.push( response.albums.items.splice(0,20) );
}

console.log( batches );

// now let's process our batches
for( var i = 0; i < batches.length; i++ ){

// loop all our albums to build a list of all the album ids we need
for( var i = 0; i < 20; i++ ){
albumids.push( batch[i].id );
// loop our batch items to get just IDs
var albumids = [];
for( var j = 0; j < batches[i].length; j++ ){
albumids.push( batches[i][j].id );
};

// go get the albums
service.getAlbums( albumids )
.then( function(albums){
completeAlbums = completeAlbums.concat( albums.albums );
if( batchCounter >= batchesRequired ){
if( i >= batches.length - 1 ){
response.albums.items = completeAlbums;
deferred.resolve( response );
}
Expand Down
12 changes: 6 additions & 6 deletions mopidy_spotmop/static/app.min.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion mopidy_spotmop/static/app/search/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ <h1>
</div>

<div ng-if="type == 'album'">

<div class="album-items square-panels">
<div class="item-container" ng-repeat="album in albums.items track by $index">
<a ui-sref="browse.album({ uri: album.uri })" class="square-panel album"
Expand Down Expand Up @@ -141,7 +142,7 @@ <h4 class="section-title"><a ui-sref="search({ query: query, type: 'artist' })">
</div>
</div>
<div class="clear-both"></div>
</div>
</div>

<div class="search-results-section albums" ng-if="albums.items.length > 0">
<h4 class="section-title"><a ui-sref="search({ query: query, type: 'album' })">Albums</a></h4>
Expand Down
2 changes: 1 addition & 1 deletion src/app/browse/artist/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ angular.module('spotmop.browse.artist', [])
}
$scope.playArtistRadio = function(){

NotifyService.notify('Starting artist radio');
NotifyService.notify('Starting artist radio (beta)');

// get the artist's top tracks
SpotifyService.getRecommendations( 5, 0, $scope.artist.id )
Expand Down

0 comments on commit 0885333

Please sign in to comment.