Commit graph

18 commits

Author SHA1 Message Date
Carey Metcalfe
8c279093df Refactor media keys and fix play/pause
- 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
2017-11-10 14:31:01 -05:00
Hyzual
9804561ebd Fix starring songs in the playing queue 2015-07-20 23:36:47 +02:00
Hyzual
58829facd6 Minor code style adjustments to comply with our jscsrc. 2015-07-07 22:10:22 +02:00
Hyzual
5d35c2bd1a Replaced Underscore with Lodash
Lodash has more useful functions and is more regularly updated.
2015-07-07 22:06:59 +02:00
Hyzual
0ba6b651b1 Fetch users' ID3 genres using Subsonic
Instead of using a predefined list.
2015-06-01 23:43:36 +02:00
Hyzual
b96fe0ecf0 Move starring songs to subsonic-service
So we keep all requests to subsonic in the same place and all use subsonicRequest()
2015-05-14 13:39:59 +02:00
Hyzual
a97e5159bc Uses angular-locker to store settings in localStorage
- 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.
2015-03-24 18:36:54 +01:00
Hyzual
faf004b5b0 4.4.4 Prevents global shortcuts on inputs
- 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.
2015-02-15 15:14:17 +01:00
Hyzual
06329bef70 Fixes persistence's mock, adds back the original keycode detection 2015-02-08 22:50:14 +01:00
Hyzual
5a7a06d1a2 Adds the left and right keys to get previous / next song
Removes the previous code in main-controller.js
2015-02-08 22:46:48 +01:00
Hyzual
a85865371c Adds back setting the volume up / down using the keyboard
- 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.
2015-02-08 22:46:47 +01:00
Hyzual
8529e331a2 Adds angular-ui/ui-utils/ui-keypress dependency
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
2015-02-08 22:46:47 +01:00
Hyzual
09fb66f2fe Adds back support of oga and m4a
- 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.
2015-01-17 19:15:09 +01:00
Hyzual
42830bbdbf Extracts everything related to localStorage in common/persistence-service.js
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.
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
83869b7808 Adds angular-locker dependency.
- 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.
2015-01-17 19:13:43 +01:00
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
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