Skip to content

Commit

Permalink
Merge pull request #32 from jaedb/release/2.4.4
Browse files Browse the repository at this point in the history
Release/2.4.4
  • Loading branch information
jaedb committed Dec 3, 2015
2 parents b19326c + 8f1bf7c commit 824c883
Show file tree
Hide file tree
Showing 27 changed files with 605 additions and 357 deletions.
2 changes: 0 additions & 2 deletions .htaccess
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
RewriteEngine On

RewriteRule ^spotify-authorization?$ /app/services/spotify/authenticate.php$1 [L,QSA]

# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
Expand Down
31 changes: 12 additions & 19 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ angular.module('spotmop', [
'ngResource',
'ngStorage',
'ngTouch',
'ngAnimate',
'ui.router',

'angular-loading-bar',
Expand Down Expand Up @@ -43,9 +42,10 @@ angular.module('spotmop', [
'spotmop.browse.new'
])

.config(function($stateProvider, $locationProvider, $urlRouterProvider){
.config(function($stateProvider, $locationProvider, $urlRouterProvider, $httpProvider){
$locationProvider.html5Mode(true);
$urlRouterProvider.otherwise("/queue");
$httpProvider.interceptors.push('SpotifyServiceIntercepter');
})


Expand Down Expand Up @@ -172,6 +172,11 @@ angular.module('spotmop', [
BackgroundCheck.refresh();
});

$(document).on('click', '#body', function(event){
if( $(event.target).closest('.menu-reveal-trigger').length <= 0 )
$scope.hideMenu();
});

// show menu (this is triggered by swipe event)
$scope.showMenu = function(){
$(document).find('body').addClass('menu-revealed');
Expand Down Expand Up @@ -258,23 +263,11 @@ angular.module('spotmop', [
},0
);


// watch for re-authorizations of spotify
$scope.$watch(
function(){
return $localStorage.spotify;
},
function(newVal,oldVal){
getSpotifyAccount();
}
);

// figure out who we are on Spotify
// TODO: Hold back on this to make sure we're authorized

getSpotifyAccount();
/**
* Spotify account is authorized
**/
$scope.$on('mopidy:state:online', function(){

function getSpotifyAccount(){
SpotifyService.getMe()
.then( function(response){
$scope.spotifyUser = response;
Expand All @@ -291,7 +284,7 @@ angular.module('spotmop', [
$scope.updatePlaylists();
}
});
}
});


/**
Expand Down
2 changes: 2 additions & 0 deletions app/browse/album/template.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<div class="browse album-page">

<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>

<div class="asset-sidebar">

Expand Down
2 changes: 2 additions & 0 deletions app/browse/artist/template.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div ng-controller="ArtistController" class="page artist-page scrolling-panel">
<div class="inner">

<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>

<div class="intro artist-intro">

Expand Down
2 changes: 2 additions & 0 deletions app/browse/featured/template.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div class="page featured-playlists-page scrolling-panel">
<div class="inner">

<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>

<div class="featured-playlists-intro">
<div class="inner">
Expand Down
7 changes: 5 additions & 2 deletions app/browse/genre/category.template.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<div class="page category-genre-page scrolling-panel">
<div class="inner">

<h1 ng-bind="category.name"></h1>

<div class="page-header">
<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>
<h1 ng-bind="category.name"></h1>
</div>

<div class="playlist-items square-panels">

Expand Down
5 changes: 5 additions & 0 deletions app/browse/genre/template.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<div class="page category-page scrolling-panel">
<div class="inner">

<div class="page-header">
<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>
<h1>Genre / Category</h1>
</div>

<div class="category-items square-panels">

<div class="item-container" ng-repeat="category in categories.items track by $index">
Expand Down
5 changes: 4 additions & 1 deletion app/browse/new/template.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<div class="page new-releases-page scrolling-panel">
<div class="inner">

<h1>New releases</h1>
<div class="page-header">
<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>
<h1>New releases</h1>
</div>

<div class="album-items square-panels">

Expand Down
2 changes: 2 additions & 0 deletions app/browse/playlist/template.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<div class="browse playlist-page">

<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>

<div class="asset-sidebar">

<div class="thumbnail playlist" ng-if="playlist.images.length > 0" ng-repeat="image in playlist.images | limitTo:1" style="background-image: url({{ image.url }});"></div>
Expand Down
5 changes: 5 additions & 0 deletions app/browse/user/template.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<div class="page user-page scrolling-panel">
<div class="inner">

<div class="page-header">
<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>
<h1>User</h1>
</div>

<div class="user-intro">
<div class="image-container" ng-repeat="image in user.images | limitTo:1">
Expand Down
18 changes: 12 additions & 6 deletions app/common/directives.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,12 +327,18 @@ angular.module('spotmop.directives', [])
context.canvas.height = canvasHeight;
}

// zoom image to fill canvas
// TODO: test tall skinny images and different device sizes
if( image.width < canvasWidth ){
var upscale = canvasWidth / image.width;
image.width = image.width * upscale;
image.height = image.height * upscale;
// zoom image to fill canvas, widthwise
if( image.width < canvasWidth || image.width > canvasWidth ){
var scale = canvasWidth / image.width;
image.width = image.width * scale;
image.height = image.height * scale;
}

// now check for fill heightwise, and zoom in if necessary
if( image.height < canvasHeight ){
var scale = canvasHeight / image.height;
image.width = image.width * scale;
image.height = image.height * scale;
}

// figure out where we want the image to be, based on scroll position
Expand Down
7 changes: 5 additions & 2 deletions app/discover/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@

<div class="discover">

<h1>Discover new music</h1>

<div class="page-header">
<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>
<h1>Discover</h1>
</div>

<div class="discover-section current-artist" ng-if="recommendations.suggestions.length > 0">

<h4 class="section-title">Recommended for you</h4>
Expand Down
5 changes: 4 additions & 1 deletion app/library/artists.template.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<div class="page library-artists scrolling-panel">
<div class="inner">

<h1>Artists</h1>
<div class="page-header">
<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>
<h1>Artists</h1>
</div>

<div class="album-items square-panels">
<div class="item-container" ng-repeat="artist in artists.items track by $index">
Expand Down
53 changes: 53 additions & 0 deletions app/library/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,59 @@ angular.module('spotmop.library', [])
$scope.createPlaylist = function(){
DialogService.create('createPlaylist', $scope);
}

$scope.playlists = [];

// if we've got a userid already in storage, use that
var userid = SettingsService.getSetting('spotifyuserid',$scope.$parent.spotifyUser.id);

SpotifyService.getPlaylists( userid )
.then( function( response ){ // successful
$scope.playlists = response;

// if it was 401, refresh token
if( typeof(response.error) !== 'undefined' && response.error.status == 401 )
Spotify.refreshToken();
});


/**
* Load more of the album's tracks
* Triggered by scrolling to the bottom
**/

var loadingMorePlaylists = false;

// go off and get more of this playlist's tracks
function loadMorePlaylists( $nextUrl ){

if( typeof( $nextUrl ) === 'undefined' )
return false;

// update our switch to prevent spamming for every scroll event
loadingMorePlaylists = true;

// go get our 'next' URL
SpotifyService.getUrl( $nextUrl )
.then(function( response ){

// append these new tracks to the main tracklist
$scope.playlists.items = $scope.playlists.items.concat( response.items );

// save the next set's url (if it exists)
$scope.playlists.next = response.next;

// update loader and re-open for further pagination objects
loadingMorePlaylists = false;
});
}

// once we're told we're ready to load more albums
$scope.$on('spotmop:loadMore', function(){
if( !loadingMorePlaylists && typeof( $scope.playlists.next ) !== 'undefined' && $scope.playlists.next ){
loadMorePlaylists( $scope.playlists.next );
}
});
});


Expand Down
11 changes: 7 additions & 4 deletions app/library/playlists.template.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<div class="page my-playlists-page scrolling-panel">
<div class="inner">

<h1>Playlists</h1>
<div class="page-header">
<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>
<h1>Playlists</h1>
</div>

<div class="playlist-items square-panels">

<div ng-if="myPlaylists.length">
<div class="item-container" ng-repeat="playlist in myPlaylists track by $index">
<div ng-if="playlists.items.length">
<div class="item-container" ng-repeat="playlist in playlists.items track by $index">
<a ui-sref="library.playlist({ uri: {{ 'playlist.uri' }} })" class="square-panel playlist">
<div class="image-container">
<thumbnail images="playlist.images"></thumbnail>
Expand All @@ -19,7 +22,7 @@ <h1>Playlists</h1>
</div>
</div>

<div ng-hide="myPlaylists.length" class="no-items">
<div ng-hide="playlists.items.length" class="no-items">
No items
</div>

Expand Down
5 changes: 4 additions & 1 deletion app/library/tracks.template.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<div class="page library-tracks-page scrolling-panel">
<div class="inner">

<h1>Tracks</h1>
<div class="page-header">
<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>
<h1>Tracks</h1>
</div>

<div class="library-tracks tracklist droppable" ng-controller="TracklistController">
<track ng-repeat="track in tracklist.tracks track by $index"></track>
Expand Down
19 changes: 18 additions & 1 deletion app/queue/template.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<div class="page now-playing-page scrolling-panel">
<div class="inner">


<div class="page-header">
<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>
<h1>Now Playing</h1>
</div>

<div id="full-player" class="player" ng-controller="PlayerController">

<a class="artwork image-container" href="/browse/album/{{ state().currentTlTrack.track.album.uri }}">
Expand Down Expand Up @@ -40,6 +45,18 @@
<span class="button repeat" ng-click="toggleRepeat()" ng-class="{active: state().isRepeat}">
<i class="fa fa-repeat"></i>
</span>

<span class="volume">
<span class="button mute" ng-click="toggleMute()" ng-class="{active: state().isMute}">
<i class="fa fa-volume-off fa-fw" ng-show="state().isMute"></i>
<i class="fa fa-volume-down fa-fw" ng-show="!state().isMute"></i>
</span>
<div class="slider" ng-click="setVolume($event)">
<div class="track">
<div class="fill" style="width: {{ state().volume }}%"></div>
</div>
</div>
</span>
</div>

<div class="clear-both"></div>
Expand Down
5 changes: 5 additions & 0 deletions app/search/template.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<div class="page search-page scrolling-panel">
<div class="inner">

<div class="page-header">
<span class="menu-reveal-trigger" ng-click="showMenu()"><i class="fa fa-bars"></i></span>
<h1>Search Results</h1>
</div>

<div class="sub-page-navigation">
<a class="menu-item"
Expand Down
Loading

0 comments on commit 824c883

Please sign in to comment.