Housekeeping library component fetches
This commit is contained in:
@ -101674,9 +101674,7 @@ function clearLibraryAlbums() {
|
||||
|
||||
"use strict";
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony import */ var react_ga__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-ga */ "./node_modules/react-ga/dist/esm/index.js");
|
||||
/* harmony import */ var _util_arrays__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../util/arrays */ "./src/js/util/arrays.js");
|
||||
|
||||
/* harmony import */ var _util_arrays__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../util/arrays */ "./src/js/util/arrays.js");
|
||||
|
||||
|
||||
var coreActions = __webpack_require__(/*! ../core/actions */ "./src/js/services/core/actions.js");
|
||||
@ -101697,9 +101695,6 @@ var GoogleMiddleware = function () {
|
||||
return function (store) {
|
||||
return function (next) {
|
||||
return function (action) {
|
||||
var _store$getState = store.getState(),
|
||||
google = _store$getState.google;
|
||||
|
||||
switch (action.type) {
|
||||
case 'GOOGLE_GET_LIBRARY_ALBUMS':
|
||||
var last_run = store.getState().ui.processes.GOOGLE_LIBRARY_ALBUMS_PROCESSOR;
|
||||
@ -101712,7 +101707,7 @@ var GoogleMiddleware = function () {
|
||||
return;
|
||||
}
|
||||
|
||||
var uris = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_1__["arrayOf"])('uri', response);
|
||||
var uris = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_0__["arrayOf"])('uri', response);
|
||||
store.dispatch({
|
||||
type: 'GOOGLE_LIBRARY_ALBUMS_LOADED',
|
||||
uris: uris
|
||||
@ -104785,6 +104780,7 @@ var MopidyMiddleware = function () {
|
||||
* */
|
||||
|
||||
case 'MOPIDY_GET_LIBRARY_PLAYLISTS':
|
||||
console.log(action);
|
||||
request(store, 'playlists.asList').then(function (response) {
|
||||
// drop in our URI list
|
||||
var playlist_uris = Object(_util_arrays__WEBPACK_IMPORTED_MODULE_6__["arrayOf"])('uri', response);
|
||||
@ -121854,38 +121850,53 @@ var LibraryAlbums = /*#__PURE__*/function (_React$Component) {
|
||||
|
||||
_this = _super.call(this, props);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function () {
|
||||
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (_ref) {
|
||||
var prevSource = _ref.source;
|
||||
var source = _this.props.source;
|
||||
|
||||
if (source !== prevSource) {
|
||||
_this.getMopidyLibrary();
|
||||
|
||||
_this.getGoogleLibrary();
|
||||
|
||||
_this.getSpotifyLibrary();
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "getMopidyLibrary", function () {
|
||||
var _this$props = _this.props,
|
||||
google_available = _this$props.google_available,
|
||||
spotify_available = _this$props.spotify_available,
|
||||
source = _this$props.source,
|
||||
mopidyActions = _this$props.mopidyActions,
|
||||
googleActions = _this$props.googleActions,
|
||||
spotifyActions = _this$props.spotifyActions,
|
||||
mopidy_library_albums_status = _this$props.mopidy_library_albums_status,
|
||||
google_library_albums_status = _this$props.google_library_albums_status,
|
||||
spotify_library_albums_status = _this$props.spotify_library_albums_status;
|
||||
mopidy_library_playlists = _this$props.mopidy_library_playlists,
|
||||
getLibraryAlbums = _this$props.mopidyActions.getLibraryAlbums;
|
||||
if (source !== 'local' && source !== 'all') return;
|
||||
if (mopidy_library_playlists) return;
|
||||
getLibraryAlbums();
|
||||
});
|
||||
|
||||
if (source === 'all' || source === 'local') {
|
||||
// Filter changed, but we haven't got this provider's library yet
|
||||
if (source !== 'all' && source !== 'local' && mopidy_library_albums_status !== 'finished' && mopidy_library_albums_status !== 'started') {
|
||||
mopidyActions.getLibraryAlbums();
|
||||
}
|
||||
}
|
||||
_defineProperty(_assertThisInitialized(_this), "getGoogleLibrary", function () {
|
||||
var _this$props2 = _this.props,
|
||||
source = _this$props2.source,
|
||||
google_available = _this$props2.google_available,
|
||||
google_library_albums_status = _this$props2.google_library_albums_status,
|
||||
getLibraryAlbums = _this$props2.googleActions.getLibraryAlbums;
|
||||
if (!google_available) return;
|
||||
if (source !== 'google' && source !== 'all') return;
|
||||
if (google_library_albums_status === 'finished') return;
|
||||
if (google_library_albums_status === 'started') return;
|
||||
getLibraryAlbums();
|
||||
});
|
||||
|
||||
if (google_available && (source === 'all' || source === 'google')) {
|
||||
// Filter changed, but we haven't got this provider's library yet
|
||||
if (source !== 'all' && source !== 'google' && google_library_albums_status !== 'finished' && google_library_albums_status !== 'started') {
|
||||
googleActions.getLibraryAlbums();
|
||||
}
|
||||
}
|
||||
|
||||
if (spotify_available && (source === 'all' || source === 'spotify')) {
|
||||
// Filter changed, but we haven't got this provider's library yet
|
||||
if (spotify_library_albums_status !== 'finished' && spotify_library_albums_status !== 'started') {
|
||||
spotifyActions.getLibraryAlbums();
|
||||
}
|
||||
}
|
||||
_defineProperty(_assertThisInitialized(_this), "getSpotifyLibrary", function () {
|
||||
var _this$props3 = _this.props,
|
||||
source = _this$props3.source,
|
||||
spotify_available = _this$props3.spotify_available,
|
||||
spotify_library_albums_status = _this$props3.spotify_library_albums_status,
|
||||
getLibraryAlbums = _this$props3.spotifyActions.getLibraryAlbums;
|
||||
if (!spotify_available) return;
|
||||
if (source !== 'spotify' && source !== 'all') return;
|
||||
if (spotify_library_albums_status === 'finished') return;
|
||||
if (spotify_library_albums_status === 'started') return;
|
||||
getLibraryAlbums();
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "handleContextMenu", function (e, item) {
|
||||
@ -121899,9 +121910,9 @@ var LibraryAlbums = /*#__PURE__*/function (_React$Component) {
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "moreURIsToLoad", function () {
|
||||
var _this$props2 = _this.props,
|
||||
albums = _this$props2.albums,
|
||||
library_albums = _this$props2.library_albums;
|
||||
var _this$props4 = _this.props,
|
||||
albums = _this$props4.albums,
|
||||
library_albums = _this$props4.library_albums;
|
||||
var uris = [];
|
||||
|
||||
if (albums && library_albums) {
|
||||
@ -121924,9 +121935,9 @@ var LibraryAlbums = /*#__PURE__*/function (_React$Component) {
|
||||
var _this$state = _this.state,
|
||||
limit = _this$state.limit,
|
||||
per_page = _this$state.per_page;
|
||||
var _this$props3 = _this.props,
|
||||
state = _this$props3.location.state,
|
||||
history = _this$props3.history;
|
||||
var _this$props5 = _this.props,
|
||||
state = _this$props5.location.state,
|
||||
history = _this$props5.history;
|
||||
var new_limit = limit + per_page;
|
||||
|
||||
_this.setState({
|
||||
@ -121941,10 +121952,10 @@ var LibraryAlbums = /*#__PURE__*/function (_React$Component) {
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "setSort", function (value) {
|
||||
var _this$props4 = _this.props,
|
||||
sort = _this$props4.sort,
|
||||
sort_reverse = _this$props4.sort_reverse,
|
||||
set = _this$props4.uiActions.set;
|
||||
var _this$props6 = _this.props,
|
||||
sort = _this$props6.sort,
|
||||
sort_reverse = _this$props6.sort_reverse,
|
||||
set = _this$props6.uiActions.set;
|
||||
var reverse = false;
|
||||
if (sort === value) reverse = !sort_reverse;
|
||||
set({
|
||||
@ -122109,19 +122120,10 @@ var LibraryAlbums = /*#__PURE__*/function (_React$Component) {
|
||||
_createClass(LibraryAlbums, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
var _this$props5 = this.props,
|
||||
_this$props5$location = _this$props5.location.state,
|
||||
state = _this$props5$location === void 0 ? {} : _this$props5$location,
|
||||
setWindowTitle = _this$props5.uiActions.setWindowTitle,
|
||||
mopidy_library_albums_status = _this$props5.mopidy_library_albums_status,
|
||||
source = _this$props5.source,
|
||||
mopidyActions = _this$props5.mopidyActions,
|
||||
spotifyActions = _this$props5.spotifyActions,
|
||||
googleActions = _this$props5.googleActions,
|
||||
google_available = _this$props5.google_available,
|
||||
google_library_albums_status = _this$props5.google_library_albums_status,
|
||||
spotify_available = _this$props5.spotify_available,
|
||||
spotify_library_albums_status = _this$props5.spotify_library_albums_status; // Restore any limit defined in our location state
|
||||
var _this$props7 = this.props,
|
||||
_this$props7$location = _this$props7.location.state,
|
||||
state = _this$props7$location === void 0 ? {} : _this$props7$location,
|
||||
setWindowTitle = _this$props7.uiActions.setWindowTitle; // Restore any limit defined in our location state
|
||||
|
||||
if (state.limit) {
|
||||
this.setState({
|
||||
@ -122130,18 +122132,9 @@ var LibraryAlbums = /*#__PURE__*/function (_React$Component) {
|
||||
}
|
||||
|
||||
setWindowTitle(Object(_locale__WEBPACK_IMPORTED_MODULE_18__["i18n"])('library.albums.title'));
|
||||
|
||||
if (mopidy_library_albums_status !== 'finished' && mopidy_library_albums_status !== 'started' && (source === 'all' || source === 'local')) {
|
||||
mopidyActions.getLibraryAlbums();
|
||||
}
|
||||
|
||||
if (google_available && google_library_albums_status !== 'finished' && google_library_albums_status !== 'started' && (source === 'all' || source === 'google')) {
|
||||
googleActions.getLibraryAlbums();
|
||||
}
|
||||
|
||||
if (spotify_available && spotify_library_albums_status !== 'finished' && spotify_library_albums_status !== 'started' && (source == 'all' || source === 'spotify')) {
|
||||
spotifyActions.getLibraryAlbums();
|
||||
}
|
||||
this.getMopidyLibrary();
|
||||
this.getGoogleLibrary();
|
||||
this.getSpotifyLibrary();
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
@ -122407,48 +122400,52 @@ var LibraryArtists = /*#__PURE__*/function (_React$Component) {
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (_ref) {
|
||||
var prevSource = _ref.source;
|
||||
var _this$props = _this.props,
|
||||
source = _this$props.source,
|
||||
google_available = _this$props.google_available,
|
||||
spotify_available = _this$props.spotify_available,
|
||||
mopidyActions = _this$props.mopidyActions,
|
||||
googleActions = _this$props.googleActions,
|
||||
spotifyActions = _this$props.spotifyActions,
|
||||
mopidy_library_artists = _this$props.mopidy_library_artists,
|
||||
google_library_artists = _this$props.google_library_artists,
|
||||
spotify_library_artists_status = _this$props.spotify_library_artists_status;
|
||||
var source = _this.props.source;
|
||||
|
||||
if (source !== prevSource) {
|
||||
switch (source) {
|
||||
case 'google':
|
||||
if (google_available && !google_library_artists) {
|
||||
googleActions.getLibraryArtists();
|
||||
}
|
||||
_this.getMopidyLibrary();
|
||||
|
||||
break;
|
||||
_this.getGoogleLibrary();
|
||||
|
||||
case 'spotify':
|
||||
if (spotify_available && spotify_library_artists_status !== 'finished' && spotify_library_artists_status !== 'started') {
|
||||
spotifyActions.getLibraryArtists();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'local':
|
||||
if (!mopidy_library_artists) {
|
||||
mopidyActions.getLibraryArtists();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
mopidyActions.getLibraryArtists();
|
||||
googleActions.getLibraryArtists();
|
||||
spotifyActions.getLibraryArtists();
|
||||
}
|
||||
_this.getSpotifyLibrary();
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "getMopidyLibrary", function () {
|
||||
var _this$props = _this.props,
|
||||
source = _this$props.source,
|
||||
mopidy_library_artists = _this$props.mopidy_library_artists,
|
||||
getLibraryArtists = _this$props.mopidyActions.getLibraryArtists;
|
||||
if (source !== 'local' && source !== 'all') return;
|
||||
if (mopidy_library_artists) return;
|
||||
getLibraryArtists();
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "getGoogleLibrary", function () {
|
||||
var _this$props2 = _this.props,
|
||||
source = _this$props2.source,
|
||||
google_available = _this$props2.google_available,
|
||||
google_library_artists = _this$props2.google_library_artists,
|
||||
getLibraryArtists = _this$props2.googleActions.getLibraryArtists;
|
||||
if (!google_available) return;
|
||||
if (source !== 'google' && source !== 'all') return;
|
||||
if (google_library_artists) return;
|
||||
getLibraryArtists();
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "getSpotifyLibrary", function () {
|
||||
var _this$props3 = _this.props,
|
||||
source = _this$props3.source,
|
||||
spotify_available = _this$props3.spotify_available,
|
||||
spotify_library_artists_status = _this$props3.spotify_library_artists_status,
|
||||
getLibraryArtists = _this$props3.spotifyActions.getLibraryArtists;
|
||||
if (!spotify_available) return;
|
||||
if (source !== 'spotify' && source !== 'all') return;
|
||||
if (spotify_library_artists_status === 'finished') return;
|
||||
if (spotify_library_artists_status === 'started') return;
|
||||
getLibraryArtists();
|
||||
});
|
||||
|
||||
_this.state = {
|
||||
filter: '',
|
||||
limit: 50,
|
||||
@ -122460,17 +122457,7 @@ var LibraryArtists = /*#__PURE__*/function (_React$Component) {
|
||||
_createClass(LibraryArtists, [{
|
||||
key: "componentDidMount",
|
||||
value: function componentDidMount() {
|
||||
var _this$props2 = this.props,
|
||||
source = _this$props2.source,
|
||||
mopidy_library_artists = _this$props2.mopidy_library_artists,
|
||||
mopidyActions = _this$props2.mopidyActions,
|
||||
google_available = _this$props2.google_available,
|
||||
google_library_artists = _this$props2.google_library_artists,
|
||||
googleActions = _this$props2.googleActions,
|
||||
spotify_available = _this$props2.spotify_available,
|
||||
spotify_library_artists_status = _this$props2.spotify_library_artists_status,
|
||||
spotifyActions = _this$props2.spotifyActions,
|
||||
setWindowTitle = _this$props2.uiActions.setWindowTitle; // Restore any limit defined in our location state
|
||||
var setWindowTitle = this.props.uiActions.setWindowTitle; // Restore any limit defined in our location state
|
||||
|
||||
var state = this.props.location.state ? this.props.location.state : {};
|
||||
|
||||
@ -122481,18 +122468,9 @@ var LibraryArtists = /*#__PURE__*/function (_React$Component) {
|
||||
}
|
||||
|
||||
setWindowTitle(Object(_locale__WEBPACK_IMPORTED_MODULE_16__["i18n"])('library.artists.title'));
|
||||
|
||||
if (!mopidy_library_artists && (source === 'all' || source === 'local')) {
|
||||
mopidyActions.getLibraryArtists();
|
||||
}
|
||||
|
||||
if (google_available && !google_library_artists && (source === 'all' || source === 'google')) {
|
||||
googleActions.getLibraryArtists();
|
||||
}
|
||||
|
||||
if (spotify_available && spotify_library_artists_status !== 'finished' && (source === 'all' || source === 'spotify')) {
|
||||
spotifyActions.getLibraryArtists();
|
||||
}
|
||||
this.getMopidyLibrary();
|
||||
this.getGoogleLibrary();
|
||||
this.getSpotifyLibrary();
|
||||
}
|
||||
}, {
|
||||
key: "handleContextMenu",
|
||||
@ -122799,9 +122777,8 @@ var LibraryArtists = /*#__PURE__*/function (_React$Component) {
|
||||
return LibraryArtists;
|
||||
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);
|
||||
|
||||
var mapStateToProps = function mapStateToProps(state, ownProps) {
|
||||
var mapStateToProps = function mapStateToProps(state) {
|
||||
return {
|
||||
mopidy_connected: state.mopidy.connected,
|
||||
mopidy_uri_schemes: state.mopidy.uri_schemes,
|
||||
mopidy_library_artists: state.mopidy.library_artists,
|
||||
google_available: state.mopidy.uri_schemes && state.mopidy.uri_schemes.includes('gmusic:'),
|
||||
@ -122909,10 +122886,9 @@ var LibraryBrowse = /*#__PURE__*/function (_React$Component) {
|
||||
|
||||
_this = _super.call.apply(_super, [this].concat(args));
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (_ref) {
|
||||
var prev_mopidy_connected = _ref.mopidy_connected;
|
||||
var mopidy_connected = _this.props.mopidy_connected;
|
||||
if (!prev_mopidy_connected && mopidy_connected) _this.loadDirectory();
|
||||
_defineProperty(_assertThisInitialized(_this), "loadDirectory", function () {
|
||||
var getDirectory = _this.props.mopidyActions.getDirectory;
|
||||
getDirectory(null);
|
||||
});
|
||||
|
||||
return _this;
|
||||
@ -122924,15 +122900,6 @@ var LibraryBrowse = /*#__PURE__*/function (_React$Component) {
|
||||
this.loadDirectory();
|
||||
this.props.uiActions.setWindowTitle(Object(_locale__WEBPACK_IMPORTED_MODULE_10__["i18n"])('library.browse.title'));
|
||||
}
|
||||
}, {
|
||||
key: "loadDirectory",
|
||||
value: function loadDirectory() {
|
||||
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;
|
||||
|
||||
if (props.mopidy_connected) {
|
||||
this.props.mopidyActions.getDirectory(null);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "render",
|
||||
value: function render() {
|
||||
@ -123059,10 +123026,9 @@ var LibraryBrowse = /*#__PURE__*/function (_React$Component) {
|
||||
return LibraryBrowse;
|
||||
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);
|
||||
|
||||
var mapStateToProps = function mapStateToProps(state, ownProps) {
|
||||
var mapStateToProps = function mapStateToProps(state) {
|
||||
return {
|
||||
load_queue: state.ui.load_queue,
|
||||
mopidy_connected: state.mopidy.connected,
|
||||
directory: state.mopidy.directory,
|
||||
view: state.ui.library_directory_view
|
||||
};
|
||||
@ -123169,13 +123135,19 @@ var LibraryBrowseDirectory = /*#__PURE__*/function (_React$Component) {
|
||||
_this = _super.call(this, props);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (_ref) {
|
||||
var prev_mopidy_connected = _ref.mopidy_connected,
|
||||
prevUri = _ref.uri;
|
||||
var prevUri = _ref.uri;
|
||||
var uri = _this.props.uri;
|
||||
|
||||
if (uri && uri !== prevUri) {
|
||||
_this.loadDirectory();
|
||||
}
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "loadDirectory", function () {
|
||||
var _this$props = _this.props,
|
||||
uri = _this$props.uri,
|
||||
mopidy_connected = _this$props.mopidy_connected;
|
||||
if (!prev_mopidy_connected && mopidy_connected) _this.loadDirectory();
|
||||
if (uri && uri !== prevUri) _this.loadDirectory();
|
||||
getDirectory = _this$props.mopidyActions.getDirectory;
|
||||
getDirectory(uri);
|
||||
});
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "loadMore", function () {
|
||||
@ -123370,21 +123342,6 @@ var LibraryBrowseDirectory = /*#__PURE__*/function (_React$Component) {
|
||||
this.props.uiActions.setWindowTitle(Object(_locale__WEBPACK_IMPORTED_MODULE_18__["i18n"])('library.browse_directory.title'));
|
||||
this.loadDirectory();
|
||||
}
|
||||
}, {
|
||||
key: "loadDirectory",
|
||||
value: function loadDirectory() {
|
||||
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.props;
|
||||
|
||||
if (props.mopidy_connected) {
|
||||
var uri = null;
|
||||
|
||||
if (props.uri !== undefined) {
|
||||
uri = props.uri;
|
||||
}
|
||||
|
||||
this.props.mopidyActions.getDirectory(uri);
|
||||
}
|
||||
}
|
||||
}, {
|
||||
key: "playAll",
|
||||
value: function playAll(e, tracks) {
|
||||
@ -123485,7 +123442,6 @@ var mapStateToProps = function mapStateToProps(state, ownProps) {
|
||||
return {
|
||||
uri: uri,
|
||||
load_queue: state.ui.load_queue,
|
||||
mopidy_connected: state.mopidy.connected,
|
||||
directory: state.mopidy.directory,
|
||||
view: state.ui.library_directory_view
|
||||
};
|
||||
@ -123584,29 +123540,35 @@ var LibraryPlaylists = /*#__PURE__*/function (_React$Component) {
|
||||
|
||||
_this = _super.call(this, props);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (_ref) {
|
||||
var prev_mopidy_connected = _ref.mopidy_connected;
|
||||
_defineProperty(_assertThisInitialized(_this), "getMopidyLibrary", function () {
|
||||
var _this$props = _this.props,
|
||||
source = _this$props.source,
|
||||
mopidy_connected = _this$props.mopidy_connected,
|
||||
mopidy_library_playlists = _this$props.mopidy_library_playlists,
|
||||
spotify_available = _this$props.spotify_available,
|
||||
spotify_library_playlists_status = _this$props.spotify_library_playlists_status,
|
||||
mopidyActions = _this$props.mopidyActions,
|
||||
spotifyActions = _this$props.spotifyActions;
|
||||
getLibraryPlaylists = _this$props.mopidyActions.getLibraryPlaylists;
|
||||
if (source !== 'local' && source !== 'all') return;
|
||||
if (mopidy_library_playlists) return;
|
||||
getLibraryPlaylists();
|
||||
});
|
||||
|
||||
if (mopidy_connected && (source == 'all' || source == 'local')) {
|
||||
if (!prev_mopidy_connected) mopidyActions.getLibraryPlaylists();
|
||||
_defineProperty(_assertThisInitialized(_this), "getSpotifyLibrary", function () {
|
||||
var _this$props2 = _this.props,
|
||||
source = _this$props2.source,
|
||||
spotify_library_playlists_status = _this$props2.spotify_library_playlists_status,
|
||||
getLibraryPlaylists = _this$props2.spotifyActions.getLibraryPlaylists;
|
||||
if (source !== 'spotify' && source !== 'all') return;
|
||||
if (spotify_library_playlists_status === 'finished') return;
|
||||
if (spotify_library_playlists_status === 'started') return;
|
||||
getLibraryPlaylists();
|
||||
});
|
||||
|
||||
if (source !== 'all' && source !== 'local' && !mopidy_library_playlists) {
|
||||
_this.props.mopidyActions.getLibraryPlaylists();
|
||||
}
|
||||
}
|
||||
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (_ref) {
|
||||
var prevSource = _ref.source;
|
||||
var source = _this.props.source;
|
||||
|
||||
if (spotify_available && (source === 'all' || source === 'spotify')) {
|
||||
if (spotify_library_playlists_status !== 'finished' && spotify_library_playlists_status !== 'started') {
|
||||
spotifyActions.getLibraryPlaylists();
|
||||
}
|
||||
if (source !== prevSource) {
|
||||
_this.getMopidyLibrary();
|
||||
|
||||
_this.getSpotifyLibrary();
|
||||
}
|
||||
});
|
||||
|
||||
@ -123631,14 +123593,8 @@ var LibraryPlaylists = /*#__PURE__*/function (_React$Component) {
|
||||
}
|
||||
|
||||
this.props.uiActions.setWindowTitle(Object(_locale__WEBPACK_IMPORTED_MODULE_16__["i18n"])('library.playlists.title'));
|
||||
|
||||
if (!this.props.mopidy_library_playlists && this.props.mopidy_connected && (this.props.source == 'all' || this.props.source == 'local')) {
|
||||
this.props.mopidyActions.getLibraryPlaylists();
|
||||
}
|
||||
|
||||
if (this.props.spotify_available && this.props.spotify_library_playlists_status !== 'finished' && (this.props.source == 'all' || this.props.source == 'spotify')) {
|
||||
this.props.spotifyActions.getLibraryPlaylists();
|
||||
}
|
||||
this.getMopidyLibrary();
|
||||
this.getSpotifyLibrary();
|
||||
}
|
||||
}, {
|
||||
key: "handleContextMenu",
|
||||
@ -123914,10 +123870,9 @@ var LibraryPlaylists = /*#__PURE__*/function (_React$Component) {
|
||||
return LibraryPlaylists;
|
||||
}(react__WEBPACK_IMPORTED_MODULE_0___default.a.Component);
|
||||
|
||||
var mapStateToProps = function mapStateToProps(state, ownProps) {
|
||||
var mapStateToProps = function mapStateToProps(state) {
|
||||
return {
|
||||
slim_mode: state.ui.slim_mode,
|
||||
mopidy_connected: state.mopidy.connected,
|
||||
mopidy_uri_schemes: state.mopidy.uri_schemes,
|
||||
mopidy_library_playlists: state.mopidy.library_playlists,
|
||||
mopidy_library_playlists_status: state.ui.processes.MOPIDY_LIBRARY_PLAYLISTS_PROCESSOR !== undefined ? state.ui.processes.MOPIDY_LIBRARY_PLAYLISTS_PROCESSOR.status : null,
|
||||
@ -124245,7 +124200,6 @@ var AddToPlaylist = /*#__PURE__*/function (_React$Component) {
|
||||
var _this$props = _this.props,
|
||||
spotify_library_playlists_status = _this$props.spotify_library_playlists_status,
|
||||
mopidy_library_playlists_status = _this$props.mopidy_library_playlists_status,
|
||||
mopidy_connected = _this$props.mopidy_connected,
|
||||
spotify_available = _this$props.spotify_available,
|
||||
spotifyActions = _this$props.spotifyActions,
|
||||
mopidyActions = _this$props.mopidyActions,
|
||||
@ -124255,7 +124209,7 @@ var AddToPlaylist = /*#__PURE__*/function (_React$Component) {
|
||||
spotifyActions.getLibraryPlaylists();
|
||||
}
|
||||
|
||||
if ((!mopidy_library_playlists_status || mopidy_library_playlists_status !== 'finished') && mopidy_connected) {
|
||||
if (!mopidy_library_playlists_status || mopidy_library_playlists_status !== 'finished') {
|
||||
mopidyActions.getLibraryPlaylists();
|
||||
}
|
||||
|
||||
@ -124385,7 +124339,6 @@ var AddToPlaylist = /*#__PURE__*/function (_React$Component) {
|
||||
var mapStateToProps = function mapStateToProps(state, ownProps) {
|
||||
return {
|
||||
uris: ownProps.match.params.uris ? decodeURIComponent(ownProps.match.params.uris).split(',') : [],
|
||||
mopidy_connected: state.mopidy.connected,
|
||||
mopidy_uri_schemes: state.mopidy.uri_schemes,
|
||||
mopidy_library_playlists: state.mopidy.library_playlists,
|
||||
mopidy_library_playlists_status: state.ui.processes.MOPIDY_LIBRARY_PLAYLISTS_PROCESSOR !== undefined ? state.ui.processes.MOPIDY_LIBRARY_PLAYLISTS_PROCESSOR.status : null,
|
||||
@ -125726,14 +125679,13 @@ var EditPlaylist = /*#__PURE__*/function (_React$Component) {
|
||||
_this = _super.call(this, props);
|
||||
|
||||
_defineProperty(_assertThisInitialized(_this), "componentDidUpdate", function (_ref) {
|
||||
var prev_mopidy_connected = _ref.mopidy_connected;
|
||||
var prevPlaylist = _ref.playlist;
|
||||
var _this$props = _this.props,
|
||||
uri = _this$props.uri,
|
||||
playlist = _this$props.playlist,
|
||||
mopidy_connected = _this$props.mopidy_connected,
|
||||
getPlaylist = _this$props.mopidyActions.getPlaylist;
|
||||
|
||||
if (!prev_mopidy_connected && mopidy_connected && !playlist) {
|
||||
if (playlist !== prevPlaylist) {
|
||||
getPlaylist(uri);
|
||||
}
|
||||
});
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user