Skip to content
This repository has been archived by the owner on Jan 19, 2023. It is now read-only.

Commit

Permalink
Merge branch 'development', release 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkgroenen committed Jul 29, 2017
2 parents b102f96 + ec7dd69 commit 9fe21ef
Show file tree
Hide file tree
Showing 121 changed files with 1,527 additions and 17,919 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#Changelog

v1.6.1 (29-06-2017)

Thanks to https://github.com/tobiasstrebitzer for the changes below:
- **Update angular** from 1.2.7 to 1.5.6.
- **Update angular-spotify** from 1.4.2 to 1.5.1 to resolve various bugs related to recent changes in the Spotify-API.
- **Updated Spotify API response resolutions** in various locations, necessary to work with the upgraded angular-spotify version.
- **Resolves null/undefined** type handling / conditionals in various locations, which have caused unwanted side-effects and bugs.
- **Refactored the Discover/Browse section** to consistently deliver browse results and omit inefficient and redundant queries to the Spotify API.
- **Refactored Artist detail page** to load basic metadata (artist image, cover image) via the Spotify API.
- **Refactored Artist list page and controller**, by changing the API collection from "User Artists" to "Followed Artists" (it seems the "User Artists" API is no longer provided by Spotify).

v1.6.0 (26-07-2016)

- Remove deprecated TasteProfile and replace for Spotify API [#200](https://github.com/dirkgroenen/mopidy-mopify/issues/200)
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"ryanmullins-angular-hammer": "~2.1.10",
"angular-hotkeys": "chieffancypants/angular-hotkeys#~1.4.5",
"clipboard": "~1.5.3",
"angular-spotify": "~1.4.2"
"angular-spotify": "~1.5.1"
},
"resolutions": {
"angular": ">= 1.2.7"
"angular": ">= 1.5.6"
}
}
Binary file removed dist/Mopidy-Mopify-1.6.0.tar.gz
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 0 additions & 39 deletions dist/assets/mopidy-mopify-1.6.0.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/assets/mopidy-mopify-1.6.0.js.map

This file was deleted.

39 changes: 39 additions & 0 deletions dist/assets/mopidy-mopify-1.6.1.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/assets/mopidy-mopify-1.6.1.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">

<meta name="version" content="1.6.0">
<meta name="version" content="1.6.1">

<link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,300,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="assets/webfonts/ss-standard.css">

<link href="assets/images/favicon.ico" rel="icon" type="image/x-icon" />


<link rel="stylesheet" type="text/css" href="assets/css/mopidy-mopify-1.6.0.css" />
<link rel="stylesheet" type="text/css" href="assets/css/mopidy-mopify-1.6.1.css" />

<link rel="manifest" href="assets/manifest.json">
<link rel="apple-touch-icon" href="assets/images/musicicon-4x.png">
Expand Down Expand Up @@ -56,7 +56,7 @@

<!-- Grunt will handle this part -->

<script type="text/javascript" src="assets/mopidy-mopify-1.6.0.js"></script>
<script type="text/javascript" src="assets/mopidy-mopify-1.6.1.js"></script>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
Expand Down
2 changes: 1 addition & 1 deletion mopidy_mopify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

from mopidy import config, ext

__version__ = '1.6.0'
__version__ = '1.6.1'
__ext_name__ = 'mopify'
__verbosemode__ = False

Expand Down
2 changes: 1 addition & 1 deletion mopidy_mopify/static/debug/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">

<meta name="version" content="1.6.0">
<meta name="version" content="1.6.1">

