Commit graph

13 commits

Author SHA1 Message Date
Hyzual
5d385149f3 Refactor song selection across the app
- Added a new SelectedSongs service. Its purpose is to store an array of selected songs and all behaviour associated with it : adding songs to it, removing them, toggling a song, etc. It also changes each song's selected property.
- Removed selectAll, selectNone, playAll, playFrom, addSongsToQueue and selectSong from main-controller.js. Those are now defined either in queue.js, subsonic.js or archive.js, depending on where they are used. I know it does add some duplication between archive.js and subsonic.js, but this will be addressed in a later commit (maybe by creating a shared service).
- Refactored subsonic-service.js' addToPlaylist() and split it between subsonic-service.js and subsonic.js (like all the other playlist-related functions).
- Moved subsonic-service.js' songsRemoveSelected() to subsonic.js since it only removes songs from the scope.
- Removed $rootScope and utils (unused dependencies) from subsonic-service.js
2015-07-12 01:52:42 +02:00
Hyzual
58829facd6 Minor code style adjustments to comply with our jscsrc. 2015-07-07 22:10:22 +02:00
Hyzual
86eaea4b0e When shuffling the playing queue, the currently playing song will always stay at the first position.
So that we don't end up at the end of the queue after we shuffle it.

- The queue controller will also scroll the queue up to the first element so the user notices the playing song stayed first
2015-05-01 13:08:05 +02:00
Hyzual
8b3a12f052 Moves drag & drop support from main-controller.js to queue.js
Adds a indexOfSong method to player-service. It is used in play, nextTrack and previousTrack so the player can adapt to changes to the queue order. Previously it wasn't taken into account and when we changed the order of the queue (through drag & drop or shuffle), the next song wasn't what we expected it to be.
2015-01-17 19:15:10 +01:00
Hyzual
425bac6676 When playing a song, the queue is scrolled to display it 2015-01-17 19:15:08 +01:00
Hyzual
3c809d1903 Adds back displaying the currently playing song as such in the queue
We no longer alter the song, the queue gets this from the player.
That way we can't have two songs marked as 'playing' at the same time.
2015-01-17 19:15:07 +01:00
Hyzual
c787c468b9 Further refactoring of the queue controller and view
- Removes queue-related functions from the main controller. They are now handled by queue.js, which delegates them to player-service.js
- Fixes problem in scrobbling. A song is no longer scrobbled every time it is paused. A song will not be scrobbled upon loading, only while it is playing.
- Moves the entire html for the sidebar queue to queue.html. It replaces a template that was no longer used.
- Most queue-related functions in player return player itself to make them chainable just like in jQuery, e.g. : player.shuffleQueue().playFirstSong();
2015-01-17 19:14:25 +01:00
Hyzual
7074e9abc8 Adds more methods to control the queue in the player service.
- Adds : empty queue, shuffle queue, add one song to queue, remove one song from queue, restart the current song
- Removes the "playEnded" method : we now use correctly scope.$apply() in the directive after calling nextTrack(). The next song is correctly called after the end of the current one.
- Starts replacing the old rootScope functions with calls to the player service.
2015-01-17 19:13:42 +01:00
Hyzual
19661f463b Fixes the communication between the player directive and the player service
- Adds a "playEnded()" function specifically for jplayer to call when the currently playing song ends. It uses $rootScope.$apply() to notify the directive that the song has changed.
- Shows the player controls' css.
- Marks the tests relating the "playing" status of the song as pending.
- Further uses the Player service in the subsonic view
2015-01-17 19:13:41 +01:00
Hyzual
e51961c167 Starts rewriting the player service.
The API is simplified: we can play a song, restart the currently playing song, load a song (that'll be used only by local storage), play the next track or the previous track.

As a result, I changed all the calls to playSong(false, song) which are now just play(song)
2015-01-17 19:13:40 +01:00
Hyzual
226a768987 Renamed all controlles from 'Ctrl' to 'Controller' to better follow angular best practices. 2015-01-17 19:13:40 +01:00
Hyzual
91b112cb0a Fixes the queue test 2015-01-17 19:12:56 +01:00
Hyzual
e5846e30f9 Removes the player functions from the rootScope.
However, saving track's position is broken.
Some are still there because of problems I don't know how to solve, e.g. circular dependency between notifications and player.
Uses the queue controller for the sidebar queue.
Moves loadTrackPosition to the main controller.
2015-01-17 19:12:56 +01:00