From bbd9318e13700da5973ae58531b7eaa32f22a7fa Mon Sep 17 00:00:00 2001 From: jcass Date: Sun, 8 May 2016 10:09:53 +0200 Subject: [PATCH 1/4] Update icons for tkem's podcast-related backend extensions. --- README.rst | 1 + mopidy_musicbox_webclient/static/js/functionsvars.js | 3 +++ 2 files changed, 4 insertions(+) diff --git a/README.rst b/README.rst index 6fae1c5..a9824d0 100644 --- a/README.rst +++ b/README.rst @@ -145,6 +145,7 @@ v2.3.0 (UNRELEASED) a small divider rendered above it. (Fixes: `#196 `_). - Replaced JavaScript confirmation prompt on 'Streams' pane with jQuery equivalent. (Fixes: `#191 `_). +- Update icons and labels for podcast, podcast-gpodder, and podcast-itunes backends. v2.2.0 (2016-03-01) ------------------- diff --git a/mopidy_musicbox_webclient/static/js/functionsvars.js b/mopidy_musicbox_webclient/static/js/functionsvars.js index ec90cde..c3d2629 100644 --- a/mopidy_musicbox_webclient/static/js/functionsvars.js +++ b/mopidy_musicbox_webclient/static/js/functionsvars.js @@ -79,6 +79,8 @@ var uriClassList = [ ['file', 'fa-folder-o'], ['m3u', 'fa-file-sound-o'], ['podcast', 'fa-rss-square'], + ['podcast+file', 'fa-rss-square'], + ['podcast+itunes', 'fa-apple'], ['dirble', 'fa-microphone'], ['tunein', 'fa-headphones'], ['soundcloud', 'fa-soundcloud'], @@ -98,6 +100,7 @@ var uriHumanList = [ ['local', 'Local files'], ['m3u', 'Local playlists'], ['podcast', 'Podcasts'], + ['podcast+itunes', 'iTunes Store: Podcasts'], ['dirble', 'Dirble'], ['tunein', 'TuneIn'], ['soundcloud', 'SoundCloud'], From 5829368e4045945c24cd23b2428c5a1b0fa6a612 Mon Sep 17 00:00:00 2001 From: jcass Date: Sun, 8 May 2016 10:52:37 +0200 Subject: [PATCH 2/4] Only capitalize first letter of a scheme if a mapping has not been statically defined. Update test cases. --- .../static/js/functionsvars.js | 7 ++++++- mopidy_musicbox_webclient/static/js/library.js | 5 ++++- tests/js/test_library.js | 15 ++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/mopidy_musicbox_webclient/static/js/functionsvars.js b/mopidy_musicbox_webclient/static/js/functionsvars.js index c3d2629..a2d7dfc 100644 --- a/mopidy_musicbox_webclient/static/js/functionsvars.js +++ b/mopidy_musicbox_webclient/static/js/functionsvars.js @@ -94,6 +94,11 @@ var uriClassList = [ ['subsonic', 'fa-folder-open'] ] +// TODO: It should be possible to retrieve a user-friendly name for a given Mopidy scheme dynamically by +// calling mopidy.library.browse() on the root dir: +// 1. each backend contained in the result will have a 'name' attribute that can be shown as-is in the UI. +// 2. the URI prefix of the backend result should === mopidy.getUriSchemes(), which can be used for the mapping. +// 3. only backends that cannot be 'browsed' (e.g. youtube) should have a static mapping defined here. var uriHumanList = [ ['spotify', 'Spotify'], ['spotifytunigo', 'Spotify browse'], @@ -510,7 +515,7 @@ function getMediaHuman (uri) { return uriHumanList[i][1] } } - return uri + return '' } function isServiceUri (uri) { diff --git a/mopidy_musicbox_webclient/static/js/library.js b/mopidy_musicbox_webclient/static/js/library.js index 13e63e8..682174f 100644 --- a/mopidy_musicbox_webclient/static/js/library.js +++ b/mopidy_musicbox_webclient/static/js/library.js @@ -337,7 +337,10 @@ }) for (var i = 0; i < schemesArray.length; i++) { backendName = getMediaHuman(schemesArray[i]) - backendName = backendName.charAt(0).toUpperCase() + backendName.slice(1) + if (!backendName) { + // No mapping defined, revert to just showing the scheme with first letter capitalized. + backendName = schemesArray[i].charAt(0).toUpperCase() + schemesArray[i].slice(1) + } $('#selectSearchService').append(new Option(backendName, schemesArray[i])) } $('#selectSearchService').val(searchScheme) diff --git a/tests/js/test_library.js b/tests/js/test_library.js index 47c2637..3b4b789 100644 --- a/tests/js/test_library.js +++ b/tests/js/test_library.js @@ -17,17 +17,22 @@ describe('Library', function () { $(document.body).append('') $('#selectSearchService').selectmenu() }) + + beforeEach(function () { + uriHumanList = [ + ['mockScheme1', 'mockUriHuman1'], + ['mockScheme2', 'mockUriHuman2'] + ] + }) describe('#getSearchSchemes()', function () { beforeEach(function () { $(selectID).empty() }) it('should add human-readable options for backend schemes', function () { - uriHumanList = [['mockScheme2', 'mockUriHuman2']] - library.getSearchSchemes([], mopidy) assert.equal($(selectID).children().length, schemesArray.length + 1) - expect($(selectID).children(':eq(2)')).to.have.text('MockUriHuman2') + expect($(selectID).children(':eq(2)')).to.have.text('mockUriHuman2') }) it('should get default value from cookie', function () { @@ -42,9 +47,9 @@ describe('Library', function () { expect($(selectID + ' option:selected')).to.have.value('all') }) - it('should capitalize first character of backend schema', function () { + it('should capitalize first character of backend schema if no mapping is provided', function () { library.getSearchSchemes([], mopidy) - expect($(selectID).children(':eq(1)')).to.have.text('MockScheme1') + expect($(selectID).children(':eq(3)')).to.have.text('MockScheme3') }) it('should blacklist services that should not be searched', function () { From ff87695ae78f57af87049ac6ae0af0a45f9862b5 Mon Sep 17 00:00:00 2001 From: Nick Steel Date: Sun, 15 May 2016 23:20:24 +0100 Subject: [PATCH 3/4] Update appcache following PR#200 --- mopidy_musicbox_webclient/static/mb.appcache | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mopidy_musicbox_webclient/static/mb.appcache b/mopidy_musicbox_webclient/static/mb.appcache index 153d912..529ba4a 100644 --- a/mopidy_musicbox_webclient/static/mb.appcache +++ b/mopidy_musicbox_webclient/static/mb.appcache @@ -1,6 +1,6 @@ CACHE MANIFEST -# 2016-05-13:v1 +# 2016-05-15:v1 NETWORK: * From fa5689409abde8361aeaf06f73231db03ef6c3f4 Mon Sep 17 00:00:00 2001 From: Nick Steel Date: Sun, 15 May 2016 23:37:31 +0100 Subject: [PATCH 4/4] Bump version to v2.3.0 and update changelog for release. --- README.rst | 15 ++++++--------- mopidy_musicbox_webclient/__init__.py | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index d5fa64d..eca37f5 100644 --- a/README.rst +++ b/README.rst @@ -34,7 +34,6 @@ Features - Save the current queue to an easily accessible playlist. - Search for tracks, albums, or artists from specific backends or all of Mopidy. - Shows detailed track and album information during playback, with album cover retrieval from Last.fm. -- Seek tracks during playback. - Support for all of the Mopidy playback controls (consume mode, repeat, shuffle, etc.) - Deep integration with, and additional features for, the `Pi MusicBox `_. - Fullscreen mode. @@ -82,16 +81,14 @@ The following configuration values are available should you wish to customize yo - ``musicbox_webclient/enabled``: If the MMW extension should be enabled or not. Defaults to ``true``. - ``musicbox_webclient/musicbox``: Set this to ``true`` if you are connecting to a Mopidy instance running on a - Pi Musicbox. Expands the MMW user interface to include features for rebooting the Pi, changing configuration values - via a web interface, etc. + Pi Musicbox. Expands the MMW user interface to include system control/configuration functionality. -- ``musicbox_webclient/websocket_host``: Optional setting that can be used to specify the target host for Mopidy websocket connections. +- ``musicbox_webclient/websocket_host``: Optional setting to specify the target host for Mopidy websocket connections. -- ``musicbox_webclient/websocket_port``: Optional setting that can be used to specify the target port for Mopidy websocket connections. +- ``musicbox_webclient/websocket_port``: Optional setting to specify the target port for Mopidy websocket connections. -- ``musicbox_webclient/on_track_click``: Specifies the default action that should be performed when the user clicks on - a track that is displayed in the Browse pane or as part of Search results. Valid options are: ``PLAY_NOW``, - ``PLAY_NEXT``, ``ADD_THIS_BOTTOM``, ``ADD_ALL_BOTTOM``, ``PLAY_ALL`` (default), and ``DYNAMIC`` (repeats last action). +- ``musicbox_webclient/on_track_click``: The action performed when clicking on a track. Valid options are: + ``PLAY_ALL`` (default), ``PLAY_NOW``, ``PLAY_NEXT``, ``ADD_THIS_BOTTOM``, ``ADD_ALL_BOTTOM``, and ``DYNAMIC`` (repeats last action). Usage ===== @@ -110,7 +107,7 @@ Project resources Changelog ========= -v2.3.0 (UNRELEASED) +v2.3.0 (2016-05-15) ------------------- - Enhance build workflow to include style checks and syntax validation for HTML, CSS, and Javascript. diff --git a/mopidy_musicbox_webclient/__init__.py b/mopidy_musicbox_webclient/__init__.py index 2bc628e..1047067 100644 --- a/mopidy_musicbox_webclient/__init__.py +++ b/mopidy_musicbox_webclient/__init__.py @@ -4,7 +4,7 @@ import os from mopidy import config, ext -__version__ = '2.2.0' +__version__ = '2.3.0' class Extension(ext.Extension):