Commit graph

403 commits

Author SHA1 Message Date
Hyzual
d2bdb8eed9 Use angular cache when querying getMusicFolders and getIndexes
It saves us a few requests and helps making Jamstash faster.
It's unlikely that the artists list or the music folders will change during a Jamstash session. It's also an easy cache to reset: the user only has to reload the page.
2015-07-07 22:09:12 +02:00
Hyzual
9c8c8cf6a8 Refactor getAlbumListBy()
- 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.
2015-07-07 22:09:12 +02:00
Hyzual
710b16165a Rework of the JSCS and JSHint configs
Those are stricter now, especially the JSCS. I believe it will make our code easier to read in the end.
It'll take some time to comply to it, so we'll do it gradually as we modify things.
2015-07-07 22:08:18 +02:00
Hyzual
b4ab303cb5 Refactor breadcrumbs into a directive.
We can now display as many levels of breadcrumbs as needed, meaning we support folders deeper than 2 levels.
2015-07-07 22:08:17 +02:00
Hyzual
91dbb868ed Removes getAlbums(), replaced by getSongs()
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.
2015-07-07 22:07:21 +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
ba98427b94 Updates all npm packages, removes the "undef" rule to enable johnpapa's style
I've recently started following some of the style guide rules from https://github.com/johnpapa/angular-styleguide
This jshint rule in particular was contradictory with https://github.com/johnpapa/angular-styleguide#style-y091 which is why it was removed
2015-05-28 22:09:14 +02:00
Hyzual
96aa1be2cf Display the loading spinner gif for all angular ajax requests
Remove the ajax-loader.gif which appeared only in unused styles.
2015-05-28 22:07:17 +02:00
Hyzual
8a81d7b9eb 4.5.0 Player, Queue and Songs UI improvements
Please do a bower install and npm install to update.

* Adds a repeat directive to manage a 3-state repeat button
* Adds grunt tasks related to CSS and SVG, updates all npm packages
* fix tsquillario/Jamstash#212
* Refactors the way music folders are handled
* Fix Search
* Fix a bug that prevented you from changing your server
* Update Angular to 1.3.15
* Move starring songs to subsonic-service
* Removes the comments from the editorconfig file.
* Refactors subsonic's getSongs(), adds a recursiveGetSongs()
* Adds a way to play only one song from a list of songs
* When shuffling the playing queue, the currently playing song will always stay at the first position.
* Removes jquery.base64.js (unused), replaced jquery.dateFormat-1.0.js with its bower version
2015-05-23 13:39:24 +02:00
Hyzual
ab1954b3ba Merge branch '4.5.0' into develop 2015-05-23 12:51:42 +02:00
Hyzual
efa604265d Adds a repeat directive to manage a 3-state repeat button
It will cycle through "repeat the playing queue", "repeat the playing song" and "don't repeat anything".

- Adds a custom "loop-single" icon based on iconic's loop icon.
- Removes the LoopQueue setting which is now the "queue" value of Repeat
- Moves the Repeat setting to player-service.js. That way, it does not depend on saving the settings in any way. It also allows us to remove a dependency from player-service.js.
- Adds a player css which will hold all the player-related styles
- Removes the former png icons (we can always find them back thanks to Git)
2015-05-22 00:05:37 +02:00
Hyzual
acd2ae67f8 Adds grunt tasks related to CSS and SVG, updates all npm packages
Please do a npm install to update your copy of the packages.