<link href='https://fonts.googleapis.com/css?family=Roboto+Condensed:400,300,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="assets/webfonts/ss-standard.css">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ angular.module('mopify.account.services.spotify', [
// Bind settings to the scope
Settings.bind($scope);
// Get current user
Spotify.getCurrentUser().then(function (data) {
$scope.profile = data;
Spotify.getCurrentUser().then(function (response) {
$scope.profile = response.data;
});
/**
* Disconnect and connect with Spotify
Expand Down Expand Up @@ -62,9 +62,9 @@ angular.module('mopify.account.services.spotify', [
// Get the user porfile from Spotify
function collectdata() {
// Make the call
Spotify.getCurrentUser().then(function (data) {
Spotify.getCurrentUser().then(function (response) {
$scope.authorized = true;
$scope.userProfile = data;
$scope.userProfile = response.data;
});
}
$scope.$on('mopify:services:disconnected', function (e, service) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ angular.module('mopify.account.services.sync', [
$scope.client = Sync.client;
$scope.spotifyclient = null;
// Get client from remote
if ($scope.settings.sync !== undefined && $scope.settings.sync.spotify === true) {
if ($scope.settings.sync != null && $scope.settings.sync.spotify === true) {
Sync.getSpotify().then(function (data) {
if (data !== undefined)
if (data != null)
$scope.spotifyclient = data.client;
});
}
Expand Down
4 changes: 2 additions & 2 deletions mopidy_mopify/static/debug/src/app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ angular.module('mopify', [
$rootScope.mopifyversion = VersionManager.version;
// Watch for track changes so we can update the title
$scope.$on('mopidy:event:trackPlaybackStarted', function (event, data) {
if (data.tl_track !== undefined)
if (data.tl_track != null)
updateTitle(data.tl_track.track);
});
// Page title and connection state to $scope
Expand Down Expand Up @@ -115,7 +115,7 @@ angular.module('mopify', [
function updateTitle(track) {
if (!Settings.get('pagetitle', true))
return false;
if (track !== null && track !== undefined) {
if (track != null) {
if (track.name.indexOf('[loading]') > -1) {
mopidyservice.lookup(track.uri).then(function (result) {
$scope.pageTitle = result[0].name + ' - ' + result[0].artists[0].name + ' | ' + defaultPageTitle;
Expand Down
11 changes: 6 additions & 5 deletions mopidy_mopify/static/debug/src/app/directives/album.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ angular.module('mopify.widgets.directive.album', [
scope.albumAlreadySaved = false;
scope.visible = true;
// Check if album has 'Various Artists'
if (scope.album.artists !== undefined) {
if (scope.album.artists != null) {
if (scope.album.artists.length < 4) {
scope.artiststring = util.artistsToString(scope.album.artists);
} else {
Expand Down Expand Up @@ -76,7 +76,7 @@ angular.module('mopify.widgets.directive.album', [
// Get playlist id from uri
var playlistid = selectedplaylist.split(':')[4];
// add track
PlaylistManager.addAlbum(playlistid, scope.album.uri).then(function (response) {
PlaylistManager.addAlbum(playlistid, scope.album.uri).then(function () {
notifier.notify({
type: 'custom',
template: 'Album succesfully added to playlist.',
Expand Down Expand Up @@ -143,12 +143,13 @@ angular.module('mopify.widgets.directive.album', [
if (ServiceManager.isEnabled('spotify') && SpotifyLogin.connected) {
// First get the album's tracks
Spotify.getAlbumTracks(scope.album.uri, { limit: 50 }).then(function (response) {
albumtracks = _.map(response.items, function (track) {
var data = response.data;
albumtracks = _.map(data.items, function (track) {
return track.id;
});
// Check if the user is already following the tracks
Spotify.userTracksContains(albumtracks).then(function (following) {
scope.albumAlreadySaved = following[0];
Spotify.userTracksContains(albumtracks).then(function (response) {
scope.albumAlreadySaved = response.data[0];
});
});
scope.showSaveAlbum = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ angular.module('mopify.widgets.directive.artist', [
* Check if the artist scope contains images, otherwise; ask the artist object from Spotify
*/
if (scope.artist.images === undefined) {
Spotify.getArtist(scope.artist.uri).then(function (data) {
angular.extend(scope.artist, data);
Spotify.getArtist(scope.artist.uri).then(function (response) {
angular.extend(scope.artist, response.data);
});
}
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ angular.module('mopify.widgets.directive.browse', [
if (scope.item.type == 'spotify') {
scope.titleslogan = Math.floor(Math.random() * 2) == 1 ? 'Here\'s something you might like:' : 'Recommended for you:';
scope.spotifyuri = scope.item.spotify.uri;
Spotify.getTrack(scope.spotifyuri).then(function (response) {
scope.image = response.album.images[0].url;
scope.spotifyuri = response.album.uri;
});
scope.image = scope.item.spotify.album.images[0].url;
scope.spotifyuri = scope.item.spotify.album.uri;
scope.suggestion = {
name: scope.item.spotify.name,
artist: util.artistsToString(scope.item.spotify.artists)
Expand All @@ -33,8 +31,11 @@ angular.module('mopify.widgets.directive.browse', [
scope.titleslogan = 'You listened to ' + scope.item.artist.name + '. You might like this artist to:';
scope.spotifyuri = scope.item.artist.uri;
Spotify.getRelatedArtists(scope.spotifyuri).then(function (response) {
var artist = response.artists[Math.floor(Math.random() * response.artists.length)];
scope.image = artist.images[1].url;
var data = response.data;
var artist = data.artists[Math.floor(Math.random() * data.artists.length)];
if (artist.images[1]) {
scope.image = artist.images[1].url;
}
scope.spotifyuri = artist.uri;
scope.suggestion = { name: artist.name };
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,19 @@ angular.module('mopify.widgets.directive.playlist', ['mopify.widgets.directive.s
link: function (scope, element, attrs) {
scope.coverImage = defaultAlbumImageUrl;
// Get image for the playlist
if (scope.playlist.images !== undefined && scope.playlist.images.length > 0) {
if (scope.playlist.images != null && scope.playlist.images.length > 0) {
scope.coverImage = scope.playlist.images[0].url;
} else if (scope.playlist.__model__ == 'Playlist') {
Spotify.getTrack(scope.playlist.tracks[0].uri).then(function (data) {
scope.coverImage = data.album.images[1].url;
Spotify.getTrack(scope.playlist.tracks[0].uri).then(function (response) {
scope.coverImage = response.data.album.images[1].url;
});
} else if (scope.playlist.__model__ === undefined) {
Spotify.getPlaylist(scope.playlist.owner.id, scope.playlist.id).then(function (data) {
if (data.images[0] !== undefined)
Spotify.getPlaylist(scope.playlist.owner.id, scope.playlist.id).then(function (response) {
var data = response.data;
if (data.images[0] != null)
scope.coverImage = data.images[0].url;
if (data.tracks.items.length > 0) {
if (data.tracks.items[0].track.album.images[0] !== undefined)
if (data.tracks.items[0].track.album.images[0] != null)
scope.coverImage = data.tracks.items[0].track.album.images[0].url;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ angular.module('mopify.widgets.directive.station', [
*/
scope.delete = function () {
var stations = localStorageService.get('stations');
if (stations !== null) {
if (stations != null) {
// Remove from storage
stations.splice(stations.length - 1 - scope.index, 1);
localStorageService.set('stations', stations);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ angular.module('mopify.widgets.directive.track', [
scope.$watch(function () {
return scope.track.id;
}, function (current, previous) {
if (current === undefined && previous !== undefined)
if (current === undefined && previous != null)
scope.track.id = previous;
});
scope.artistsString = function () {
Expand Down Expand Up @@ -109,7 +109,7 @@ angular.module('mopify.widgets.directive.track', [
return $rootScope.selectedtracks;
}, function () {
var found = _.findWhere($rootScope.selectedtracks, { id: scope.track.id });
if (found !== undefined)
if (found != null)
scope.selected = true;
else
scope.selected = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,12 @@ angular.module('mopify.discover.browse', [
'notifier',
function DiscoverBrowseController($scope, Discover, stationservice, ServiceManager, notifier) {
$scope.blocks = [];
var builtblocks = [];
var sliceloops = 0;
$scope.startStation = function () {
stationservice.startFromSpotify();
};
if (ServiceManager.isEnabled('spotify')) {
Discover.getBrowseBlocks().then(function (blocks) {
builtblocks = blocks;
$scope.buildblocks();
$scope.blocks = blocks;
});
} else {
notifier.notify({
Expand All @@ -40,9 +37,5 @@ angular.module('mopify.discover.browse', [
delay: 7500
});
}
$scope.buildblocks = function () {
$scope.blocks = $scope.blocks.concat(builtblocks.slice(sliceloops * 12, sliceloops * 12 + 12));
sliceloops++;
};
}
]);
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ angular.module('mopify.discover.featured', [
country: country,
limit: 12,
timestamp: timestamp
}).then(function (data) {
}).then(function (response) {
var data = response.data;
// Set the message and items
$scope.titletext = data.message;
$scope.featuredplaylists = data.playlists.items;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ angular.module('mopify.discover.newreleases', [
Spotify.getNewReleases({
country: country,
limit: 18
}).then(function (data) {
}).then(function (response) {
var data = response.data;
// Set the message and items
$scope.newreleases = data.albums.items;
$scope.headeralbum = data.albums.items[Math.floor(Math.random() * (data.albums.items.length - 1))];
Expand All @@ -66,7 +67,8 @@ angular.module('mopify.discover.newreleases', [
}
function loadHeaderAlbumTracks() {
// Get the tracks for the headerplaylist
mopidyservice.lookup($scope.headeralbum.uri).then(function (tracks) {
mopidyservice.lookup($scope.headeralbum.uri).then(function (collection) {
var tracks = collection[$scope.headeralbum.uri];
var frontendtracks = angular.copy(tracks.splice(0, 7));
var tracksloaded = true;
// Create an artist string for every song
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ angular.module('mopify.music.artist', [
if (ServiceManager.isEnabled('spotify') && SpotifyLogin.connected) {
// First get the album's tracks
Spotify.userFollowingContains('artist', $scope.artistId.replace('spotify:artist:', '')).then(function (response) {
$scope.followingArtist = response[0];
$scope.followingArtist = response.data[0];
});
}
// Load artist data
$scope.artist = {};
Spotify.getArtist($scope.artistId).then(function (response) {
$scope.artist = response.data;
});
// Get data from echonest
/*Echonest.artists.get({
id: $routeParams.artistId
Expand All @@ -89,23 +92,23 @@ angular.module('mopify.music.artist', [
});
});*/
// Get related artists from spotify
Spotify.getRelatedArtists($scope.artistId).then(function (data) {
$scope.related = data.artists.splice(0, 18);
Spotify.getRelatedArtists($scope.artistId).then(function (response) {
$scope.related = response.data.artists.splice(0, 18);
});
// Init an empty toptracks object
$scope.toptracks = [];
// Get the artist's top tracks
Spotify.getArtistTopTracks($scope.artistId, 'NL').then(function (data) {
$scope.toptracks = data.tracks;
Spotify.getArtistTopTracks($scope.artistId, 'NL').then(function (response) {
$scope.toptracks = response.data.tracks;
});
// Get info from mopidy
var options = {
album_type: 'album,single',
country: 'NL',
limit: 50
};
Spotify.getArtistAlbums($scope.artistId, options).then(function (data) {
$scope.albums = data.items;
Spotify.getArtistAlbums($scope.artistId, options).then(function (response) {
$scope.albums = response.data.items;
});
/**
* Start a station for the artist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ angular.module('mopify.music.library.albums', [
limit: 50,
offset: offset
}).then(function (response) {
var data = response.data;
// Map all track from the response's items array
var albums = _.map(response.items, function (item) {
var albums = _.map(data.items, function (item) {
return item.album;
});
// Check if the scope's last album doesn't equal the first album we wan't to add
Expand All @@ -68,7 +69,7 @@ angular.module('mopify.music.library.albums', [
}
// Concat with previous tracks
$scope.albums = $scope.albums.concat(albums);
if (response.next !== null)
if (data.next != null)
loadSpotifyLibraryAlbums(offset + 50);
});
}
Expand Down
Loading

0 comments on commit 9fe21ef

Please sign in to comment.