From ad6b3d5d5a19ccdf3cf42082b5b6b2673413209f Mon Sep 17 00:00:00 2001 From: Max Goltzsche Date: Sun, 10 Mar 2024 01:45:03 +0100 Subject: [PATCH 1/2] Add Subidy and WebM3U support * Display the playlists provided by the Mopidy-Subidy and Mopidy-WebM3U extensions in addition to the ones provided by the built-in M3U plugin. * Show artists and albums from the Mopidy-Subidy backend (served by a Subsonic server). --- src/js/util/helpers.js | 8 ++++++-- src/js/util/selectors.js | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/js/util/helpers.js b/src/js/util/helpers.js index cf1d916f..ec092f31 100755 --- a/src/js/util/helpers.js +++ b/src/js/util/helpers.js @@ -140,8 +140,10 @@ const uriType = function (uri) { if (!uri) return ''; const exploded = `${uri}`.split(':'); + const is_playlist_uri = exploded.length >= 1 && exploded[1] === 'playlist' - if (exploded[0] === 'm3u') { + // The following covers m3u, webm3u, subidy:playlist URI schemes. + if (exploded[0].endsWith('m3u') || is_playlist_uri) { return 'playlist'; } @@ -193,8 +195,10 @@ const sourceIcon = function (uri, source = null) { if (uri) source = uriSource(uri); switch (source) { case 'local': - case 'm3u': case 'file': + case 'm3u': + case 'webm3u': + case 'subidy': return 'folder'; case 'gmusic': diff --git a/src/js/util/selectors.js b/src/js/util/selectors.js index f6528a1a..7075129b 100755 --- a/src/js/util/selectors.js +++ b/src/js/util/selectors.js @@ -107,6 +107,16 @@ const providers = { uri: 'm3u:playlists', title: i18n('services.mopidy.local'), }, + { + scheme: 'webm3u:', + uri: 'webm3u:playlists', + title: i18n('services.webm3u.title'), + }, + { + scheme: 'subidy:', + uri: 'subidy:playlists', + title: i18n('services.subidy.title'), + }, { scheme: 'spotify:', uri: 'spotify:library:playlists', @@ -134,6 +144,11 @@ const providers = { setting_name: 'library_albums_uri', title: i18n('services.mopidy.local'), }, + { + scheme: 'subidy:', + uri: 'subidy:vdir:albums', + title: i18n('services.subidy.title'), + }, { scheme: 'gmusic:', uri: 'gmusic:album', @@ -166,6 +181,11 @@ const providers = { setting_name: 'library_artists_uri', title: i18n('services.mopidy.local'), }, + { + scheme: 'subidy:', + uri: 'subidy:vdir:artists', + title: i18n('services.subidy.title'), + }, { scheme: 'gmusic:', uri: 'gmusic:artist', From 9e321634a1f6eba0603074688ed4dac9d8b9564b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Nystr=C3=B6m?= <35500074+antonnyst@users.noreply.github.com> Date: Thu, 14 Nov 2024 19:16:16 +0100 Subject: [PATCH 2/2] Add 'as loaded' sort ordering --- src/js/components/SearchResults.js | 12 +++++++----- src/js/views/Search.js | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/js/components/SearchResults.js b/src/js/components/SearchResults.js index 91ba997d..633a9bbc 100755 --- a/src/js/components/SearchResults.js +++ b/src/js/components/SearchResults.js @@ -27,11 +27,13 @@ const SearchResults = ({ const encodedTerm = encodeURIComponent(term); let results = [...rawResults]; - results = sortItems( - results, - (type === 'tracks' && sortField === 'followers' ? 'popularity' : sortField), - sortReverse, - ); + if (sortField) { + results = sortItems( + results, + (type === 'tracks' && sortField === 'followers' ? 'popularity' : sortField), + sortReverse, + ); + } const resultsCount = results.length; if (all && type !== 'tracks' && results.length > 5) { diff --git a/src/js/views/Search.js b/src/js/views/Search.js index 50757b0a..d7d2be04 100755 --- a/src/js/views/Search.js +++ b/src/js/views/Search.js @@ -70,6 +70,7 @@ const Search = () => { } const sortOptions = [ + { value: null, label: i18n('fields.filters.as_loaded') }, { value: 'name', label: i18n('common.name') }, { value: 'uri', label: i18n('fields.filters.source') }, { value: 'followers', label: i18n('common.popularity') },