- Adds a grunt task to build up a sprite out of our own svg icons
- Adds a grunt task to copy iconic's svg icons from bower
- Adds a build step to concatenate CSS files. It leaves us free to split the CSS and thus have the minimum css in each directory.
- Adds open-iconic as a bower dependency. We were using their icons, now we can use their svg sprite directly.
- Adds ng-html2JsPreprocessor. A karma preprocessor that helps us test template-url dependent directives.
- Removes jshint from the gruntfile. jshint should be used directly in your editor, e.g. SublimeLinter (https://github.com/SublimeLinter/SublimeLinter-jshint) for SublimeText
- Removes the plugins declaration from karma.conf.js which is now apparently unnecessary.
2015-05-22 00:05:37 +02:00
Hyzual
e43c4c7655 Refactors the way music folders are handled
- 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.
2015-05-21 23:54:43 +02:00
Hyzual
0bc1cea108 Updates jasmine-promise-matchers to v1.1.1
Removes all deprecated jshint rules. They are not yet replaced with a JSCS equivalent (though they might be in the future).
2015-05-20 23:07:31 +02:00
Hyzual
5fed2ed21e Partial fix for tsquillario/Jamstash#212 - Fix Search 2015-05-14 23:22:25 +02:00
Hyzual
d45db2a98f Fix a bug that prevented you from changing your server
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.
2015-05-14 23:01:29 +02:00
Hyzual
a29903dec1 Update Angular to 1.3.15
Please do a bower install and npm install to update.
Also updated both bower.json and package.json's licences to the correct one.
Also update karma-jasmine.
2015-05-14 18:02:42 +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
832c410290 Removes the comments from the editorconfig file.
Those are the styles we're using, we shouldn't encourage people to change them (this was a leftover from yeoman-angular).
2015-05-14 11:04:54 +02:00
Hyzual
ee25f7046e Refactors subsonic's getSongs(), adds a recursiveGetSongs()
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()
2015-05-03 22:12:16 +02:00
Hyzual
7be524af00 Adds a way to play only one song from a list of songs
Use double-click to play a song and all the following songs, click on the play icon to play only this one song. Because it was annoying to double-click and then have to remove all other songs.
2015-05-03 14:58:00 +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
9fbd7bcf8e Removes jquery.base64.js (unused), replaced jquery.dateFormat-1.0.js with its bower version
- 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
2015-05-01 13:08:05 +02:00
Hyzual
7dd4588dea 4.4.6 Fixes a bug that prevented displaying an album without ID3 tag information.
Also changed the README to add a link to the Contributing page of the wiki.
2015-05-01 12:58:27 +02:00
Hyzual
f1870f2f5b Fixes tsquillario/Jamstash#206
- 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
2015-04-12 21:04:27 +02:00
Hyzual
c90eb9f211 4.4.5 Refactors subsonic and subsonic-service
- Adds a way to upgrade users' local storage settings between versions
- persistence-service now also manages user settings and JamstashVersion
- Fixes bugs in almost all the requests when using Madsonic
2015-04-12 21:03:26 +02:00
Hyzual
863aabc873 Merge branch 'madsonic' 2015-04-12 15:08:57 +02:00
Hyzual
d06eef9cad Fixes Madsonic-related problems with getPodcast()
subsonic-service now makes sure we get an array (and not an object) when we expect one.
2015-04-12 15:08:38 +02:00
Hyzual
71eede8784 Fixes Madsonic-related problems with getAlbumListBy(), getSongs()
subsonic-service now makes sure we get an array (and not an object) when we expect one.
2015-04-12 15:08:37 +02:00
Hyzual
ee798fde90 Fixes Madsonic-related problems with search(), getRandomSongs() and getRandomStarredSongs()
subsonic-service now makes sure we get an array (and not an object) when we expect one.

Also improved the wording of many unit-tests.
2015-04-12 15:08:37 +02:00
Hyzual
8fe241e329 Fixes Madsonic-related problems with getPlaylists() and getPlaylist()
subsonic-service now makes sure we get an array (and not an object) when we expect one.
2015-04-12 15:08:36 +02:00
Hyzual
874f59a03b Fixes Madsonic-related problems with getArtists() and getPodcasts()
subsonic-service now makes sure we get an array (and not an object) when we expect one, e.g. shortcuts, index for artists and channel for podcasts.
2015-04-12 15:08:36 +02:00
Hyzual
af14bc5663 Fixes tsquillario/jamstash#207
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
2015-04-12 15:08:36 +02:00
Hyzual
05cb5aa1ab Adds a javascript check-style file to keep consistent code style 2015-03-26 21:42:13 +01:00
Hyzual
83e03ed59c Merge branch 'upgrade-localstorage' into develop 2015-03-26 21:40:10 +01:00
Hyzual
a6854e33f6 Fixes the "non-finite value" error when volume has never been set
- When Volume has never been stored in local storage, it causes "non-finite value" errors in jPlayer. persistence-service will now return 1.0 if it's not set.
2015-03-26 21:26:53 +01:00
Hyzual
025be32fc7 Fixes a bug where scope.settings and globals.settings were out of sync.
Was caused by loadSettings() which assigned settings directly to globals.settings, thus breaking the reference.
2015-03-26 21:22:05 +01:00
Hyzual
fb65ae48bf Removes the angular constant jamstashVersion, goes back to using the json changelog as latest version
- Adds tests to checkVersion & checkVersionNewer: if the second version (older or required version) is undefined, it always returns true. This enables us to upgrade the settings even if there never was a Jamstash version stored in local storage.
2015-03-24 18:36:55 +01:00
Hyzual
812fff38cd Adds grunt-bump to make it easier to bump up versions in the 3 json files
Removes grunt-ng-annotate (unused), upgrades karma patch version
2015-03-24 18:36:55 +01:00
Hyzual
fe6c10bc4a Rewrites checkVersion and checkVersionNewer in utils-service.js, refines upgradeToVersion
- Adds unit tests that cover all cases.
- Adds call to parseVersionString() so we can pass it version string e.g. '1.0.1'
- persistence-service.js now also manages JamstashVersion. It is set in localStorage from app.js's constant, and not from the changelog so we don't have to add a version to the changelog to actually do stuff.
- persistence-service.js's upgradeToVersion() now only applies newer changesets. This ensures we won't erase users' settings with changesets at every new version, e.g. resetting songSearchType to song every time.
- upgradeToVersion() will also notify the user of the upgrade, which was formerly done in settings.js
2015-03-24 18:36:55 +01:00
Hyzual
ae703c1542 Refines the changesets mechanism.
- Adds an angular "value" that will contain an array of objects with version and change to be applied to the settings.
- Adds the possibility to run multiple changesets (e.g. upgrade from v1.0.0 to v1.0.2).
- Adds todos in the utils service for things related to version comparisons.
2015-03-24 18:36:54 +01: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
f98740d613 Removes call to getAlbums() on startup that always failed
It didn't pass an id, so it always failed. Besides, there is already one a few lines below which uses routeParams.
2015-03-24 18:36:54 +01:00
Hyzual
3905c5f3d6 Updates angular-locker to v1.2.x and removes the "jamstash" namespace from the locker-managed objects
We used to save the current queue, song and volume with a "jamstash" prefix.
We no longer used the previous non-prefixed values, which became unused.
While not overly annoying for volume or playlist, if we plan to use locker to manage our settings it could become much more problematic.
2015-03-24 18:36:53 +01:00
Hyzual
f509dfa78f Merge branch 'refactor-subsonic' into develop 2015-03-24 18:36:21 +01:00
Hyzual
cf95f962b3 Improves test naming 2015-03-24 18:35:49 +01:00
Hyzual
841336cafd Refactors subsonic-service's search() to use subsonicRequest()
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.
2015-03-24 18:35:48 +01:00
Hyzual
ef57aac043 Refactors subsonic-service's getPodcast() to use subsonicRequest()
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.
2015-03-24 18:35:48 +01:00
Hyzual
f4c37bc8dd Refactors subsonic-service's getPodcasts() to use subsonicRequest()
So we can move closer to consistent error-reporting and protocol usage.
- refactors subonic-controller's getPodcasts().
- Adds unit-tests.
2015-03-24 18:35:48 +01:00