Refactor Jukebox control

- Moves the functions to make the jukebox-related API calls to the
  subsonic service
- Initiate the API calls from the player directive to centralize the
  logic.
This commit is contained in:
Carey Metcalfe 2017-11-10 11:57:38 -05:00
parent 8c279093df
commit ee7d11d8d7
5 changed files with 55 additions and 53 deletions

View file

@ -258,35 +258,6 @@ angular.module('JamStash')
});
};
$rootScope.addToJukebox = function (id) {
if (globals.settings.Debug) { console.log("LOAD JUKEBOX"); }
$.ajax({
url: globals.BaseURL() + '/jukeboxControl.view?' + globals.BaseParams() + '&action=set&id=' + id,
method: 'GET',
dataType: globals.settings.Protocol,
timeout: globals.settings.Timeout,
success: function (data) {
/*
if (data["subsonic-response"].podcasts.channel !== undefined) {
}
deferred.resolve(podcasts);
*/
$.get(globals.BaseURL() + '/jukeboxControl.view?' + globals.BaseParams() + '&action=start');
}
});
};
$rootScope.sendToJukebox = function (action) {
if (globals.settings.Debug) { console.log("SEND JUKEBOX " + action); }
$.ajax({
url: globals.BaseURL() + '/jukeboxControl.view?' + globals.BaseParams() + '&action=' + action,
method: 'GET',
dataType: globals.settings.Protocol,
timeout: globals.settings.Timeout,
success: function (data) {
}
});
};
$scope.toggleStar = function (item) {
subsonic.toggleStar(item).then(function (newStarred) {
item.starred = newStarred;