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

Commit

Permalink
prep release 1.5.13
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkgroenen committed Jan 16, 2016
1 parent 2dc9c84 commit 23d8f4d
Show file tree
Hide file tree
Showing 20 changed files with 498 additions and 218 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ v1.5.13 (16-01-2016)
- Merge PR (#170)[https://github.com/dirkgroenen/mopidy-mopify/pull/170]
- Add stations to tracklist instead queue (#174)[https://github.com/dirkgroenen/mopidy-mopify/issues/174]
- Automatically restore broken socket connection
-
- Get queue length before inserting (#141)[https://github.com/dirkgroenen/mopidy-mopify/issues/141]

v1.5.12 (27-12-2015)
--------------------
Expand Down
9 changes: 9 additions & 0 deletions dist/assets/css/mopidy-mopify-1.5.13.css

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions dist/assets/mopidy-mopify-1.5.13.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,29 @@
<html ng-app="mopify" ng-controller="AppController">
<head>
<title ng-bind-template="&#9654; {{ pageTitle }}">Mopify</title>

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">

<meta name="version" content="1.5.12">
<meta name="version" content="1.5.13">

<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.5.12.css" />

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

<link rel="manifest" href="assets/manifest.json">
</head>

<body>

<!-- Main application -->
<!-- Main application -->
<div id="application" class="fullheight">
<div class="container-fluid fullheight">
<div class="row fullheight">
Expand All @@ -34,7 +35,7 @@
<ng-include src="'music/menu.tmpl.html'"></ng-include>
<ng-include src="'account/menu.tmpl.html'"></ng-include>
</div>

<ng-include src="'account/services/services.menu.tmpl.html'"></ng-include>
</div>

Expand All @@ -53,8 +54,8 @@
</div>

<!-- Grunt will handle this part -->
<script type="text/javascript" src="assets/mopidy-mopify-1.5.12.js"></script>

<script type="text/javascript" src="assets/mopidy-mopify-1.5.13.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.5.12'
__version__ = '1.5.13'
__ext_name__ = 'mopify'
__verbosemode__ = False

Expand Down
201 changes: 101 additions & 100 deletions mopidy_mopify/static/debug/index.html

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ angular.module('mopify.search', [
resultsloaded++;
if (resultsloaded == 2)
getTopMatchingResult($scope.query, $scope.results);
// Put focus on search
$rootScope.focussearch = true;
});
};
// Run on load
Expand Down
64 changes: 50 additions & 14 deletions mopidy_mopify/static/debug/src/app/services/mopidy.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -260,31 +260,67 @@ angular.module('mopify.services.mopidy', [
});
return deferred.promise;
},
addToPlaylist: function (obj) {
var self = this;
var deferred = $q.defer();
this.mopidy.tracklist.add(obj).then(function (tltracks) {
QueueManager.addToPlaylist(tltracks);
deferred.resolve();
});
return deferred.promise;
},
addToTracklist: function (obj) {
var self = this;
var deferred = $q.defer();
// Add the tracks at the end of the queue
obj.at_position = QueueManager.queue.length + 1;
return wrapMopidyFunc('mopidy.tracklist.add', this)(obj).then(function (tltracks) {
// Sync with queuemanager
QueueManager.add(tltracks);
this.getNextTrackPosition().then(function (nextPosition) {
QueueManager.all().then(function (response) {
obj.at_position = response.queue.length + nextPosition;
self.mopidy.tracklist.add(obj).then(function (tltracks) {
// Sync with queuemanager
QueueManager.add(tltracks);
deferred.resolve();
});
});
});
return deferred.promise;
},
getTracklist: function () {
return wrapMopidyFunc('mopidy.tracklist.getTlTracks', this)();
},
getNextTracklistId: function () {
return wrapMopidyFunc('mopidy.tracklist.getNextTlid');
},
playNext: function (uris) {
var deferred = $q.defer();
var self = this;
if (typeof uris === 'string')
uris = [uris];
this.mopidy.tracklist.add({
uris: uris,
at_position: 1
}).then(function (response) {
// Add to QueueManager
QueueManager.next(response).then(function () {
// Resolve
deferred.resolve(response);
// Broadcast change
$rootScope.$broadcast('mopidy:event:tracklistChanged');
self.getNextTrackPosition().then(function (nextPosition) {
self.mopidy.tracklist.add({
uris: uris,
at_position: nextPosition
}).then(function (response) {
// Add to QueueManager
QueueManager.next(response).then(function () {
// Resolve
deferred.resolve(response);
// Broadcast change
$rootScope.$broadcast('mopidy:event:tracklistChanged');
});
});
});
return deferred.promise;
},
getNextTrackPosition: function () {
var deferred = $q.defer();
var self = this;
self.mopidy.tracklist.getNextTlid().then(function (nextTlId) {
self.mopidy.tracklist.getTlTracks().then(function (currentTlTracks) {
var nextPosition = _.findIndex(currentTlTracks, function (i) {
return i.tlid == nextTlId;
});
deferred.resolve(nextPosition);
});
});
return deferred.promise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ angular.module('mopify.services.queuemanager', ['mopify.services.settings']).fac
'$http',
'$location',
'$rootScope',
'$timeout',
'Settings',
function ($q, $http, $location, $rootScope, Settings) {
function ($q, $http, $location, $rootScope, $timeout, Settings) {
'use strict';
// Create request array and init the connection to false
var requests = [];
Expand All @@ -15,7 +16,7 @@ angular.module('mopify.services.queuemanager', ['mopify.services.settings']).fac
var mopidyport = Settings.get('mopidyport', $location.port());
// Setup websoclet
var protocol = typeof document !== 'undefined' && document.location.protocol === 'https:' ? 'wss://' : 'ws://';
var ws = new WebSocket(protocol + mopidyip + ':' + mopidyport + '/mopify/queuemanager/');
var ws;
/**
* Send a request to the server's queuemanager class
*
Expand Down Expand Up @@ -66,7 +67,9 @@ angular.module('mopify.services.queuemanager', ['mopify.services.settings']).fac
this.version = 0;
this.shuffle = false;
this.playlist = [];
this.queue = this.setupWebsocket();
this.queue = [];
// Setup websocket
this.setupWebsocket();
// Load all data on init
that.loadData();
// Register listener which loads the new data on a trackplayback started
Expand All @@ -82,21 +85,46 @@ angular.module('mopify.services.queuemanager', ['mopify.services.settings']).fac
that.loadData();
});
}
/**
* Check the connection ready state
*
* @return {void}
*/
QueueManager.prototype.checkConnectionReady = function () {
var self = this;
$timeout(function () {
if (ws.readyState === 1) {
wsconnection = true;
handleWaitlist();
} else {
self.checkConnectionReady();
}
}, 200);
};
/**
* Setup all the data needed for the websocket communication
*
* @return {void}
*/
QueueManager.prototype.setupWebsocket = function () {
var that = this;
ws = new WebSocket(protocol + mopidyip + ':' + mopidyport + '/mopify/queuemanager/');
// Wait for the websocket to be opened and set active connection
ws.onopen = function () {
wsconnection = true;
handleWaitlist();
that.checkConnectionReady();
};
// Set connection to false on close
ws.onclose = function () {
wsconnection = false;
$timeout(function () {
that.setupWebsocket();
}, 2000);
};
ws.onerror = function (evt) {
wsconnection = false;
$timeout(function () {
that.setupWebsocket();
}, 2000);
};
// Handle incoming messages
ws.onmessage = function (evt) {
Expand Down Expand Up @@ -199,6 +227,25 @@ angular.module('mopify.services.queuemanager', ['mopify.services.settings']).fac
});
return deferred.promise;
};
/**
* Add the given tracks to the playlist
*
* @param {Array} tracks
* @return {Promise}
*/
QueueManager.prototype.addToPlaylist = function (tracks) {
var that = this;
var deferred = $q.defer();
// Remove unplayable tracks
tracks = _.filter(tracks, function (tltrack) {
return tltrack.track.name.indexOf('[unplayable]') < 0;
});
request('add_to_playlist', { tracks: tracks }).then(function (response) {
that.version = response.version;
deferred.resolve(response);
});
return deferred.promise;
};
/**
* Remove the given tlids from the queue and playlist
*
Expand Down
10 changes: 5 additions & 5 deletions mopidy_mopify/static/debug/src/app/services/station.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ angular.module('mopify.services.station', [
var echonestTracksQueue = [];
/**
* Process a number of tracks from the echonestTracksQue
* @return {$q.defer} a promise
* @return {$q.defer} a promise
*/
function processMopidyTracklist() {
var deferred = $q.defer();
// The reponse from echonest only contains the artist name and track title. We need to look up the tracks in mopidy and add them
// This is done in batches to prevent mopidy from overloading
if (echonestTracksQueue.length > 0) {
generateMopidyTracks().then(function (uris) {
mopidyservice.addToTracklist({ uris: uris }).then(function (response) {
mopidyservice.addToPlaylist({ uris: uris }).then(function (response) {
$timeout(processMopidyTracklist, 1000);
deferred.resolve(response);
});
Expand All @@ -48,7 +48,7 @@ angular.module('mopify.services.station', [
}
/**
* Generate Mopidy tracks from the echonestTracksQueue in batches
* @return {$q.defer} a promise
* @return {$q.defer} a promise
*/
function generateMopidyTracks() {
// Get tracks from array
Expand All @@ -64,7 +64,7 @@ angular.module('mopify.services.station', [
/**
* Prepare the parameters that have to be send to Echonest
* @param {station} station - object from the stations controller containing the information for the new radio
* @return {$q.defer}
* @return {$q.defer}
*/
function prepareParameters(station) {
var parameters = {
Expand Down Expand Up @@ -112,7 +112,7 @@ angular.module('mopify.services.station', [
}
/**
* Get 5 track ids from the given tracks (random)
* @param {array} tracks
* @param {array} tracks
* @return {array} the spotify track ids
*/
function createTrackIdsList(tracks) {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
angular.module('cgPrompt',['ui.bootstrap']);

angular.module('cgPrompt').factory('prompt',['$modal','$q','$sce',function($modal,$q, $sce){
angular.module('cgPrompt').factory('prompt',['$modal','$q',function($modal,$q){

var prompt = function(options){

Expand All @@ -17,8 +17,6 @@ angular.module('cgPrompt').factory('prompt',['$modal','$q','$sce',function($moda
]
};

options.message = $sce.trustAsHtml(options.message);

if (options === undefined){
options = {};
}
Expand Down Expand Up @@ -113,7 +111,9 @@ angular.module('cgPrompt').run(['$templateCache', function($templateCache) {
" </div>\n" +
" <div class=\"modal-body\">\n" +
"\n" +
" <div ng-if=\"options.message\" ng-bind-html=\"options.message\"></div>" +
" <p ng-if=\"options.message\">\n" +
" {{options.message}}\n" +
" </p>\n" +
"\n" +
" <form id=\"cgPromptForm\" name=\"cgPromptForm\" ng-if=\"options.input\" ng-submit=\"submit()\">\n" +
" <div class=\"form-group\" ng-class=\"{'has-error':cgPromptForm.$invalid && changed}\">\n" +
Expand All @@ -122,8 +122,8 @@ angular.module('cgPrompt').run(['$templateCache', function($templateCache) {
" <div class=\"input-group\" ng-if=\"options.values\">\n" +
" <input id=\"cgPromptInput\" type=\"text\" class=\"form-control\" placeholder=\"{{options.label}}\" ng-model=\"input.name\" required ng-change=\"changed=true\" autofocus=\"autofocus\"/>\n" +
"\n" +
" <div class=\"input-group-btn\">\n" +
" <button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\"><span class=\"caret\"></span></button>\n" +
" <div class=\"input-group-btn\" dropdown>\n" +
" <button type=\"button\" class=\"btn btn-default dropdown-toggle\" dropdown-toggle data-toggle=\"dropdown\"><span class=\"caret\"></span></button>\n" +
" <ul class=\"dropdown-menu pull-right\">\n" +
" <li ng-repeat=\"value in options.values\"><a href=\"\" ng-click=\"input.name = value\">{{value}}</a></li>\n" +
" </ul>\n" +
Expand All @@ -134,7 +134,7 @@ angular.module('cgPrompt').run(['$templateCache', function($templateCache) {
"\n" +
" </div>\n" +
" <div class=\"modal-footer\">\n" +
" <button ng-repeat=\"button in options.buttons track by button.label\" class=\"btn btn-default {{button.style}}\" ng-class=\"{'btn-primary':button.primary}\" ng-click=\"buttonClicked(button)\">{{button.label}}</button>\n" +
" <button ng-repeat=\"button in options.buttons track by button.label\" class=\"btn btn-default {{button.class}}\" ng-class=\"{'btn-primary':button.primary}\" ng-click=\"buttonClicked(button)\">{{button.label}}</button>\n" +
" </div>\n" +
"</div>"
);
Expand Down
Loading

0 comments on commit 23d8f4d

Please sign in to comment.