Jamstash/app/queue/queue.js
Hyzual 834e67946c Adds back scrobbling and loading a track and the queue from localStorage.
- Splits loadTrackPosition into two functions : one for the track (which isn't finished), one for the queue.
- Adds main-controller.js' first unit tests for both these functions.
- Adds scrobbling functionnality. It is now a part of the Subsonic service, since we it's Subsonic that ultimately does the scroblling.
- Adds unit tests for both the service and the directive. The test for updatetime was crazy hard to do because I had to find a way to trigger my own fake event and it wasn't permitted by jplayer.
- Adds the load function to the player, it is used only when loading a song from localStorage.
- Removes ng-click from play/pause in the player template. jPlayer adds its own handlers on them, no need to do it twice.
2015-01-17 19:13:42 +01:00

29 lines
721 B
JavaScript

angular.module('jamstash.queue.controller', ['jamstash.player.service'])
.controller('QueueController', ['$scope', 'globals', 'player',
function ($scope, globals, player) {
'use strict';
$scope.settings = globals.settings;
$scope.player = player;
$scope.itemType = 'pl'; // TODO: Hyz: What is this ?
$scope.playSong = function (song) {
player.play(song);
};
$scope.queueEmpty = function() {
player.emptyQueue();
};
$scope.queueShuffle = function() {
player.shuffleQueue();
};
$scope.addSongToQueue = function(song) {
player.addSong(song);
};
$scope.removeSongFromQueue = function(song) {
player.removeSong(song);
};
}]);