It's mostly a tech version, on the user-side a few bugs should be fixed but there are no new features
- Fixes the bug with ping() in the settings
- Adds a generic subsonicRequest() that handles protocols and errors. It makes getRandomSongs, getStarredSongs, scrobble, etc. very light : they only deal with getting songs (or scrobbling).
- Adds a separate controller for the queue
- Adds a separate controller for the player controls
- Adds a separate directive that controls jplayer
- New rewritten player service
- Adds a persistence service, used to store the playing queue and current song in localStorage
- Mostly rewritten notifications service, displays the current playing song, takes a song as parameter
- Adds a Page service, controls the tab title in order to display (or scroll) a song's title
- Removed many things from main-controller, utils, settings, etc. They are all moved somewhere else where it makes more sense
- Updated bower dependencies: jplayer, jquery and jquery-ui
Adds a ping() function to the subsonic service, taking advantage of our new subsonicRequest wrapper. It works with both JSON and JSONP, catches errors, etc.
Errors from an incorrect parameter (missing password) or unreachable server should now be displayed to the user.
- It no longer exposes the entire player service to the scope. It provides 5 functions : play; pause, previous, next and getPlayingSong
play and pause are only meant for the jukebox mode, normally it is jPlayer that manages the buttons directly.
- Playing a song in jukebox mode mutes jPlayer
- Adds tests for those modifications
The play/pause button is managed manually and can send commands to the jukebox.
But it also sends play/pause commandes to jPlayer, which causes js errors.
Additionally, we have no idea of the current position of the song.
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.
- Fixes the various remaining calls to $rootScope.queue. They now use the player service.
- main-controller.js watches the player's queue and shows the queue on change (if the global setting is true)
- Fixes the animation of the scrubber width. It is now done in the player directive.
- Fixes a bug with the Page service. There was an error when changing songs.
- Removes fancyboxOpenImage from utils, it's directly in the main controller so we can call it from the directive. It didn't need to be in a service anymore since we have a player directive.
- Adds a Page service that will control the page's title from anywhere.
- Adds a setTitleSong method. It takes a song as parameter, that way
player-directive isn't responsible for correctly formatting the title. It also scrolls the title if the global setting is true
- Removes the title-related methods from utils-service
- showNotification takes a song as parameter and picks the information it needs itself. That way we avoid player-directive.js having utils as a dependency.
- shortened the names of the methods a bit. Had to rename them in settings.js
- Used $interval rather than window.setInterval in player-directive.js and in notification-service.js. It's easier to unit test them that way !
It handles displaying, adding or playing songs, whatever their source. It also handles error notifications for subsonic, http or service errors.
- Changes all calls to getRandomSongs in the template so they provide the 'display' parameter and do not provide any param when they aren't needed.
- Adds genre and folder parameters to getRandomSongs
- getRandomStarredSongs now maps the songs (using model) before returning them
I have now to fix the functions that called it from the scope (random autoplaylist and others)
This fixes the problem with AutoPlay not updating : since $q's promises are integrated with scope, we now see immediately the new songs being added.
They now use the new subsonicRequest() method which frees us from having to rebuild the complete URL with all the params. It handles JSONP/JSON and it also does most of the error-handling, so we can focus on displaying more specific messages in every request.
- Renamed playingIndex and playingSong in player-service.js to "private variables" starting with '_'. They only are public for testing purposes and are not meant to be manipulated directly.
That way, whenever we want to use something else (like a JSON file, or a DB) we will only have to change persistence-service.js
- Migrated the unit tests there too.
- Added replay in case of jPlayer error.
- 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();
- It makes it easier to use localStorage and sessionStorage "the angular way". It also does all the error handling so we don't need to.
- Adds back the automatic saving of the current track's position and playing queue in localStorage. It's fully unit tested.
- Adds back the notifications. Every time we change songs (if the setting is true), it displays a notification. Clicking on it goes to the next song, just like before.
- Bumps up the versions to the actual value on the various json files.
- AutoPlay still has a problem with scope apply. Since it's asynchronous, the directive needs to know when it's finisehd to use scope apply... That means more subsonic refactoring.
- Adds unit tests for Repeat song and Loop Queue
- Adds back a special function in the player Service to manage the end of a song.
- 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.
The major functionnalities are tested :
- play the next song when the current song ends
- change the current song with the player service
- restart the current song with the player service
- Show the player controls and song details when playing a song
Adds jasmine-fixtures dev dependency (needed for the visibility test)
- 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.
- 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
Not finished ! This is still work in progress and fairly broken in this commit.
The jquery jplayer is now wrapped in an angular directive.
The queue is no longer being managed in rootScope but is a part of the player service. It can be accessed like before and emptied / filled.
The player controller also uses the player service now.
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)
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.
The idea is that the service should ideally be used directly, so we know who depends on what and don't end up with cycles.
To achieve this, we should not add functions to $rootScope but instead provide them from our service.
Services can use them directly, and controllers have to create other functions in their own scope.
This means that we have a player-controller that does not do much by itself but it enables us to avoid filling up the $rootScope.
I have left the $rootScope additions at the end of player-service because it's going to take some time to refactor it, so in the meantime I want things to keep working.
That way we avoid loading imagemin everytime on watch, which was the longest (almost 30sec).
We only have to load 'grunt-karma' everytime, but now testing is lightning fast !
Test coverage files are in the /coverage folder.
They indicate us for each js file which lines we ran and which we didn't run during unit tests. This helps us know what to test next.
Conflicts:
package.json