- subsonic-service no longer computes the offset, it gets it as an int param and uses it.
- subsonic-controller is now in charge of computing the offset given a 'prev', 'next' or undefined param. It no longer allows the offset to go in the negatives, which made no sense.
- subsonic-controller's scope's AutoAlbums array is now a map indexed by the type of auto-album. It also contains each item's offset so we no longer share the offset between auto-albums, which avoids weird behaviours.
- Plus some minor code style fixes.
getSongs() does the same thing, at the only exception of Breadcrumbs management. Breadcrumbs will be refactored in a following commit.
Also removed getSongTemplate() which appears unused.
- Second part of the fix for tsquillario/Jamstash#212 - Fixes getIndexes
- Moved loading / saving / deleting the selected music folder to persistence-service.
- Moved the request to get all the music folders to subsonic-service.
- Moved SelectedMusicFolder to subsonic-controller's scope from the rootScope
- Fixes a bug where we would send a '-1' music folder id to Subsonic, causing an SQL error when choosing "All Folders" and refreshing the Artists list.
If the new server had an older ApiVersion (e.g. 1.8.0 compared to 1.12.0), when saving the settings, the server would respond an error due to the api version and when dealing with that error, we didn't update the ApiVersion when we should have.
So that the separation between subsonic-service and subsonic-controller is clear: the service makes requests and deals with $http, the controller displays, add to the player queue, etc.
I've also added a recursive version of getSongs() which enables us to play all the songs in a directory recursively, e.g. all the songs of an artist regardless of their album.
- Adds unit-tests to the controller and service for getSongs() and recursiveGetSongs()
- Adds a unit test in archive-service to test that we do use utils.formatDate
- Minor changes in subsonic-service.js to use a variable name rather than "this", which can change
When there is only one child, Madsonic does not return an array when Subsonic does.
I've added a check to always have the subsonic-response.directory.child as an array.
Adds 2 unit-tests: one for Subsonic's behaviour and one for Madsonic's
So we can move closer to consistent error-reporting and protocol usage.
- refactors subonic-controller's search().
- Adds a mapAlbumss() method to model-service.js. Just as mapSongs(), it maps an array of albums and returns it.
- Refactors the SearchTypes so their id is an int (0,1,2), just like we already expected it in subsonic-service. This means it might invalidate the existing setting saved in localStorage, so people would have an empty option selected by default until they save their settings.
- Adds unit-tests.
So we can move closer to consistent error-reporting and protocol usage.
- refactors subonic-controller's getPodcast().
- Also sets all the selected things (playlist, album, etc.) to null.
- Adds a mapPodcasts() method to model-service.js. Just as mapSongs(), it maps an array of podcast episodes and returns it.
- Adds unit-tests.
So we can move closer to consistent error-reporting and protocol usage.
- refactors subonic-controller's deletePlaylist(). It uses $window.confirm instead of the custom function in utils which didn't seem to add value.
- Adds unit-tests.
Some parameters are always there, some aren't. I've added '+' sign to distinguish those that are special to this test case. The difficulty is that they need to be sorted because that's what Angular does with params.
So we can move closer to consistent error-reporting and protocol usage.
- refactors subonic-controller's newPlaylist()
- Adds unit-tests. Try using Gojko Adzic's tips for BDD tests with Given-When-Then. See http://gojko.net/2015/02/25/how-to-get-the-most-out-of-given-when-then/
- Adds $window to subsonic-controller's dependencies. This allows us to test $window.prompt()
So we can move closer to consistent error-reporting and protocol usage.
- refactors subonic-controller's getPlaylist()
- Adds unit-tests
- Renames all "deferred" vars to "promise" which is really what is returned by $http.
- Converts all tabs in subsonic.html to spaces.
So we can move closer to consistent error-reporting and protocol usage.
Removed the "refresh" parameter, since it was always passed as true.
- Adds unit-tests
So we can move closer to consistent error-reporting and protocol usage.
Removed the "refresh" parameter, since it was always passed as true.
- Adds unit-tests
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 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.
- 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.
It has one parameter with 3 possible values :
- display: to display in the view,
- add: adds to the queue
- play: plays the first song and adds to the queue.
It is now called from the subsonic template.
All these are tested, errors from the server (both subsonic and http) are relayed to the user through notifications.
Conflicts:
app/subsonic/subsonic.html
see: https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/pub
The files are now grouped by view / component.
Tests are located beside tested js files. The Grunt build will be responsible for only distributing actual files without the tests.
Each partial is at the same level as the js files related to it.
Ideally css files should be at the same level, maybe I'll refactor this later.
Moves all non-bower plugins to app/vendor.
Moves all images to app/images and styles to app/styles.
Merges the test and non-test jshintrc files.
Adds all the Jamstash contributors to the package.json file while I was refactoring.
Conflicts:
app/app.js
app/images/vgrabber.gif
app/images/vgrabber2-active.gif
app/images/vgrabber2-normal.gif
app/index.html
2014-11-09 16:10:34 +01:00
Renamed from test/services/subsonic-service_test.js (Browse further)