Reinstating playlist lazy-loading artwork
- Needs monitoring on heavier backends (YTMusic, Tidal, etc) - Doesn't conflict with PlaylistGroups
This commit is contained in:
@ -101,7 +101,7 @@ const GridItem = ({
|
||||
dispatch(spotifyActions.getArtistImages(item));
|
||||
}
|
||||
break;
|
||||
// case 'playlist':
|
||||
case 'playlist':
|
||||
case 'album':
|
||||
dispatch(mopidyActions.getImages([item.uri]));
|
||||
break;
|
||||
|
||||
@ -109,16 +109,16 @@ const Sidebar = () => {
|
||||
<Icon name="mood" type="material" />
|
||||
<I18n path="sidebar.moods" />
|
||||
</Link>
|
||||
<Link to="/discover/featured-playlists" className="sidebar__menu__item" activeClassName="sidebar__menu__item--active">
|
||||
<Icon name="star" type="material" />
|
||||
<I18n path="sidebar.featured_playlists" />
|
||||
</Link>
|
||||
{spotify_available && (
|
||||
<Link to="/discover/featured-playlists" className="sidebar__menu__item" activeClassName="sidebar__menu__item--active">
|
||||
<Icon name="star" type="material" />
|
||||
<I18n path="sidebar.featured_playlists" />
|
||||
<Link to="/discover/new-releases" className="sidebar__menu__item" activeClassName="sidebar__menu__item--active">
|
||||
<Icon name="new_releases" type="material" />
|
||||
<I18n path="sidebar.new_releases" />
|
||||
</Link>
|
||||
)}
|
||||
<Link to="/discover/new-releases" className="sidebar__menu__item" activeClassName="sidebar__menu__item--active">
|
||||
<Icon name="new_releases" type="material" />
|
||||
<I18n path="sidebar.new_releases" />
|
||||
</Link>
|
||||
</section>
|
||||
|
||||
<section className="sidebar__menu__section">
|
||||
|
||||
@ -860,7 +860,6 @@ const MopidyMiddleware = (function () {
|
||||
break;
|
||||
|
||||
case 'MOPIDY_PLAY_PLAYLIST': {
|
||||
console.debug(action)
|
||||
const playlist = store.getState().core.items[action.uri];
|
||||
const { sortField, sortReverse } = getSortSelector(store.getState(), 'playlist_tracks');
|
||||
if (playlist && playlist.tracks) {
|
||||
@ -2153,22 +2152,25 @@ const MopidyMiddleware = (function () {
|
||||
}
|
||||
case 'MOPIDY_GET_LIBRARY_PLAYLISTS': {
|
||||
store.dispatch(uiActions.startProcess(action.type, { notification: false }));
|
||||
const scheme = action.uri.split(':')[0];
|
||||
|
||||
request(store, 'playlists.asList').then((browseResponse) => {
|
||||
const allUris = arrayOf('uri', browseResponse);
|
||||
const allUris = arrayOf('uri', browseResponse).filter((uri) => uri.startsWith(scheme));
|
||||
const unloadedUris = [...allUris];
|
||||
|
||||
store.dispatch(
|
||||
uiActions.updateProcess(
|
||||
action.type,
|
||||
{
|
||||
total: allUris.length,
|
||||
remaining: allUris.length,
|
||||
remaining: unloadedUris.length,
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
const run = () => {
|
||||
if (allUris.length) {
|
||||
const uri = allUris.splice(0, 1)[0];
|
||||
if (unloadedUris.length) {
|
||||
const uri = unloadedUris.splice(0, 1)[0];
|
||||
const processor = store.getState().ui.processes[action.type];
|
||||
|
||||
if (processor && processor.status === 'cancelling') {
|
||||
@ -2176,7 +2178,7 @@ const MopidyMiddleware = (function () {
|
||||
store.dispatch(uiActions.stopLoading(action.uri));
|
||||
return;
|
||||
}
|
||||
store.dispatch(uiActions.updateProcess(action.type, { remaining: allUris.length }));
|
||||
store.dispatch(uiActions.updateProcess(action.type, { remaining: unloadedUris.length }));
|
||||
|
||||
request(store, 'playlists.lookup', { uri }).then((lookupResponse) => {
|
||||
if (lookupResponse) {
|
||||
@ -2198,7 +2200,7 @@ const MopidyMiddleware = (function () {
|
||||
store.dispatch(coreActions.libraryLoaded({
|
||||
uri: action.uri,
|
||||
type: 'playlists',
|
||||
items_uris: arrayOf('uri', browseResponse),
|
||||
items_uris: allUris,
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user