Everything goes through loadItem; Options now provide 'full' switch for full asset on demand
This commit is contained in:
@ -90022,7 +90022,9 @@ var ContextMenu = /*#__PURE__*/function (_React$Component) {
|
|||||||
_this$props28$menu = _this$props28$menu === void 0 ? {} : _this$props28$menu;
|
_this$props28$menu = _this$props28$menu === void 0 ? {} : _this$props28$menu;
|
||||||
var uris = _this$props28$menu.uris;
|
var uris = _this$props28$menu.uris;
|
||||||
var uri = uris[0];
|
var uri = uris[0];
|
||||||
loadItem(uri, true);
|
loadItem(uri, {
|
||||||
|
forceRefetch: true
|
||||||
|
});
|
||||||
hideContextMenu();
|
hideContextMenu();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -91035,23 +91037,23 @@ var mapStateToProps = function mapStateToProps(state) {
|
|||||||
current_tracklist: state.core.current_tracklist,
|
current_tracklist: state.core.current_tracklist,
|
||||||
queue_metadata: state.core.queue_metadata,
|
queue_metadata: state.core.queue_metadata,
|
||||||
spotify_available: state.spotify.access_token,
|
spotify_available: state.spotify.access_token,
|
||||||
spotify_library_playlists: state.core.items['spotify:library:playlists'] || {
|
spotify_library_playlists: state.core.libraries['spotify:library:playlists'] || {
|
||||||
items_uris: []
|
items_uris: []
|
||||||
},
|
},
|
||||||
spotify_library_artists: state.core.items['spotify:library:artists'] || {
|
spotify_library_artists: state.core.libraries['spotify:library:artists'] || {
|
||||||
items_uris: []
|
items_uris: []
|
||||||
},
|
},
|
||||||
spotify_library_albums: state.core.items['spotify:library:albums'] || {
|
spotify_library_albums: state.core.libraries['spotify:library:albums'] || {
|
||||||
items_uris: []
|
items_uris: []
|
||||||
},
|
},
|
||||||
spotify_library_tracks: state.spotify.library_tracks,
|
spotify_library_tracks: state.spotify.library_tracks,
|
||||||
mopidy_library_playlists: state.core.items['mopidy:library:playlists'] || {
|
mopidy_library_playlists: state.core.libraries['mopidy:library:playlists'] || {
|
||||||
items_uris: []
|
items_uris: []
|
||||||
},
|
},
|
||||||
mopidy_library_artists: state.core.items['mopidy:library:artists'] || {
|
mopidy_library_artists: state.core.libraries['mopidy:library:artists'] || {
|
||||||
items_uris: []
|
items_uris: []
|
||||||
},
|
},
|
||||||
mopidy_library_albums: state.core.items['mopidy:library:albums'] || {
|
mopidy_library_albums: state.core.libraries['mopidy:library:albums'] || {
|
||||||
items_uris: []
|
items_uris: []
|
||||||
},
|
},
|
||||||
playlists: state.core.playlists,
|
playlists: state.core.playlists,
|
||||||
@ -103789,80 +103791,70 @@ function updateColdStore(items) {
|
|||||||
* */
|
* */
|
||||||
|
|
||||||
function loadItems(uris) {
|
function loadItems(uris) {
|
||||||
var forceRefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||||
var callbackAction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_ITEMS',
|
type: 'LOAD_ITEMS',
|
||||||
uris: uris,
|
uris: uris,
|
||||||
forceRefetch: forceRefetch,
|
options: options
|
||||||
callbackAction: callbackAction
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function loadItem(uri) {
|
function loadItem(uri) {
|
||||||
var forceRefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||||
var callbackAction = arguments.length > 2 ? arguments[2] : undefined;
|
return loadItems([uri], options);
|
||||||
return loadItems([uri], forceRefetch, callbackAction);
|
|
||||||
}
|
}
|
||||||
function loadTrack(uri) {
|
function loadTrack(uri) {
|
||||||
var forceRefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_TRACK',
|
type: 'LOAD_TRACK',
|
||||||
uri: uri,
|
uri: uri,
|
||||||
forceRefetch: forceRefetch
|
options: options
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function loadAlbum(uri) {
|
function loadAlbum(uri) {
|
||||||
var forceRefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||||
var callbackAction = arguments.length > 2 ? arguments[2] : undefined;
|
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_ALBUM',
|
type: 'LOAD_ALBUM',
|
||||||
uri: uri,
|
uri: uri,
|
||||||
forceRefetch: forceRefetch,
|
options: options
|
||||||
callbackAction: callbackAction
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function loadArtist(uri) {
|
function loadArtist(uri) {
|
||||||
var forceRefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||||
var callbackAction = arguments.length > 2 ? arguments[2] : undefined;
|
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_ARTIST',
|
type: 'LOAD_ARTIST',
|
||||||
uri: uri,
|
uri: uri,
|
||||||
forceRefetch: forceRefetch,
|
options: options
|
||||||
callbackAction: callbackAction
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function loadPlaylist(uri) {
|
function loadPlaylist(uri) {
|
||||||
var forceRefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||||
var callbackAction = arguments.length > 2 ? arguments[2] : undefined;
|
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_PLAYLIST',
|
type: 'LOAD_PLAYLIST',
|
||||||
uri: uri,
|
uri: uri,
|
||||||
forceRefetch: forceRefetch,
|
options: options
|
||||||
callbackAction: callbackAction
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function loadUser(uri) {
|
function loadUser(uri) {
|
||||||
var forceRefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_USER',
|
type: 'LOAD_USER',
|
||||||
uri: uri,
|
uri: uri,
|
||||||
forceRefetch: forceRefetch
|
options: options
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function loadUserPlaylists(uri) {
|
function loadUserPlaylists(uri, options) {
|
||||||
var forceRefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_USER_PLAYLISTS',
|
type: 'LOAD_USER_PLAYLISTS',
|
||||||
uri: uri,
|
uri: uri,
|
||||||
forceRefetch: forceRefetch
|
options: options
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function loadLibrary(uri) {
|
function loadLibrary(uri) {
|
||||||
var forceRefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_LIBRARY',
|
type: 'LOAD_LIBRARY',
|
||||||
uri: uri,
|
uri: uri,
|
||||||
forceRefetch: forceRefetch
|
options: options
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
@ -104565,8 +104557,7 @@ var CoreMiddleware = function () {
|
|||||||
store.dispatch({
|
store.dispatch({
|
||||||
type: "LOAD_".concat(Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["uriType"])(uri).toUpperCase()),
|
type: "LOAD_".concat(Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["uriType"])(uri).toUpperCase()),
|
||||||
uri: uri,
|
uri: uri,
|
||||||
forceRefetch: action.forceRefetch,
|
options: action.options
|
||||||
callbackAction: action.callbackAction
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@ -104576,7 +104567,7 @@ var CoreMiddleware = function () {
|
|||||||
var fetchTrack = function fetchTrack() {
|
var fetchTrack = function fetchTrack() {
|
||||||
switch (Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["uriSource"])(action.uri)) {
|
switch (Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["uriSource"])(action.uri)) {
|
||||||
case 'spotify':
|
case 'spotify':
|
||||||
store.dispatch(spotifyActions.getTrack(action.uri, action.forceRefetch));
|
store.dispatch(spotifyActions.getTrack(action.uri, action.options));
|
||||||
|
|
||||||
if (spotify.me) {
|
if (spotify.me) {
|
||||||
store.dispatch(spotifyActions.following(action.uri));
|
store.dispatch(spotifyActions.following(action.uri));
|
||||||
@ -104590,7 +104581,7 @@ var CoreMiddleware = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (action.forceRefetch) {
|
if (action.options.forceRefetch) {
|
||||||
console.info("Force-refetching \"".concat(action.uri, "\""));
|
console.info("Force-refetching \"".concat(action.uri, "\""));
|
||||||
fetchTrack();
|
fetchTrack();
|
||||||
break;
|
break;
|
||||||
@ -104621,7 +104612,7 @@ var CoreMiddleware = function () {
|
|||||||
var fetchAlbum = function fetchAlbum() {
|
var fetchAlbum = function fetchAlbum() {
|
||||||
switch (Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["uriSource"])(action.uri)) {
|
switch (Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["uriSource"])(action.uri)) {
|
||||||
case 'spotify':
|
case 'spotify':
|
||||||
store.dispatch(spotifyActions.getAlbum(action.uri, action.forceRefetch));
|
store.dispatch(spotifyActions.getAlbum(action.uri, action.options));
|
||||||
|
|
||||||
if (spotify.me) {
|
if (spotify.me) {
|
||||||
store.dispatch(spotifyActions.following(action.uri));
|
store.dispatch(spotifyActions.following(action.uri));
|
||||||
@ -104637,13 +104628,13 @@ var CoreMiddleware = function () {
|
|||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (action.forceRefetch) {
|
if (action.options.forceRefetch) {
|
||||||
console.info("Force-refetching \"".concat(action.uri, "\""));
|
console.info("Force-refetching \"".concat(action.uri, "\""));
|
||||||
fetchAlbum();
|
fetchAlbum();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (store.getState().core.items[action.uri] && store.getState().core.items[action.uri].tracks) {
|
if (store.getState().core.items[action.uri] && (!action.options.full || store.getState().core.items[action.uri].tracks)) {
|
||||||
console.info("Using \"".concat(action.uri, "\" from index"));
|
console.info("Using \"".concat(action.uri, "\" from index"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -104667,7 +104658,7 @@ var CoreMiddleware = function () {
|
|||||||
var fetchArtist = function fetchArtist() {
|
var fetchArtist = function fetchArtist() {
|
||||||
switch (Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["uriSource"])(action.uri)) {
|
switch (Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["uriSource"])(action.uri)) {
|
||||||
case 'spotify':
|
case 'spotify':
|
||||||
store.dispatch(spotifyActions.getArtist(action.uri, true, action.forceRefetch));
|
store.dispatch(spotifyActions.getArtist(action.uri, action.options));
|
||||||
|
|
||||||
if (spotify.me) {
|
if (spotify.me) {
|
||||||
store.dispatch(spotifyActions.following(action.uri));
|
store.dispatch(spotifyActions.following(action.uri));
|
||||||
@ -104681,37 +104672,32 @@ var CoreMiddleware = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (action.forceRefetch) {
|
if (action.options.forceRefetch) {
|
||||||
console.info("Force-refetching \"".concat(action.uri, "\""));
|
console.info("Force-refetching \"".concat(action.uri, "\""));
|
||||||
fetchArtist();
|
fetchArtist();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (store.getState().core.items[action.uri] && store.getState().core.items[action.uri].tracks && store.getState().core.items[action.uri].albums_uris && store.getState().core.items[action.uri].images) {
|
if (store.getState().core.items[action.uri] && (!action.options.full || store.getState().core.items[action.uri].tracks && store.getState().core.items[action.uri].albums_uris && store.getState().core.items[action.uri].images)) {
|
||||||
console.info("Using \"".concat(action.uri, "\" from index"));
|
console.info("Using \"".concat(action.uri, "\" from index"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
localforage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem(action.uri).then(function (artist) {
|
localforage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem(action.uri).then(function (artist) {
|
||||||
if (artist) {
|
if (artist) {
|
||||||
console.info("Restoring \"".concat(action.uri, "\" and ").concat(artist.albums_uris.length, " albums from database"));
|
console.info("Restoring \"".concat(action.uri, "\" and ").concat(artist.albums_uris ? artist.albums_uris.length : 0, " albums from database"));
|
||||||
var promises = artist.albums_uris.map(function (albumUri) {
|
store.dispatch(coreActions.restoreItemsFromColdStore([artist]));
|
||||||
return localforage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem(albumUri);
|
|
||||||
});
|
|
||||||
Promise.all(promises).then(function (albums) {
|
|
||||||
return store.dispatch(coreActions.restoreItemsFromColdStore(Object(lodash__WEBPACK_IMPORTED_MODULE_3__["compact"])(albums)));
|
|
||||||
});
|
|
||||||
store.dispatch(coreActions.restoreLibraryFromColdStore(artist));
|
|
||||||
} else {
|
|
||||||
fetchArtist();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
localforage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem(action.uri).then(function (result) {
|
|
||||||
if (result) {
|
|
||||||
console.info("Restoring \"".concat(action.uri, "\" from database"));
|
|
||||||
store.dispatch(coreActions.restoreItemsFromColdStore([result]));
|
|
||||||
|
|
||||||
if (!result.tracks || !result.albums_uris || !result.images) {
|
if (artist.albums_uris) {
|
||||||
|
var promises = artist.albums_uris.map(function (albumUri) {
|
||||||
|
return localforage__WEBPACK_IMPORTED_MODULE_2___default.a.getItem(albumUri);
|
||||||
|
});
|
||||||
|
Promise.all(promises).then(function (albums) {
|
||||||
|
return store.dispatch(coreActions.restoreItemsFromColdStore(Object(lodash__WEBPACK_IMPORTED_MODULE_3__["compact"])(albums)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (action.options.full && (!artist.tracks || !artist.albums_uris || !artist.images)) {
|
||||||
fetchArtist();
|
fetchArtist();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -104725,7 +104711,7 @@ var CoreMiddleware = function () {
|
|||||||
var fetchPlaylist = function fetchPlaylist() {
|
var fetchPlaylist = function fetchPlaylist() {
|
||||||
switch (Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["uriSource"])(action.uri)) {
|
switch (Object(_util_helpers__WEBPACK_IMPORTED_MODULE_6__["uriSource"])(action.uri)) {
|
||||||
case 'spotify':
|
case 'spotify':
|
||||||
store.dispatch(spotifyActions.getPlaylist(action.uri, action.forceRefetch));
|
store.dispatch(spotifyActions.getPlaylist(action.uri, action.options));
|
||||||
|
|
||||||
if (spotify.me) {
|
if (spotify.me) {
|
||||||
store.dispatch(spotifyActions.following(action.uri));
|
store.dispatch(spotifyActions.following(action.uri));
|
||||||
@ -104739,13 +104725,13 @@ var CoreMiddleware = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (action.forceRefetch) {
|
if (action.options.forceRefetch) {
|
||||||
console.info("Force-refetching \"".concat(action.uri, "\""));
|
console.info("Force-refetching \"".concat(action.uri, "\""));
|
||||||
fetchPlaylist();
|
fetchPlaylist();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (store.getState().core.items[action.uri] && store.getState().core.items[action.uri].tracks) {
|
if (store.getState().core.items[action.uri] && (!action.options.full || store.getState().core.items[action.uri].tracks)) {
|
||||||
console.info("Using \"".concat(action.uri, "\" from index"));
|
console.info("Using \"".concat(action.uri, "\" from index"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -104755,7 +104741,7 @@ var CoreMiddleware = function () {
|
|||||||
console.info("Restoring \"".concat(action.uri, "\" from database"));
|
console.info("Restoring \"".concat(action.uri, "\" from database"));
|
||||||
store.dispatch(coreActions.restoreItemsFromColdStore([result]));
|
store.dispatch(coreActions.restoreItemsFromColdStore([result]));
|
||||||
|
|
||||||
if (!result.tracks) {
|
if (!action.options.full || !result.tracks) {
|
||||||
fetchPlaylist();
|
fetchPlaylist();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -104766,7 +104752,7 @@ var CoreMiddleware = function () {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'LOAD_USER':
|
case 'LOAD_USER':
|
||||||
if (!action.forceRefetch && store.getState().core.users[action.uri] && store.getState().core.users[action.uri].playlists_uris) {
|
if (!action.options.forceRefetch && store.getState().core.users[action.uri] && store.getState().core.users[action.uri].playlists_uris) {
|
||||||
console.info("Loading \"".concat(action.uri, "\" from index"));
|
console.info("Loading \"".concat(action.uri, "\" from index"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -104790,7 +104776,7 @@ var CoreMiddleware = function () {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'LOAD_USER_PLAYLISTS':
|
case 'LOAD_USER_PLAYLISTS':
|
||||||
if (!action.forceRefetch && store.getState().core.users[action.uri] && store.getState().core.users[action.uri].playlists_uris) {
|
if (!action.options.forceRefetch && store.getState().core.users[action.uri] && store.getState().core.users[action.uri].playlists_uris) {
|
||||||
console.info("Loading \"".concat(action.uri, "\" playlists from index"));
|
console.info("Loading \"".concat(action.uri, "\" playlists from index"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -104825,7 +104811,7 @@ var CoreMiddleware = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (action.forceRefetch) {
|
if (action.options.forceRefetch) {
|
||||||
console.info("Force-refetching \"".concat(action.uri, "\""));
|
console.info("Force-refetching \"".concat(action.uri, "\""));
|
||||||
fetchLibrary();
|
fetchLibrary();
|
||||||
break;
|
break;
|
||||||
@ -108536,7 +108522,7 @@ var MopidyMiddleware = function () {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
store.dispatch(coreActions.loadPlaylist(action.uri, false, {
|
store.dispatch(coreActions.loadItem(action.uri, false, {
|
||||||
name: 'play',
|
name: 'play',
|
||||||
shuffle: action.shuffle
|
shuffle: action.shuffle
|
||||||
}));
|
}));
|
||||||
@ -108552,7 +108538,7 @@ var MopidyMiddleware = function () {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
store.dispatch(coreActions.loadPlaylist(action.uri, false, {
|
store.dispatch(coreActions.loadItem(action.uri, false, {
|
||||||
name: 'enqueue',
|
name: 'enqueue',
|
||||||
shuffle: action.shuffle,
|
shuffle: action.shuffle,
|
||||||
play_next: action.play_next,
|
play_next: action.play_next,
|
||||||
@ -113455,9 +113441,9 @@ function getGenres() {
|
|||||||
* @param full boolean (whether we want a full artist object)
|
* @param full boolean (whether we want a full artist object)
|
||||||
* */
|
* */
|
||||||
|
|
||||||
function getArtist(uri) {
|
function getArtist(uri, _ref) {
|
||||||
var full = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
var full = _ref.full,
|
||||||
var forceRefetch = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
forceRefetch = _ref.forceRefetch;
|
||||||
return function (dispatch, getState) {
|
return function (dispatch, getState) {
|
||||||
var endpoint = "artists/".concat(Object(_util_helpers__WEBPACK_IMPORTED_MODULE_2__["getFromUri"])('artistid', uri)).concat(forceRefetch ? "?refetch=".concat(Date.now()) : '');
|
var endpoint = "artists/".concat(Object(_util_helpers__WEBPACK_IMPORTED_MODULE_2__["getFromUri"])('artistid', uri)).concat(forceRefetch ? "?refetch=".concat(Date.now()) : '');
|
||||||
request(dispatch, getState, endpoint, 'GET', false, true).then(function (response) {
|
request(dispatch, getState, endpoint, 'GET', false, true).then(function (response) {
|
||||||
@ -113595,32 +113581,35 @@ function getUserPlaylists(uri) {
|
|||||||
* @oaram uri string
|
* @oaram uri string
|
||||||
* */
|
* */
|
||||||
|
|
||||||
function getAlbum(uri, forceRefetch) {
|
function getAlbum(uri, _ref2) {
|
||||||
|
var full = _ref2.full,
|
||||||
|
forceRefetch = _ref2.forceRefetch;
|
||||||
return function (dispatch, getState) {
|
return function (dispatch, getState) {
|
||||||
var endpoint = "albums/".concat(Object(_util_helpers__WEBPACK_IMPORTED_MODULE_2__["getFromUri"])('albumid', uri)).concat(forceRefetch ? "?refetch=".concat(Date.now()) : '');
|
var endpoint = "albums/".concat(Object(_util_helpers__WEBPACK_IMPORTED_MODULE_2__["getFromUri"])('albumid', uri)).concat(forceRefetch ? "?refetch=".concat(Date.now()) : '');
|
||||||
request(dispatch, getState, endpoint).then(function (response) {
|
request(dispatch, getState, endpoint).then(function (response) {
|
||||||
dispatch(coreActions.itemLoaded(_objectSpread(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatAlbum"])(response)), {}, {
|
dispatch(coreActions.itemLoaded(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatAlbum"])(response))));
|
||||||
tracks: Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatTracks"])(response.tracks.items)
|
|
||||||
})));
|
|
||||||
var tracks = Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatTracks"])(response.tracks.items);
|
|
||||||
|
|
||||||
var fetchTracks = function fetchTracks(endpoint) {
|
if (full) {
|
||||||
return request(dispatch, getState, endpoint).then(function (response) {
|
var tracks = Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatTracks"])(response.tracks.items);
|
||||||
tracks = [].concat(_toConsumableArray(tracks), _toConsumableArray(Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatTracks"])(response.items)));
|
|
||||||
|
|
||||||
if (response.next) {
|
var fetchTracks = function fetchTracks(endpoint) {
|
||||||
fetchTracks(response.next);
|
return request(dispatch, getState, endpoint).then(function (response) {
|
||||||
} else {
|
tracks = [].concat(_toConsumableArray(tracks), _toConsumableArray(Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatTracks"])(response.items)));
|
||||||
dispatch(coreActions.itemLoaded({
|
|
||||||
uri: uri,
|
|
||||||
tracks: tracks
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (response.tracks.next) {
|
if (response.next) {
|
||||||
fetchTracks(response.tracks.next);
|
fetchTracks(response.next);
|
||||||
|
} else {
|
||||||
|
dispatch(coreActions.itemLoaded({
|
||||||
|
uri: uri,
|
||||||
|
tracks: tracks
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
if (response.tracks.next) {
|
||||||
|
fetchTracks(response.tracks.next);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
dispatch(coreActions.handleException('Could not load album', error));
|
dispatch(coreActions.handleException('Could not load album', error));
|
||||||
@ -113704,9 +113693,10 @@ function savePlaylist(uri, name, description, is_public, is_collaborative, image
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function getPlaylist(uri) {
|
function getPlaylist(uri, _ref3) {
|
||||||
var forceRefetch = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
var full = _ref3.full,
|
||||||
var callbackAction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
forceRefetch = _ref3.forceRefetch,
|
||||||
|
callbackAction = _ref3.callbackAction;
|
||||||
return function (dispatch, getState) {
|
return function (dispatch, getState) {
|
||||||
var endpoint = "playlists/".concat(Object(_util_helpers__WEBPACK_IMPORTED_MODULE_2__["getFromUri"])('playlistid', uri), "?market=").concat(getState().spotify.country).concat(forceRefetch ? "&refetch=".concat(Date.now()) : '');
|
var endpoint = "playlists/".concat(Object(_util_helpers__WEBPACK_IMPORTED_MODULE_2__["getFromUri"])('playlistid', uri), "?market=").concat(getState().spotify.country).concat(forceRefetch ? "&refetch=".concat(Date.now()) : '');
|
||||||
request(dispatch, getState, endpoint).then(function (response) {
|
request(dispatch, getState, endpoint).then(function (response) {
|
||||||
@ -113723,43 +113713,46 @@ function getPlaylist(uri) {
|
|||||||
|
|
||||||
dispatch(coreActions.itemLoaded(_objectSpread(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatPlaylist"])(response)), {}, {
|
dispatch(coreActions.itemLoaded(_objectSpread(_objectSpread({}, Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatPlaylist"])(response)), {}, {
|
||||||
can_edit: getState().spotify.me && getState().spotify.me.id === response.owner.id,
|
can_edit: getState().spotify.me && getState().spotify.me.id === response.owner.id,
|
||||||
tracks: tracks,
|
|
||||||
description: description
|
description: description
|
||||||
})));
|
})));
|
||||||
|
|
||||||
var fetchTracks = function fetchTracks(endpoint) {
|
if (full) {
|
||||||
return request(dispatch, getState, endpoint).then(function (response) {
|
var fetchTracks = function fetchTracks(endpoint) {
|
||||||
tracks = [].concat(_toConsumableArray(tracks), _toConsumableArray(Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatTracks"])(response.items)));
|
return request(dispatch, getState, endpoint).then(function (response) {
|
||||||
|
tracks = [].concat(_toConsumableArray(tracks), _toConsumableArray(Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatTracks"])(response.items)));
|
||||||
|
|
||||||
if (response.next) {
|
if (response.next) {
|
||||||
fetchTracks(response.next);
|
fetchTracks(response.next);
|
||||||
} else {
|
} else {
|
||||||
dispatch(coreActions.itemLoaded({
|
dispatch(coreActions.itemLoaded({
|
||||||
uri: uri,
|
uri: uri,
|
||||||
tracks: tracks
|
tracks: tracks
|
||||||
}));
|
}));
|
||||||
|
|
||||||
if (callbackAction) {
|
if (callbackAction) {
|
||||||
switch (callbackAction.name) {
|
switch (callbackAction.name) {
|
||||||
case 'enqueue':
|
case 'enqueue':
|
||||||
dispatch(mopidyActions.enqueueURIs(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_1__["arrayOf"])('uri', tracks), uri, callbackAction.play_next, callbackAction.at_position, callbackAction.offset));
|
dispatch(mopidyActions.enqueueURIs(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_1__["arrayOf"])('uri', tracks), uri, callbackAction.play_next, callbackAction.at_position, callbackAction.offset));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'play':
|
case 'play':
|
||||||
dispatch(mopidyActions.playURIs(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_1__["arrayOf"])('uri', tracks), uri, callbackAction.shuffle));
|
dispatch(mopidyActions.playURIs(Object(_util_arrays__WEBPACK_IMPORTED_MODULE_1__["arrayOf"])('uri', tracks), uri, callbackAction.shuffle));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
};
|
||||||
};
|
|
||||||
|
|
||||||
if (response.tracks.next) {
|
if (response.tracks.next) {
|
||||||
fetchTracks(response.tracks.next);
|
fetchTracks(response.tracks.next);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
;
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
dispatch(coreActions.handleException('Could not load playlist', error));
|
dispatch(coreActions.handleException('Could not load playlist', error));
|
||||||
});
|
});
|
||||||
@ -114012,7 +114005,8 @@ function getLibraryPlaylists(forceRefetch) {
|
|||||||
return request(dispatch, getState, endpoint).then(function (response) {
|
return request(dispatch, getState, endpoint).then(function (response) {
|
||||||
var items = response.items.map(function (item) {
|
var items = response.items.map(function (item) {
|
||||||
return _objectSpread(_objectSpread({}, item), {}, {
|
return _objectSpread(_objectSpread({}, item), {}, {
|
||||||
in_library: true
|
in_library: true,
|
||||||
|
can_edit: getState().spotify.me && item.owner.id === getState().spotify.me.id
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
libraryItems = [].concat(_toConsumableArray(libraryItems), _toConsumableArray(Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatPlaylists"])(items)));
|
libraryItems = [].concat(_toConsumableArray(libraryItems), _toConsumableArray(Object(_util_format__WEBPACK_IMPORTED_MODULE_3__["formatPlaylists"])(items)));
|
||||||
@ -118645,8 +118639,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony import */ var _services_spotify_actions__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../services/spotify/actions */ "./src/js/services/spotify/actions.js");
|
/* harmony import */ var _services_spotify_actions__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../services/spotify/actions */ "./src/js/services/spotify/actions.js");
|
||||||
/* harmony import */ var _services_lastfm_actions__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../services/lastfm/actions */ "./src/js/services/lastfm/actions.js");
|
/* harmony import */ var _services_lastfm_actions__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../services/lastfm/actions */ "./src/js/services/lastfm/actions.js");
|
||||||
/* harmony import */ var _util_helpers__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../util/helpers */ "./src/js/util/helpers.js");
|
/* harmony import */ var _util_helpers__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../util/helpers */ "./src/js/util/helpers.js");
|
||||||
/* harmony import */ var _util_format__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../util/format */ "./src/js/util/format.js");
|
/* harmony import */ var _components_Button__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../components/Button */ "./src/js/components/Button.js");
|
||||||
/* harmony import */ var _components_Button__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../components/Button */ "./src/js/components/Button.js");
|
|
||||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||||
|
|
||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
@ -118687,7 +118680,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var Album = /*#__PURE__*/function (_React$Component) {
|
var Album = /*#__PURE__*/function (_React$Component) {
|
||||||
@ -118710,12 +118702,14 @@ var Album = /*#__PURE__*/function (_React$Component) {
|
|||||||
var _this$props = _this.props,
|
var _this$props = _this.props,
|
||||||
uri = _this$props.uri,
|
uri = _this$props.uri,
|
||||||
album = _this$props.album,
|
album = _this$props.album,
|
||||||
loadAlbum = _this$props.coreActions.loadAlbum,
|
loadItem = _this$props.coreActions.loadItem,
|
||||||
getAlbum = _this$props.lastfmActions.getAlbum;
|
getAlbum = _this$props.lastfmActions.getAlbum;
|
||||||
|
|
||||||
_this.setWindowTitle();
|
_this.setWindowTitle();
|
||||||
|
|
||||||
loadAlbum(uri);
|
loadItem(uri, {
|
||||||
|
full: true
|
||||||
|
});
|
||||||
|
|
||||||
if (album) {
|
if (album) {
|
||||||
if (album.artists && album.wiki === undefined) {
|
if (album.artists && album.wiki === undefined) {
|
||||||
@ -118741,11 +118735,13 @@ var Album = /*#__PURE__*/function (_React$Component) {
|
|||||||
var _this$props3 = _this.props,
|
var _this$props3 = _this.props,
|
||||||
uri = _this$props3.uri,
|
uri = _this$props3.uri,
|
||||||
album = _this$props3.album,
|
album = _this$props3.album,
|
||||||
loadAlbum = _this$props3.coreActions.loadAlbum,
|
loadItem = _this$props3.coreActions.loadItem,
|
||||||
getAlbum = _this$props3.lastfmActions.getAlbum;
|
getAlbum = _this$props3.lastfmActions.getAlbum;
|
||||||
|
|
||||||
if (uri !== prevUri) {
|
if (uri !== prevUri) {
|
||||||
loadAlbum(uri);
|
loadItem(uri, {
|
||||||
|
full: true
|
||||||
|
});
|
||||||
} // We have just received our full album or our album artists
|
} // We have just received our full album or our album artists
|
||||||
|
|
||||||
|
|
||||||
@ -118940,7 +118936,7 @@ var Album = /*#__PURE__*/function (_React$Component) {
|
|||||||
className: "actions",
|
className: "actions",
|
||||||
"data-qa-node": "div",
|
"data-qa-node": "div",
|
||||||
"data-qa-file": "Album"
|
"data-qa-file": "Album"
|
||||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_Button__WEBPACK_IMPORTED_MODULE_22__["default"], {
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_Button__WEBPACK_IMPORTED_MODULE_21__["default"], {
|
||||||
type: "primary",
|
type: "primary",
|
||||||
onClick: _this.play,
|
onClick: _this.play,
|
||||||
tracking: {
|
tracking: {
|
||||||
@ -119152,10 +119148,12 @@ var Artist = /*#__PURE__*/function (_React$Component) {
|
|||||||
var _this$props = _this.props,
|
var _this$props = _this.props,
|
||||||
uri = _this$props.uri,
|
uri = _this$props.uri,
|
||||||
artist = _this$props.artist,
|
artist = _this$props.artist,
|
||||||
loadArtist = _this$props.coreActions.loadArtist;
|
loadItem = _this$props.coreActions.loadItem;
|
||||||
|
|
||||||
if (uri !== prevUri) {
|
if (uri !== prevUri) {
|
||||||
loadArtist(uri);
|
loadItem(uri, {
|
||||||
|
full: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prevArtist && artist) _this.setWindowTitle(artist);
|
if (!prevArtist && artist) _this.setWindowTitle(artist);
|
||||||
@ -119824,7 +119822,9 @@ var Artist = /*#__PURE__*/function (_React$Component) {
|
|||||||
key: "componentDidMount",
|
key: "componentDidMount",
|
||||||
value: function componentDidMount() {
|
value: function componentDidMount() {
|
||||||
this.setWindowTitle();
|
this.setWindowTitle();
|
||||||
this.props.coreActions.loadArtist(this.props.uri);
|
this.props.coreActions.loadItem(this.props.uri, {
|
||||||
|
full: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
@ -120683,8 +120683,7 @@ __webpack_require__.r(__webpack_exports__);
|
|||||||
/* harmony import */ var _services_mopidy_actions__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../services/mopidy/actions */ "./src/js/services/mopidy/actions.js");
|
/* harmony import */ var _services_mopidy_actions__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../services/mopidy/actions */ "./src/js/services/mopidy/actions.js");
|
||||||
/* harmony import */ var _services_spotify_actions__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../services/spotify/actions */ "./src/js/services/spotify/actions.js");
|
/* harmony import */ var _services_spotify_actions__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../services/spotify/actions */ "./src/js/services/spotify/actions.js");
|
||||||
/* harmony import */ var _util_helpers__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../util/helpers */ "./src/js/util/helpers.js");
|
/* harmony import */ var _util_helpers__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../util/helpers */ "./src/js/util/helpers.js");
|
||||||
/* harmony import */ var _util_format__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../util/format */ "./src/js/util/format.js");
|
/* harmony import */ var _locale__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../locale */ "./src/js/locale/index.js");
|
||||||
/* harmony import */ var _locale__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../locale */ "./src/js/locale/index.js");
|
|
||||||
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||||
|
|
||||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||||
@ -120730,7 +120729,6 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var Playlist = /*#__PURE__*/function (_React$Component) {
|
var Playlist = /*#__PURE__*/function (_React$Component) {
|
||||||
@ -120759,7 +120757,9 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uri !== prevUri) {
|
if (uri !== prevUri) {
|
||||||
loadItem(uri);
|
loadItem(uri, {
|
||||||
|
full: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prevPlaylist && playlist) _this.setWindowTitle(playlist);
|
if (!prevPlaylist && playlist) _this.setWindowTitle(playlist);
|
||||||
@ -120769,9 +120769,9 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
_defineProperty(_assertThisInitialized(_this), "setWindowTitle", function () {
|
_defineProperty(_assertThisInitialized(_this), "setWindowTitle", function () {
|
||||||
var playlist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.playlist;
|
var playlist = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.props.playlist;
|
||||||
var setWindowTitle = _this.props.uiActions.setWindowTitle;
|
var setWindowTitle = _this.props.uiActions.setWindowTitle;
|
||||||
setWindowTitle(playlist ? Object(_locale__WEBPACK_IMPORTED_MODULE_22__["i18n"])('playlist.title_window', {
|
setWindowTitle(playlist ? Object(_locale__WEBPACK_IMPORTED_MODULE_21__["i18n"])('playlist.title_window', {
|
||||||
name: playlist.name
|
name: playlist.name
|
||||||
}) : Object(_locale__WEBPACK_IMPORTED_MODULE_22__["i18n"])('playlist.title'));
|
}) : Object(_locale__WEBPACK_IMPORTED_MODULE_21__["i18n"])('playlist.title'));
|
||||||
});
|
});
|
||||||
|
|
||||||
_defineProperty(_assertThisInitialized(_this), "handleContextMenu", function (e) {
|
_defineProperty(_assertThisInitialized(_this), "handleContextMenu", function (e) {
|
||||||
@ -120862,7 +120862,7 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
},
|
},
|
||||||
"data-qa-node": "Button",
|
"data-qa-node": "Button",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_22__["I18n"], {
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_21__["I18n"], {
|
||||||
path: "actions.play",
|
path: "actions.play",
|
||||||
"data-qa-node": "I18n",
|
"data-qa-node": "I18n",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
@ -120874,7 +120874,7 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
},
|
},
|
||||||
"data-qa-node": "Button",
|
"data-qa-node": "Button",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_22__["I18n"], {
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_21__["I18n"], {
|
||||||
path: "actions.edit",
|
path: "actions.edit",
|
||||||
"data-qa-node": "I18n",
|
"data-qa-node": "I18n",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
@ -120906,7 +120906,7 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
},
|
},
|
||||||
"data-qa-node": "Button",
|
"data-qa-node": "Button",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_22__["I18n"], {
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_21__["I18n"], {
|
||||||
path: "actions.play",
|
path: "actions.play",
|
||||||
"data-qa-node": "I18n",
|
"data-qa-node": "I18n",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
@ -120918,7 +120918,7 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
},
|
},
|
||||||
"data-qa-node": "Button",
|
"data-qa-node": "Button",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_22__["I18n"], {
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_21__["I18n"], {
|
||||||
path: "actions.edit",
|
path: "actions.edit",
|
||||||
"data-qa-node": "I18n",
|
"data-qa-node": "I18n",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
@ -120949,7 +120949,7 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
},
|
},
|
||||||
"data-qa-node": "Button",
|
"data-qa-node": "Button",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_22__["I18n"], {
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_21__["I18n"], {
|
||||||
path: "actions.play",
|
path: "actions.play",
|
||||||
"data-qa-node": "I18n",
|
"data-qa-node": "I18n",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
@ -120985,7 +120985,7 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
},
|
},
|
||||||
"data-qa-node": "Button",
|
"data-qa-node": "Button",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_22__["I18n"], {
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_21__["I18n"], {
|
||||||
path: "actions.play",
|
path: "actions.play",
|
||||||
"data-qa-node": "I18n",
|
"data-qa-node": "I18n",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
@ -121030,7 +121030,7 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p", {
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("p", {
|
||||||
"data-qa-node": "p",
|
"data-qa-node": "p",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_22__["I18n"], {
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_21__["I18n"], {
|
||||||
path: "errors.uri_not_found",
|
path: "errors.uri_not_found",
|
||||||
uri: uri,
|
uri: uri,
|
||||||
"data-qa-node": "I18n",
|
"data-qa-node": "I18n",
|
||||||
@ -121098,9 +121098,9 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
}, playlist.user.name)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", {
|
}, playlist.user.name)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", {
|
||||||
"data-qa-node": "li",
|
"data-qa-node": "li",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_22__["I18n"], {
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_21__["I18n"], {
|
||||||
path: "specs.tracks",
|
path: "specs.tracks",
|
||||||
count: playlist.tracks_total || 0,
|
count: playlist.tracks ? playlist.tracks.length : 0,
|
||||||
"data-qa-node": "I18n",
|
"data-qa-node": "I18n",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
})), !slim_mode && playlist.tracks && playlist.tracks_total > 0 && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", {
|
})), !slim_mode && playlist.tracks && playlist.tracks_total > 0 && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", {
|
||||||
@ -121114,7 +121114,7 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
})), !slim_mode && playlist.followers !== undefined && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", {
|
})), !slim_mode && playlist.followers !== undefined && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", {
|
||||||
"data-qa-node": "li",
|
"data-qa-node": "li",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_22__["I18n"], {
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_21__["I18n"], {
|
||||||
path: "specs.followers",
|
path: "specs.followers",
|
||||||
count: Object(_components_NiceNumber__WEBPACK_IMPORTED_MODULE_8__["nice_number"])(playlist.followers),
|
count: Object(_components_NiceNumber__WEBPACK_IMPORTED_MODULE_8__["nice_number"])(playlist.followers),
|
||||||
"data-qa-node": "I18n",
|
"data-qa-node": "I18n",
|
||||||
@ -121122,7 +121122,7 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
})), !slim_mode && playlist.last_modified_date && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", {
|
})), !slim_mode && playlist.last_modified_date && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("li", {
|
||||||
"data-qa-node": "li",
|
"data-qa-node": "li",
|
||||||
"data-qa-file": "Playlist"
|
"data-qa-file": "Playlist"
|
||||||
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_22__["I18n"], {
|
}, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_locale__WEBPACK_IMPORTED_MODULE_21__["I18n"], {
|
||||||
path: "specs.edited",
|
path: "specs.edited",
|
||||||
date: Object(_components_Dater__WEBPACK_IMPORTED_MODULE_9__["dater"])('ago', playlist.last_modified_date),
|
date: Object(_components_Dater__WEBPACK_IMPORTED_MODULE_9__["dater"])('ago', playlist.last_modified_date),
|
||||||
"data-qa-node": "I18n",
|
"data-qa-node": "I18n",
|
||||||
@ -121166,7 +121166,9 @@ var Playlist = /*#__PURE__*/function (_React$Component) {
|
|||||||
loadItem = _this$props10.coreActions.loadItem,
|
loadItem = _this$props10.coreActions.loadItem,
|
||||||
uri = _this$props10.uri;
|
uri = _this$props10.uri;
|
||||||
this.setWindowTitle();
|
this.setWindowTitle();
|
||||||
loadItem(uri);
|
loadItem(uri, {
|
||||||
|
full: true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
@ -123676,12 +123678,12 @@ var Track = /*#__PURE__*/function (_React$Component) {
|
|||||||
track = _this$props.track,
|
track = _this$props.track,
|
||||||
genius_authorized = _this$props.genius_authorized,
|
genius_authorized = _this$props.genius_authorized,
|
||||||
lastfm_authorized = _this$props.lastfm_authorized,
|
lastfm_authorized = _this$props.lastfm_authorized,
|
||||||
loadTrack = _this$props.coreActions.loadTrack,
|
loadItem = _this$props.coreActions.loadItem,
|
||||||
findTrackLyrics = _this$props.geniusActions.findTrackLyrics,
|
findTrackLyrics = _this$props.geniusActions.findTrackLyrics,
|
||||||
getTrack = _this$props.lastfmActions.getTrack;
|
getTrack = _this$props.lastfmActions.getTrack;
|
||||||
|
|
||||||
if (prevUri !== uri) {
|
if (prevUri !== uri) {
|
||||||
loadTrack(uri);
|
loadItem(uri);
|
||||||
|
|
||||||
if (genius_authorized && track.artists) {
|
if (genius_authorized && track.artists) {
|
||||||
findTrackLyrics(track);
|
findTrackLyrics(track);
|
||||||
@ -124066,10 +124068,10 @@ var Track = /*#__PURE__*/function (_React$Component) {
|
|||||||
var _this$props7 = this.props,
|
var _this$props7 = this.props,
|
||||||
uri = _this$props7.uri,
|
uri = _this$props7.uri,
|
||||||
track = _this$props7.track,
|
track = _this$props7.track,
|
||||||
loadTrack = _this$props7.coreActions.loadTrack,
|
loadItem = _this$props7.coreActions.loadItem,
|
||||||
genius_authorized = _this$props7.genius_authorized,
|
genius_authorized = _this$props7.genius_authorized,
|
||||||
findTrackLyrics = _this$props7.geniusActions.findTrackLyrics;
|
findTrackLyrics = _this$props7.geniusActions.findTrackLyrics;
|
||||||
loadTrack(uri);
|
loadItem(uri);
|
||||||
|
|
||||||
if (track) {
|
if (track) {
|
||||||
this.setWindowTitle(track);
|
this.setWindowTitle(track);
|
||||||
@ -126840,7 +126842,9 @@ var LibraryArtists = /*#__PURE__*/function (_React$Component) {
|
|||||||
source = _this$props2.source,
|
source = _this$props2.source,
|
||||||
loadLibrary = _this$props2.coreActions.loadLibrary;
|
loadLibrary = _this$props2.coreActions.loadLibrary;
|
||||||
if (source !== 'local' && source !== 'all') return;
|
if (source !== 'local' && source !== 'all') return;
|
||||||
loadLibrary('mopidy:library:artists', forceRefetch);
|
loadLibrary('mopidy:library:artists', {
|
||||||
|
forceRefetch: forceRefetch
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
_defineProperty(_assertThisInitialized(_this), "getGoogleLibrary", function () {
|
_defineProperty(_assertThisInitialized(_this), "getGoogleLibrary", function () {
|
||||||
@ -126851,7 +126855,9 @@ var LibraryArtists = /*#__PURE__*/function (_React$Component) {
|
|||||||
loadLibrary = _this$props3.coreActions.loadLibrary;
|
loadLibrary = _this$props3.coreActions.loadLibrary;
|
||||||
if (!google_available) return;
|
if (!google_available) return;
|
||||||
if (source !== 'google' && source !== 'all') return;
|
if (source !== 'google' && source !== 'all') return;
|
||||||
loadLibrary('google:library:artists', forceRefetch);
|
loadLibrary('google:library:artists', {
|
||||||
|
forceRefetch: forceRefetch
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
_defineProperty(_assertThisInitialized(_this), "getSpotifyLibrary", function () {
|
_defineProperty(_assertThisInitialized(_this), "getSpotifyLibrary", function () {
|
||||||
@ -126862,7 +126868,9 @@ var LibraryArtists = /*#__PURE__*/function (_React$Component) {
|
|||||||
loadLibrary = _this$props4.coreActions.loadLibrary;
|
loadLibrary = _this$props4.coreActions.loadLibrary;
|
||||||
if (!spotify_available) return;
|
if (!spotify_available) return;
|
||||||
if (source !== 'spotify' && source !== 'all') return;
|
if (source !== 'spotify' && source !== 'all') return;
|
||||||
loadLibrary('spotify:library:artists', forceRefetch);
|
loadLibrary('spotify:library:artists', {
|
||||||
|
forceRefetch: forceRefetch
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
_defineProperty(_assertThisInitialized(_this), "loadMore", function () {
|
_defineProperty(_assertThisInitialized(_this), "loadMore", function () {
|
||||||
@ -127950,7 +127958,9 @@ var LibraryPlaylists = /*#__PURE__*/function (_React$Component) {
|
|||||||
source = _this$props.source,
|
source = _this$props.source,
|
||||||
loadLibrary = _this$props.coreActions.loadLibrary;
|
loadLibrary = _this$props.coreActions.loadLibrary;
|
||||||
if (source !== 'local' && source !== 'all') return;
|
if (source !== 'local' && source !== 'all') return;
|
||||||
loadLibrary('mopidy:library:playlists', forceRefetch);
|
loadLibrary('mopidy:library:playlists', {
|
||||||
|
forceRefetch: forceRefetch
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
_defineProperty(_assertThisInitialized(_this), "getSpotifyLibrary", function () {
|
_defineProperty(_assertThisInitialized(_this), "getSpotifyLibrary", function () {
|
||||||
@ -127961,7 +127971,9 @@ var LibraryPlaylists = /*#__PURE__*/function (_React$Component) {
|
|||||||
loadLibrary = _this$props2.coreActions.loadLibrary;
|
loadLibrary = _this$props2.coreActions.loadLibrary;
|
||||||
if (!spotify_available) return;
|
if (!spotify_available) return;
|
||||||
if (source !== 'spotify' && source !== 'all') return;
|
if (source !== 'spotify' && source !== 'all') return;
|
||||||
loadLibrary('spotify:library:playlists', forceRefetch);
|
loadLibrary('spotify:library:playlists', {
|
||||||
|
forceRefetch: forceRefetch
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (_ref) {
|
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (_ref) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@ -106,7 +106,7 @@
|
|||||||
|
|
||||||
// Release details
|
// Release details
|
||||||
// These are automatically injected to built HTML
|
// These are automatically injected to built HTML
|
||||||
var build = "1599594817";
|
var build = "1599594930";
|
||||||
var version = "3.52.4";
|
var version = "3.52.4";
|
||||||
|
|
||||||
// Construct the script tag
|
// Construct the script tag
|
||||||
|
|||||||
@ -626,7 +626,7 @@ class ContextMenu extends React.Component {
|
|||||||
|
|
||||||
const uri = uris[0];
|
const uri = uris[0];
|
||||||
|
|
||||||
loadItem(uri, true);
|
loadItem(uri, { forceRefetch: true });
|
||||||
hideContextMenu();
|
hideContextMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1297,13 +1297,13 @@ const mapStateToProps = (state) => ({
|
|||||||
current_tracklist: state.core.current_tracklist,
|
current_tracklist: state.core.current_tracklist,
|
||||||
queue_metadata: state.core.queue_metadata,
|
queue_metadata: state.core.queue_metadata,
|
||||||
spotify_available: state.spotify.access_token,
|
spotify_available: state.spotify.access_token,
|
||||||
spotify_library_playlists: state.core.items['spotify:library:playlists'] || { items_uris: [] },
|
spotify_library_playlists: state.core.libraries['spotify:library:playlists'] || { items_uris: [] },
|
||||||
spotify_library_artists: state.core.items['spotify:library:artists'] || { items_uris: [] },
|
spotify_library_artists: state.core.libraries['spotify:library:artists'] || { items_uris: [] },
|
||||||
spotify_library_albums: state.core.items['spotify:library:albums'] || { items_uris: [] },
|
spotify_library_albums: state.core.libraries['spotify:library:albums'] || { items_uris: [] },
|
||||||
spotify_library_tracks: state.spotify.library_tracks,
|
spotify_library_tracks: state.spotify.library_tracks,
|
||||||
mopidy_library_playlists: state.core.items['mopidy:library:playlists'] || { items_uris: [] },
|
mopidy_library_playlists: state.core.libraries['mopidy:library:playlists'] || { items_uris: [] },
|
||||||
mopidy_library_artists: state.core.items['mopidy:library:artists'] || { items_uris: [] },
|
mopidy_library_artists: state.core.libraries['mopidy:library:artists'] || { items_uris: [] },
|
||||||
mopidy_library_albums: state.core.items['mopidy:library:albums'] || { items_uris: [] },
|
mopidy_library_albums: state.core.libraries['mopidy:library:albums'] || { items_uris: [] },
|
||||||
playlists: state.core.playlists,
|
playlists: state.core.playlists,
|
||||||
tracks: state.core.tracks,
|
tracks: state.core.tracks,
|
||||||
items: state.core.items,
|
items: state.core.items,
|
||||||
|
|||||||
@ -107,75 +107,71 @@ export function updateColdStore(items) {
|
|||||||
* relevant service to load the record - all from one neat package.
|
* relevant service to load the record - all from one neat package.
|
||||||
* */
|
* */
|
||||||
|
|
||||||
export function loadItems(uris, forceRefetch = false, callbackAction = null) {
|
export function loadItems(uris, options = {}) {
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_ITEMS',
|
type: 'LOAD_ITEMS',
|
||||||
uris,
|
uris,
|
||||||
forceRefetch,
|
options,
|
||||||
callbackAction,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadItem(uri, forceRefetch = false, callbackAction) {
|
export function loadItem(uri, options = {}) {
|
||||||
return loadItems([uri], forceRefetch, callbackAction);
|
return loadItems([uri], options);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadTrack(uri, forceRefetch = false) {
|
export function loadTrack(uri, options = {}) {
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_TRACK',
|
type: 'LOAD_TRACK',
|
||||||
uri,
|
uri,
|
||||||
forceRefetch,
|
options,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadAlbum(uri, forceRefetch = false, callbackAction) {
|
export function loadAlbum(uri, options = {}) {
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_ALBUM',
|
type: 'LOAD_ALBUM',
|
||||||
uri,
|
uri,
|
||||||
forceRefetch,
|
options,
|
||||||
callbackAction,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadArtist(uri, forceRefetch = false, callbackAction) {
|
export function loadArtist(uri, options = {}) {
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_ARTIST',
|
type: 'LOAD_ARTIST',
|
||||||
uri,
|
uri,
|
||||||
forceRefetch,
|
options,
|
||||||
callbackAction,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadPlaylist(uri, forceRefetch = false, callbackAction) {
|
export function loadPlaylist(uri, options = {}) {
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_PLAYLIST',
|
type: 'LOAD_PLAYLIST',
|
||||||
uri,
|
uri,
|
||||||
forceRefetch,
|
options,
|
||||||
callbackAction,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadUser(uri, forceRefetch = false) {
|
export function loadUser(uri, options = {}) {
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_USER',
|
type: 'LOAD_USER',
|
||||||
uri,
|
uri,
|
||||||
forceRefetch,
|
options,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadUserPlaylists(uri, forceRefetch = false) {
|
export function loadUserPlaylists(uri, options) {
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_USER_PLAYLISTS',
|
type: 'LOAD_USER_PLAYLISTS',
|
||||||
uri,
|
uri,
|
||||||
forceRefetch,
|
options,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadLibrary(uri, forceRefetch = false) {
|
export function loadLibrary(uri, options = {}) {
|
||||||
return {
|
return {
|
||||||
type: 'LOAD_LIBRARY',
|
type: 'LOAD_LIBRARY',
|
||||||
uri,
|
uri,
|
||||||
forceRefetch,
|
options,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -318,8 +318,7 @@ const CoreMiddleware = (function () {
|
|||||||
store.dispatch({
|
store.dispatch({
|
||||||
type: `LOAD_${uriType(uri).toUpperCase()}`,
|
type: `LOAD_${uriType(uri).toUpperCase()}`,
|
||||||
uri,
|
uri,
|
||||||
forceRefetch: action.forceRefetch,
|
options: action.options,
|
||||||
callbackAction: action.callbackAction,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@ -328,7 +327,7 @@ const CoreMiddleware = (function () {
|
|||||||
const fetchTrack = () => {
|
const fetchTrack = () => {
|
||||||
switch (uriSource(action.uri)) {
|
switch (uriSource(action.uri)) {
|
||||||
case 'spotify':
|
case 'spotify':
|
||||||
store.dispatch(spotifyActions.getTrack(action.uri, action.forceRefetch));
|
store.dispatch(spotifyActions.getTrack(action.uri, action.options));
|
||||||
|
|
||||||
if (spotify.me) {
|
if (spotify.me) {
|
||||||
store.dispatch(spotifyActions.following(action.uri));
|
store.dispatch(spotifyActions.following(action.uri));
|
||||||
@ -341,7 +340,7 @@ const CoreMiddleware = (function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (action.forceRefetch) {
|
if (action.options.forceRefetch) {
|
||||||
console.info(`Force-refetching "${action.uri}"`);
|
console.info(`Force-refetching "${action.uri}"`);
|
||||||
fetchTrack();
|
fetchTrack();
|
||||||
break;
|
break;
|
||||||
@ -375,7 +374,7 @@ const CoreMiddleware = (function () {
|
|||||||
const fetchAlbum = () => {
|
const fetchAlbum = () => {
|
||||||
switch (uriSource(action.uri)) {
|
switch (uriSource(action.uri)) {
|
||||||
case 'spotify':
|
case 'spotify':
|
||||||
store.dispatch(spotifyActions.getAlbum(action.uri, action.forceRefetch));
|
store.dispatch(spotifyActions.getAlbum(action.uri, action.options));
|
||||||
|
|
||||||
if (spotify.me) {
|
if (spotify.me) {
|
||||||
store.dispatch(spotifyActions.following(action.uri));
|
store.dispatch(spotifyActions.following(action.uri));
|
||||||
@ -388,14 +387,14 @@ const CoreMiddleware = (function () {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (action.forceRefetch) {
|
if (action.options.forceRefetch) {
|
||||||
console.info(`Force-refetching "${action.uri}"`);
|
console.info(`Force-refetching "${action.uri}"`);
|
||||||
fetchAlbum();
|
fetchAlbum();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
store.getState().core.items[action.uri]
|
store.getState().core.items[action.uri]
|
||||||
&& store.getState().core.items[action.uri].tracks
|
&& (!action.options.full || store.getState().core.items[action.uri].tracks)
|
||||||
) {
|
) {
|
||||||
console.info(`Using "${action.uri}" from index`);
|
console.info(`Using "${action.uri}" from index`);
|
||||||
break;
|
break;
|
||||||
@ -422,7 +421,7 @@ const CoreMiddleware = (function () {
|
|||||||
const fetchArtist = () => {
|
const fetchArtist = () => {
|
||||||
switch (uriSource(action.uri)) {
|
switch (uriSource(action.uri)) {
|
||||||
case 'spotify':
|
case 'spotify':
|
||||||
store.dispatch(spotifyActions.getArtist(action.uri, true, action.forceRefetch));
|
store.dispatch(spotifyActions.getArtist(action.uri, action.options));
|
||||||
|
|
||||||
if (spotify.me) {
|
if (spotify.me) {
|
||||||
store.dispatch(spotifyActions.following(action.uri));
|
store.dispatch(spotifyActions.following(action.uri));
|
||||||
@ -435,16 +434,21 @@ const CoreMiddleware = (function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (action.forceRefetch) {
|
if (action.options.forceRefetch) {
|
||||||
console.info(`Force-refetching "${action.uri}"`);
|
console.info(`Force-refetching "${action.uri}"`);
|
||||||
fetchArtist();
|
fetchArtist();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
store.getState().core.items[action.uri]
|
store.getState().core.items[action.uri]
|
||||||
&& store.getState().core.items[action.uri].tracks
|
&& (
|
||||||
&& store.getState().core.items[action.uri].albums_uris
|
!action.options.full
|
||||||
&& store.getState().core.items[action.uri].images
|
|| (
|
||||||
|
store.getState().core.items[action.uri].tracks
|
||||||
|
&& store.getState().core.items[action.uri].albums_uris
|
||||||
|
&& store.getState().core.items[action.uri].images
|
||||||
|
)
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
console.info(`Using "${action.uri}" from index`);
|
console.info(`Using "${action.uri}" from index`);
|
||||||
break;
|
break;
|
||||||
@ -452,25 +456,17 @@ const CoreMiddleware = (function () {
|
|||||||
|
|
||||||
localForage.getItem(action.uri).then((artist) => {
|
localForage.getItem(action.uri).then((artist) => {
|
||||||
if (artist) {
|
if (artist) {
|
||||||
console.info(`Restoring "${action.uri}" and ${artist.albums_uris.length} albums from database`);
|
console.info(`Restoring "${action.uri}" and ${artist.albums_uris ? artist.albums_uris.length : 0} albums from database`);
|
||||||
|
store.dispatch(coreActions.restoreItemsFromColdStore([artist]));
|
||||||
|
|
||||||
const promises = artist.albums_uris.map((albumUri) => localForage.getItem(albumUri));
|
if (artist.albums_uris) {
|
||||||
Promise.all(promises).then(
|
const promises = artist.albums_uris.map((albumUri) => localForage.getItem(albumUri));
|
||||||
(albums) => store.dispatch(coreActions.restoreItemsFromColdStore(compact(albums))),
|
Promise.all(promises).then(
|
||||||
);
|
(albums) => store.dispatch(coreActions.restoreItemsFromColdStore(compact(albums))),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
store.dispatch(coreActions.restoreLibraryFromColdStore(artist));
|
if (action.options.full && (!artist.tracks || !artist.albums_uris || !artist.images)) {
|
||||||
} else {
|
|
||||||
fetchArtist();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
localForage.getItem(action.uri).then((result) => {
|
|
||||||
if (result) {
|
|
||||||
console.info(`Restoring "${action.uri}" from database`);
|
|
||||||
store.dispatch(coreActions.restoreItemsFromColdStore([result]));
|
|
||||||
|
|
||||||
if (!result.tracks || !result.albums_uris || !result.images) {
|
|
||||||
fetchArtist();
|
fetchArtist();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -485,7 +481,7 @@ const CoreMiddleware = (function () {
|
|||||||
const fetchPlaylist = () => {
|
const fetchPlaylist = () => {
|
||||||
switch (uriSource(action.uri)) {
|
switch (uriSource(action.uri)) {
|
||||||
case 'spotify':
|
case 'spotify':
|
||||||
store.dispatch(spotifyActions.getPlaylist(action.uri, action.forceRefetch));
|
store.dispatch(spotifyActions.getPlaylist(action.uri, action.options));
|
||||||
|
|
||||||
if (spotify.me) {
|
if (spotify.me) {
|
||||||
store.dispatch(spotifyActions.following(action.uri));
|
store.dispatch(spotifyActions.following(action.uri));
|
||||||
@ -498,14 +494,17 @@ const CoreMiddleware = (function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (action.forceRefetch) {
|
if (action.options.forceRefetch) {
|
||||||
console.info(`Force-refetching "${action.uri}"`);
|
console.info(`Force-refetching "${action.uri}"`);
|
||||||
fetchPlaylist();
|
fetchPlaylist();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
store.getState().core.items[action.uri]
|
store.getState().core.items[action.uri]
|
||||||
&& store.getState().core.items[action.uri].tracks
|
&& (
|
||||||
|
!action.options.full
|
||||||
|
|| store.getState().core.items[action.uri].tracks
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
console.info(`Using "${action.uri}" from index`);
|
console.info(`Using "${action.uri}" from index`);
|
||||||
break;
|
break;
|
||||||
@ -515,7 +514,7 @@ const CoreMiddleware = (function () {
|
|||||||
if (result) {
|
if (result) {
|
||||||
console.info(`Restoring "${action.uri}" from database`);
|
console.info(`Restoring "${action.uri}" from database`);
|
||||||
store.dispatch(coreActions.restoreItemsFromColdStore([result]));
|
store.dispatch(coreActions.restoreItemsFromColdStore([result]));
|
||||||
if (!result.tracks) {
|
if (!action.options.full || !result.tracks) {
|
||||||
fetchPlaylist();
|
fetchPlaylist();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -528,7 +527,7 @@ const CoreMiddleware = (function () {
|
|||||||
|
|
||||||
case 'LOAD_USER':
|
case 'LOAD_USER':
|
||||||
if (
|
if (
|
||||||
!action.forceRefetch
|
!action.options.forceRefetch
|
||||||
&& store.getState().core.users[action.uri]
|
&& store.getState().core.users[action.uri]
|
||||||
&& store.getState().core.users[action.uri].playlists_uris) {
|
&& store.getState().core.users[action.uri].playlists_uris) {
|
||||||
console.info(`Loading "${action.uri}" from index`);
|
console.info(`Loading "${action.uri}" from index`);
|
||||||
@ -554,7 +553,7 @@ const CoreMiddleware = (function () {
|
|||||||
|
|
||||||
case 'LOAD_USER_PLAYLISTS':
|
case 'LOAD_USER_PLAYLISTS':
|
||||||
if (
|
if (
|
||||||
!action.forceRefetch
|
!action.options.forceRefetch
|
||||||
&& store.getState().core.users[action.uri]
|
&& store.getState().core.users[action.uri]
|
||||||
&& store.getState().core.users[action.uri].playlists_uris) {
|
&& store.getState().core.users[action.uri].playlists_uris) {
|
||||||
console.info(`Loading "${action.uri}" playlists from index`);
|
console.info(`Loading "${action.uri}" playlists from index`);
|
||||||
@ -595,7 +594,7 @@ const CoreMiddleware = (function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (action.forceRefetch) {
|
if (action.options.forceRefetch) {
|
||||||
console.info(`Force-refetching "${action.uri}"`);
|
console.info(`Force-refetching "${action.uri}"`);
|
||||||
fetchLibrary();
|
fetchLibrary();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -665,7 +665,7 @@ const MopidyMiddleware = (function () {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
coreActions.loadPlaylist(
|
coreActions.loadItem(
|
||||||
action.uri,
|
action.uri,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
@ -690,7 +690,7 @@ const MopidyMiddleware = (function () {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
store.dispatch(
|
store.dispatch(
|
||||||
coreActions.loadPlaylist(
|
coreActions.loadItem(
|
||||||
action.uri,
|
action.uri,
|
||||||
false,
|
false,
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1035,7 +1035,7 @@ export function getGenres() {
|
|||||||
* @param uri string
|
* @param uri string
|
||||||
* @param full boolean (whether we want a full artist object)
|
* @param full boolean (whether we want a full artist object)
|
||||||
* */
|
* */
|
||||||
export function getArtist(uri, full = false, forceRefetch = false) {
|
export function getArtist(uri, { full, forceRefetch }) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const endpoint = `artists/${getFromUri('artistid', uri)}${forceRefetch ? `?refetch=${Date.now()}` : ''}`;
|
const endpoint = `artists/${getFromUri('artistid', uri)}${forceRefetch ? `?refetch=${Date.now()}` : ''}`;
|
||||||
request(dispatch, getState, endpoint, 'GET', false, true)
|
request(dispatch, getState, endpoint, 'GET', false, true)
|
||||||
@ -1203,7 +1203,7 @@ export function getUserPlaylists(uri) {
|
|||||||
*
|
*
|
||||||
* @oaram uri string
|
* @oaram uri string
|
||||||
* */
|
* */
|
||||||
export function getAlbum(uri, forceRefetch) {
|
export function getAlbum(uri, { full, forceRefetch }) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const endpoint = `albums/${getFromUri('albumid', uri)}${forceRefetch ? `?refetch=${Date.now()}` : ''}`;
|
const endpoint = `albums/${getFromUri('albumid', uri)}${forceRefetch ? `?refetch=${Date.now()}` : ''}`;
|
||||||
request(dispatch, getState, endpoint)
|
request(dispatch, getState, endpoint)
|
||||||
@ -1211,25 +1211,26 @@ export function getAlbum(uri, forceRefetch) {
|
|||||||
(response) => {
|
(response) => {
|
||||||
dispatch(coreActions.itemLoaded({
|
dispatch(coreActions.itemLoaded({
|
||||||
...formatAlbum(response),
|
...formatAlbum(response),
|
||||||
tracks: formatTracks(response.tracks.items),
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let tracks = formatTracks(response.tracks.items);
|
if (full) {
|
||||||
const fetchTracks = (endpoint) => request(dispatch, getState, endpoint)
|
let tracks = formatTracks(response.tracks.items);
|
||||||
.then((response) => {
|
const fetchTracks = (endpoint) => request(dispatch, getState, endpoint)
|
||||||
tracks = [...tracks, ...formatTracks(response.items)];
|
.then((response) => {
|
||||||
if (response.next) {
|
tracks = [...tracks, ...formatTracks(response.items)];
|
||||||
fetchTracks(response.next);
|
if (response.next) {
|
||||||
} else {
|
fetchTracks(response.next);
|
||||||
dispatch(coreActions.itemLoaded({
|
} else {
|
||||||
uri,
|
dispatch(coreActions.itemLoaded({
|
||||||
tracks,
|
uri,
|
||||||
}));
|
tracks,
|
||||||
}
|
}));
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (response.tracks.next) {
|
if (response.tracks.next) {
|
||||||
fetchTracks(response.tracks.next);
|
fetchTracks(response.tracks.next);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
@ -1349,7 +1350,7 @@ export function savePlaylist(uri, name, description, is_public, is_collaborative
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPlaylist(uri, forceRefetch = false, callbackAction = null) {
|
export function getPlaylist(uri, { full, forceRefetch, callbackAction }) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const endpoint = `playlists/${getFromUri('playlistid', uri)}?market=${getState().spotify.country}${forceRefetch ? `&refetch=${Date.now()}` : ''}`;
|
const endpoint = `playlists/${getFromUri('playlistid', uri)}?market=${getState().spotify.country}${forceRefetch ? `&refetch=${Date.now()}` : ''}`;
|
||||||
request(dispatch, getState, endpoint)
|
request(dispatch, getState, endpoint)
|
||||||
@ -1369,49 +1370,50 @@ export function getPlaylist(uri, forceRefetch = false, callbackAction = null) {
|
|||||||
dispatch(coreActions.itemLoaded({
|
dispatch(coreActions.itemLoaded({
|
||||||
...formatPlaylist(response),
|
...formatPlaylist(response),
|
||||||
can_edit: (getState().spotify.me && getState().spotify.me.id === response.owner.id),
|
can_edit: (getState().spotify.me && getState().spotify.me.id === response.owner.id),
|
||||||
tracks,
|
|
||||||
description,
|
description,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const fetchTracks = (endpoint) => request(dispatch, getState, endpoint)
|
if (full) {
|
||||||
.then((response) => {
|
const fetchTracks = (endpoint) => request(dispatch, getState, endpoint)
|
||||||
tracks = [...tracks, ...formatTracks(response.items)];
|
.then((response) => {
|
||||||
if (response.next) {
|
tracks = [...tracks, ...formatTracks(response.items)];
|
||||||
fetchTracks(response.next);
|
if (response.next) {
|
||||||
} else {
|
fetchTracks(response.next);
|
||||||
dispatch(coreActions.itemLoaded({
|
} else {
|
||||||
uri,
|
dispatch(coreActions.itemLoaded({
|
||||||
tracks,
|
uri,
|
||||||
}));
|
tracks,
|
||||||
|
}));
|
||||||
|
|
||||||
if (callbackAction) {
|
if (callbackAction) {
|
||||||
switch (callbackAction.name) {
|
switch (callbackAction.name) {
|
||||||
case 'enqueue':
|
case 'enqueue':
|
||||||
dispatch(mopidyActions.enqueueURIs(
|
dispatch(mopidyActions.enqueueURIs(
|
||||||
arrayOf('uri', tracks),
|
arrayOf('uri', tracks),
|
||||||
uri,
|
uri,
|
||||||
callbackAction.play_next,
|
callbackAction.play_next,
|
||||||
callbackAction.at_position,
|
callbackAction.at_position,
|
||||||
callbackAction.offset,
|
callbackAction.offset,
|
||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
case 'play':
|
case 'play':
|
||||||
dispatch(mopidyActions.playURIs(
|
dispatch(mopidyActions.playURIs(
|
||||||
arrayOf('uri', tracks),
|
arrayOf('uri', tracks),
|
||||||
uri,
|
uri,
|
||||||
callbackAction.shuffle,
|
callbackAction.shuffle,
|
||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
|
||||||
|
|
||||||
if (response.tracks.next) {
|
if (response.tracks.next) {
|
||||||
fetchTracks(response.tracks.next);
|
fetchTracks(response.tracks.next);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
},
|
},
|
||||||
(error) => {
|
(error) => {
|
||||||
dispatch(coreActions.handleException(
|
dispatch(coreActions.handleException(
|
||||||
@ -1722,7 +1724,11 @@ export function getLibraryPlaylists(forceRefetch) {
|
|||||||
const fetchLibraryPlaylists = (endpoint) => request(dispatch, getState, endpoint)
|
const fetchLibraryPlaylists = (endpoint) => request(dispatch, getState, endpoint)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const items = response.items.map(
|
const items = response.items.map(
|
||||||
(item) => ({ ...item, in_library: true }),
|
(item) => ({
|
||||||
|
...item,
|
||||||
|
in_library: true,
|
||||||
|
can_edit: (getState().spotify.me && item.owner.id === getState().spotify.me.id),
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
libraryItems = [...libraryItems, ...formatPlaylists(items)];
|
libraryItems = [...libraryItems, ...formatPlaylists(items)];
|
||||||
if (response.next) {
|
if (response.next) {
|
||||||
|
|||||||
@ -25,7 +25,6 @@ import {
|
|||||||
isLoading,
|
isLoading,
|
||||||
sourceIcon,
|
sourceIcon,
|
||||||
} from '../util/helpers';
|
} from '../util/helpers';
|
||||||
import { collate } from '../util/format';
|
|
||||||
import Button from '../components/Button';
|
import Button from '../components/Button';
|
||||||
|
|
||||||
export class Album extends React.Component {
|
export class Album extends React.Component {
|
||||||
@ -34,7 +33,7 @@ export class Album extends React.Component {
|
|||||||
uri,
|
uri,
|
||||||
album,
|
album,
|
||||||
coreActions: {
|
coreActions: {
|
||||||
loadAlbum,
|
loadItem,
|
||||||
},
|
},
|
||||||
lastfmActions: {
|
lastfmActions: {
|
||||||
getAlbum,
|
getAlbum,
|
||||||
@ -42,7 +41,7 @@ export class Album extends React.Component {
|
|||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
this.setWindowTitle();
|
this.setWindowTitle();
|
||||||
loadAlbum(uri);
|
loadItem(uri, { full: true });
|
||||||
|
|
||||||
if (album) {
|
if (album) {
|
||||||
if (album.artists && album.wiki === undefined) {
|
if (album.artists && album.wiki === undefined) {
|
||||||
@ -72,7 +71,7 @@ export class Album extends React.Component {
|
|||||||
uri,
|
uri,
|
||||||
album,
|
album,
|
||||||
coreActions: {
|
coreActions: {
|
||||||
loadAlbum,
|
loadItem,
|
||||||
},
|
},
|
||||||
lastfmActions: {
|
lastfmActions: {
|
||||||
getAlbum,
|
getAlbum,
|
||||||
@ -80,7 +79,7 @@ export class Album extends React.Component {
|
|||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (uri !== prevUri) {
|
if (uri !== prevUri) {
|
||||||
loadAlbum(uri);
|
loadItem(uri, { full: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
// We have just received our full album or our album artists
|
// We have just received our full album or our album artists
|
||||||
|
|||||||
@ -36,7 +36,7 @@ import { trackEvent } from '../components/Trackable';
|
|||||||
class Artist extends React.Component {
|
class Artist extends React.Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.setWindowTitle();
|
this.setWindowTitle();
|
||||||
this.props.coreActions.loadArtist(this.props.uri);
|
this.props.coreActions.loadItem(this.props.uri, { full: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate = ({
|
componentDidUpdate = ({
|
||||||
@ -47,12 +47,12 @@ class Artist extends React.Component {
|
|||||||
uri,
|
uri,
|
||||||
artist,
|
artist,
|
||||||
coreActions: {
|
coreActions: {
|
||||||
loadArtist,
|
loadItem,
|
||||||
},
|
},
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (uri !== prevUri) {
|
if (uri !== prevUri) {
|
||||||
loadArtist(uri);
|
loadItem(uri, { full: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prevArtist && artist) this.setWindowTitle(artist);
|
if (!prevArtist && artist) this.setWindowTitle(artist);
|
||||||
|
|||||||
@ -26,7 +26,6 @@ import {
|
|||||||
sourceIcon,
|
sourceIcon,
|
||||||
decodeMopidyUri,
|
decodeMopidyUri,
|
||||||
} from '../util/helpers';
|
} from '../util/helpers';
|
||||||
import { collate } from '../util/format';
|
|
||||||
import { i18n, I18n } from '../locale';
|
import { i18n, I18n } from '../locale';
|
||||||
|
|
||||||
class Playlist extends React.Component {
|
class Playlist extends React.Component {
|
||||||
@ -46,7 +45,7 @@ class Playlist extends React.Component {
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { coreActions: { loadItem }, uri } = this.props;
|
const { coreActions: { loadItem }, uri } = this.props;
|
||||||
this.setWindowTitle();
|
this.setWindowTitle();
|
||||||
loadItem(uri);
|
loadItem(uri, { full: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate = ({
|
componentDidUpdate = ({
|
||||||
@ -69,7 +68,7 @@ class Playlist extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (uri !== prevUri) {
|
if (uri !== prevUri) {
|
||||||
loadItem(uri);
|
loadItem(uri, { full: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!prevPlaylist && playlist) this.setWindowTitle(playlist);
|
if (!prevPlaylist && playlist) this.setWindowTitle(playlist);
|
||||||
@ -330,7 +329,7 @@ class Playlist extends React.Component {
|
|||||||
</li>
|
</li>
|
||||||
)}
|
)}
|
||||||
<li>
|
<li>
|
||||||
<I18n path="specs.tracks" count={playlist.tracks_total || 0} />
|
<I18n path="specs.tracks" count={playlist.tracks ? playlist.tracks.length : 0} />
|
||||||
</li>
|
</li>
|
||||||
{!slim_mode && playlist.tracks && playlist.tracks_total > 0 && (
|
{!slim_mode && playlist.tracks && playlist.tracks_total > 0 && (
|
||||||
<li><Dater type="total-time" data={playlist.tracks} /></li>
|
<li><Dater type="total-time" data={playlist.tracks} /></li>
|
||||||
|
|||||||
@ -34,12 +34,14 @@ class Track extends React.Component {
|
|||||||
const {
|
const {
|
||||||
uri,
|
uri,
|
||||||
track,
|
track,
|
||||||
coreActions: { loadTrack },
|
coreActions: {
|
||||||
|
loadItem,
|
||||||
|
},
|
||||||
genius_authorized,
|
genius_authorized,
|
||||||
geniusActions: { findTrackLyrics },
|
geniusActions: { findTrackLyrics },
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
loadTrack(uri);
|
loadItem(uri);
|
||||||
|
|
||||||
if (track) {
|
if (track) {
|
||||||
this.setWindowTitle(track);
|
this.setWindowTitle(track);
|
||||||
@ -60,7 +62,7 @@ class Track extends React.Component {
|
|||||||
genius_authorized,
|
genius_authorized,
|
||||||
lastfm_authorized,
|
lastfm_authorized,
|
||||||
coreActions: {
|
coreActions: {
|
||||||
loadTrack,
|
loadItem,
|
||||||
},
|
},
|
||||||
geniusActions: {
|
geniusActions: {
|
||||||
findTrackLyrics,
|
findTrackLyrics,
|
||||||
@ -71,7 +73,7 @@ class Track extends React.Component {
|
|||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
if (prevUri !== uri) {
|
if (prevUri !== uri) {
|
||||||
loadTrack(uri);
|
loadItem(uri);
|
||||||
|
|
||||||
if (genius_authorized && track.artists) {
|
if (genius_authorized && track.artists) {
|
||||||
findTrackLyrics(track);
|
findTrackLyrics(track);
|
||||||
|
|||||||
@ -101,7 +101,7 @@ class LibraryArtists extends React.Component {
|
|||||||
|
|
||||||
if (source !== 'local' && source !== 'all') return;
|
if (source !== 'local' && source !== 'all') return;
|
||||||
|
|
||||||
loadLibrary('mopidy:library:artists', forceRefetch);
|
loadLibrary('mopidy:library:artists', { forceRefetch });
|
||||||
};
|
};
|
||||||
|
|
||||||
getGoogleLibrary = (forceRefetch = false) => {
|
getGoogleLibrary = (forceRefetch = false) => {
|
||||||
@ -116,7 +116,7 @@ class LibraryArtists extends React.Component {
|
|||||||
if (!google_available) return;
|
if (!google_available) return;
|
||||||
if (source !== 'google' && source !== 'all') return;
|
if (source !== 'google' && source !== 'all') return;
|
||||||
|
|
||||||
loadLibrary('google:library:artists', forceRefetch);
|
loadLibrary('google:library:artists', { forceRefetch });
|
||||||
};
|
};
|
||||||
|
|
||||||
getSpotifyLibrary = (forceRefetch = false) => {
|
getSpotifyLibrary = (forceRefetch = false) => {
|
||||||
@ -131,7 +131,7 @@ class LibraryArtists extends React.Component {
|
|||||||
if (!spotify_available) return;
|
if (!spotify_available) return;
|
||||||
if (source !== 'spotify' && source !== 'all') return;
|
if (source !== 'spotify' && source !== 'all') return;
|
||||||
|
|
||||||
loadLibrary('spotify:library:artists', forceRefetch);
|
loadLibrary('spotify:library:artists', { forceRefetch });
|
||||||
};
|
};
|
||||||
|
|
||||||
loadMore = () => {
|
loadMore = () => {
|
||||||
|
|||||||
@ -70,7 +70,7 @@ class LibraryPlaylists extends React.Component {
|
|||||||
|
|
||||||
if (source !== 'local' && source !== 'all') return;
|
if (source !== 'local' && source !== 'all') return;
|
||||||
|
|
||||||
loadLibrary('mopidy:library:playlists', forceRefetch);
|
loadLibrary('mopidy:library:playlists', { forceRefetch });
|
||||||
};
|
};
|
||||||
|
|
||||||
getSpotifyLibrary = (forceRefetch = false) => {
|
getSpotifyLibrary = (forceRefetch = false) => {
|
||||||
@ -85,7 +85,7 @@ class LibraryPlaylists extends React.Component {
|
|||||||
if (!spotify_available) return;
|
if (!spotify_available) return;
|
||||||
if (source !== 'spotify' && source !== 'all') return;
|
if (source !== 'spotify' && source !== 'all') return;
|
||||||
|
|
||||||
loadLibrary('spotify:library:playlists', forceRefetch);
|
loadLibrary('spotify:library:playlists', { forceRefetch });
|
||||||
};
|
};
|
||||||
|
|
||||||
componentDidUpdate = ({ source: prevSource }) => {
|
componentDidUpdate = ({ source: prevSource }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user