- 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.
- Using space to play/pause was broken due to an issue with data
binding. Running `$scope.$apply()` after updating the `player.pauseSong`
property using `player.togglePause()` seems to have fixed this.
- All of the key event processing has been moved into the JS. This means
that all the key event logic is all in one spot (easier to understand
IMO). Additionally, this removes the need to redefine functions for
each shortcut.
- Removed the now-unused `angular-ui-utils/keypress.js` package.
- Fixed key events being active when editing dropdown/checkbox controls
in the settings menu
- Removed the custom `[Home]` shortcut since this is done natively by
the browser already.
- Removed the 1-6 shortcuts for the tabs. Logic being that it seems
pretty rare that you would want to rapidly switch between them (you
would have to use the mouse to do anything on all tabs except the
subsonic one anyway), and they were already broken without anyone
complaining.
- Fixed tests
- 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
- Added an svg "X" icon to enable removing auto-playlists
- Notice that the background-color and color change are done too, and since it's SVG, it takes only one image and some CSS to do both.
- Added a subsonic.css file. It is intended (long term) to have all subsonic view-related CSS styles.
- persistence-service now manages the selected genre auto-playlists names instead of utils.getValue().
- Rewrote persistence-service.js to comply with https://github.com/johnpapa/angular-styleguide#style-y052
- Rewrote many test descriptions in persistence-service_test.js to follow these recommendations : http://gojko.net/2015/02/25/how-to-get-the-most-out-of-given-when-then/
- 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.
- We no longer use toString() if the album's artist info is missing.
- Moved date formatting to utils-service.js and added TODOs to use angular filters instead
- Cleaned up utils-service.js and remove unused functions
- We no longer exclude vendor js files in karma, so we can test our call to jquery.dateFormat
- settings.js now has its own module : 'jamstash.settings.controller'. This makes it easier to test it and identify what dependencies it has.
- Renames 'jamstash.settings' module into 'jamstash.settings.service'
- Adds an angular constant to hold the current Jamstash version in app.js.
- Adds a way to upgrade incrementally what was in localStorage : in 4.4.5, DefaultSearchType will no longer be an object but an int, so we must init it with an int value, otherwise a blank option will be displayed. We detect what version we are using and what version was stored using persistence-service.js and run the upgrade accordingly.
- Refactors almost completely persistence-service_test.js
- Unit-tests some of settings.js's methods.
- Adds a control on the origin of keyboard shortcuts
This prevents pausing the song when typing "space" in the search input.
- Moves volume management to player-service. Adds getters and setters.
The setter also checks the volume so it stays between 0 and 1.
- Adds a volume field to the player service. It is set directly, no need for get/set...
- Adds a watcher in player-directive to set jPlayer's volume accordingly
- Adds turnVolumeUp and turnVolumeDown methods to the main scope. For the moment they are fine there, we'll maybe move them to the player service if they are called by anything else.
- Adds get/save/delete for the volume in the persistence service.
It provides a directive to bind keypress / keyup / keydown events to the DOM.
- Adds back toggling play / pause by pressing space.
- Renames player-service's pause() to togglePause(), which is its actual behavior
- Adds unit tests to togglePause() in player-service
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
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.
- 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.
- 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.
Moves $scope.getMusicFolders to the Subsonic controller since its only used by it. It also made the tests crash :p
Adds variable declarations where they were missing. It causes an error with "use strict".
TL;DR : everything but CSS is minified and packed in a neat dist/ directory.
This build :
- Merges all vendor dependencies (jquery, angular, etc) into one minified file.
- Merges the non-bower vendor dependencies (UnityShim, jquery-split-pane, etc). into one minified file.
- Merges all our javascript into one minified file.
- Copies all the needed CSS (couldn't minify and rename it because of dependencies in the JS).
- Renames all the images, the minified javascripts (but not the CSS) in order to avoid browser caching.
- Minifies all our html files.
Adds usemin commentaries (the ones with build) to index.html. Don't remove them or the build will break.
Renames the json files to .json so the build can find them and copy them.
Corrects all the angular-injectable functions to use the long form (with the array) in order to be minified. The build should also do that now with ng-Annotate but since I did it when debugging problems with the build, might as well keep it.
Note: the grunt test target is broken. Haven't figured out why yet.
Conflicts:
app/app.js
app/common/directives.js
app/index.html
app/settings/settings.js
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