diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b90844edc..3b06532515 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Fixed guessit exception when parsing release without title ([#5569](https://github.com/pymedusa/Medusa/pull/5569)) - Fixed Download Station BraceAdapter exception ([#5573](https://github.com/pymedusa/Medusa/pull/5573)) - Fixed saving multiple metadata providers ([#5576](https://github.com/pymedusa/Medusa/pull/5576)) +- Fixed show-selector for libraries with more than 1k shows ([#5623](https://github.com/pymedusa/Medusa/pull/5623)) ----- diff --git a/medusa/server/api/v2/base.py b/medusa/server/api/v2/base.py index 82af8f08ba..2af8ce71f0 100644 --- a/medusa/server/api/v2/base.py +++ b/medusa/server/api/v2/base.py @@ -319,7 +319,7 @@ def _get_page(self): except ValueError: self._raise_bad_request_error('Invalid page parameter') - def _get_limit(self, default=20, maximum=1000): + def _get_limit(self, default=20, maximum=10000): try: limit = self._parse(self.get_argument('limit', default=default)) if limit < 1 or limit > maximum: diff --git a/themes-default/slim/src/store/modules/shows.js b/themes-default/slim/src/store/modules/shows.js index f91bd6c995..448c01d701 100644 --- a/themes-default/slim/src/store/modules/shows.js +++ b/themes-default/slim/src/store/modules/shows.js @@ -78,16 +78,16 @@ const actions = { * Get shows from API and commit them to the store. * * @param {*} context - The store context. - * @param {ShowParameteres[]} shows - Shows to get. If not provided, gets the first 1000 shows. + * @param {ShowParameteres[]} shows - Shows to get. If not provided, gets the first 10k shows. * @returns {(undefined|Promise)} undefined if `shows` was provided or the API response if not. */ getShows(context, shows) { const { commit, dispatch } = context; - // If no shows are provided get the first 1000 + // If no shows are provided get the first 10k if (!shows) { const params = { - limit: 1000 + limit: 10000 }; return api.get('/series', { params }).then(res => { const shows = res.data; diff --git a/themes/dark/assets/js/medusa-runtime.js b/themes/dark/assets/js/medusa-runtime.js index 4f9bdd62ab..73b03febb2 100644 --- a/themes/dark/assets/js/medusa-runtime.js +++ b/themes/dark/assets/js/medusa-runtime.js @@ -3316,7 +3316,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _mut /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.esm.js\");\n/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../api */ \"./src/api.js\");\n/* harmony import */ var _mutation_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mutation-types */ \"./src/store/mutation-types.js\");\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\nvar state = {\n shows: []\n};\n\nvar mutations = _defineProperty({}, _mutation_types__WEBPACK_IMPORTED_MODULE_2__[\"ADD_SHOW\"], function (state, show) {\n var existingShow = state.shows.find(function (_ref) {\n var id = _ref.id,\n indexer = _ref.indexer;\n return Number(show.id[show.indexer]) === Number(id[indexer]);\n });\n\n if (!existingShow) {\n console.debug(\"Adding \".concat(show.title || show.indexer + String(show.id), \" as it wasn't found in the shows array\"), show);\n state.shows.push(show);\n return;\n } // Merge new show object over old one\n // this allows detailed queries to update the record\n // without the non-detailed removing the extra data\n\n\n console.debug(\"Found \".concat(show.title || show.indexer + String(show.id), \" in shows array attempting merge\"));\n\n var newShow = _objectSpread({}, existingShow, show); // Update state\n\n\n vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].set(state.shows, state.shows.indexOf(existingShow), newShow);\n console.debug(\"Merged \".concat(newShow.title || newShow.indexer + String(newShow.id)), newShow);\n});\n\nvar getters = {\n getShowById: function getShowById(state) {\n return function (_ref2) {\n var id = _ref2.id,\n indexer = _ref2.indexer;\n return state.shows.find(function (show) {\n return Number(show.id[indexer]) === Number(id);\n });\n };\n },\n getShowByTitle: function getShowByTitle(state) {\n return function (title) {\n return state.shows.find(function (show) {\n return show.title === title;\n });\n };\n },\n getSeason: function getSeason(state) {\n return function (_ref3) {\n var id = _ref3.id,\n indexer = _ref3.indexer,\n season = _ref3.season;\n var show = state.shows.find(function (show) {\n return Number(show.id[indexer]) === Number(id);\n });\n return show && show.seasons ? show.seasons[season] : undefined;\n };\n },\n getEpisode: function getEpisode(state) {\n return function (_ref4) {\n var id = _ref4.id,\n indexer = _ref4.indexer,\n season = _ref4.season,\n episode = _ref4.episode;\n var show = state.shows.find(function (show) {\n return Number(show.id[indexer]) === Number(id);\n });\n return show && show.seasons && show.seasons[season] ? show.seasons[season][episode] : undefined;\n };\n }\n};\n/**\n * An object representing request parameters for getting a show from the API.\n *\n * @typedef {Object} ShowParameteres\n * @property {string} indexer - The indexer name (e.g. `tvdb`)\n * @property {string} id - The show ID on the indexer (e.g. `12345`)\n * @property {boolean} detailed - Whether to fetch detailed information (seasons & episodes)\n * @property {boolean} fetch - Whether to fetch external information (for example AniDB release groups)\n */\n\nvar actions = {\n /**\n * Get show from API and commit it to the store.\n *\n * @param {*} context - The store context.\n * @param {ShowParameteres} parameters - Request parameters.\n * @returns {Promise} The API response.\n */\n getShow: function getShow(context, _ref5) {\n var indexer = _ref5.indexer,\n id = _ref5.id,\n detailed = _ref5.detailed,\n fetch = _ref5.fetch;\n var commit = context.commit;\n var params = {};\n\n if (detailed !== undefined) {\n params.detailed = Boolean(detailed);\n }\n\n if (fetch !== undefined) {\n params.fetch = Boolean(fetch);\n }\n\n return _api__WEBPACK_IMPORTED_MODULE_1__[\"api\"].get('/series/' + indexer + id, {\n params: params\n }).then(function (res) {\n commit(_mutation_types__WEBPACK_IMPORTED_MODULE_2__[\"ADD_SHOW\"], res.data);\n });\n },\n\n /**\n * Get shows from API and commit them to the store.\n *\n * @param {*} context - The store context.\n * @param {ShowParameteres[]} shows - Shows to get. If not provided, gets the first 1000 shows.\n * @returns {(undefined|Promise)} undefined if `shows` was provided or the API response if not.\n */\n getShows: function getShows(context, shows) {\n var commit = context.commit,\n dispatch = context.dispatch; // If no shows are provided get the first 1000\n\n if (!shows) {\n var params = {\n limit: 1000\n };\n return _api__WEBPACK_IMPORTED_MODULE_1__[\"api\"].get('/series', {\n params: params\n }).then(function (res) {\n var shows = res.data;\n return shows.forEach(function (show) {\n commit(_mutation_types__WEBPACK_IMPORTED_MODULE_2__[\"ADD_SHOW\"], show);\n });\n });\n }\n\n return shows.forEach(function (show) {\n return dispatch('getShow', show);\n });\n }\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n state: state,\n mutations: mutations,\n getters: getters,\n actions: actions\n});\n\n//# sourceURL=webpack:///./src/store/modules/shows.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.esm.js\");\n/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../api */ \"./src/api.js\");\n/* harmony import */ var _mutation_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mutation-types */ \"./src/store/mutation-types.js\");\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\nvar state = {\n shows: []\n};\n\nvar mutations = _defineProperty({}, _mutation_types__WEBPACK_IMPORTED_MODULE_2__[\"ADD_SHOW\"], function (state, show) {\n var existingShow = state.shows.find(function (_ref) {\n var id = _ref.id,\n indexer = _ref.indexer;\n return Number(show.id[show.indexer]) === Number(id[indexer]);\n });\n\n if (!existingShow) {\n console.debug(\"Adding \".concat(show.title || show.indexer + String(show.id), \" as it wasn't found in the shows array\"), show);\n state.shows.push(show);\n return;\n } // Merge new show object over old one\n // this allows detailed queries to update the record\n // without the non-detailed removing the extra data\n\n\n console.debug(\"Found \".concat(show.title || show.indexer + String(show.id), \" in shows array attempting merge\"));\n\n var newShow = _objectSpread({}, existingShow, show); // Update state\n\n\n vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].set(state.shows, state.shows.indexOf(existingShow), newShow);\n console.debug(\"Merged \".concat(newShow.title || newShow.indexer + String(newShow.id)), newShow);\n});\n\nvar getters = {\n getShowById: function getShowById(state) {\n return function (_ref2) {\n var id = _ref2.id,\n indexer = _ref2.indexer;\n return state.shows.find(function (show) {\n return Number(show.id[indexer]) === Number(id);\n });\n };\n },\n getShowByTitle: function getShowByTitle(state) {\n return function (title) {\n return state.shows.find(function (show) {\n return show.title === title;\n });\n };\n },\n getSeason: function getSeason(state) {\n return function (_ref3) {\n var id = _ref3.id,\n indexer = _ref3.indexer,\n season = _ref3.season;\n var show = state.shows.find(function (show) {\n return Number(show.id[indexer]) === Number(id);\n });\n return show && show.seasons ? show.seasons[season] : undefined;\n };\n },\n getEpisode: function getEpisode(state) {\n return function (_ref4) {\n var id = _ref4.id,\n indexer = _ref4.indexer,\n season = _ref4.season,\n episode = _ref4.episode;\n var show = state.shows.find(function (show) {\n return Number(show.id[indexer]) === Number(id);\n });\n return show && show.seasons && show.seasons[season] ? show.seasons[season][episode] : undefined;\n };\n }\n};\n/**\n * An object representing request parameters for getting a show from the API.\n *\n * @typedef {Object} ShowParameteres\n * @property {string} indexer - The indexer name (e.g. `tvdb`)\n * @property {string} id - The show ID on the indexer (e.g. `12345`)\n * @property {boolean} detailed - Whether to fetch detailed information (seasons & episodes)\n * @property {boolean} fetch - Whether to fetch external information (for example AniDB release groups)\n */\n\nvar actions = {\n /**\n * Get show from API and commit it to the store.\n *\n * @param {*} context - The store context.\n * @param {ShowParameteres} parameters - Request parameters.\n * @returns {Promise} The API response.\n */\n getShow: function getShow(context, _ref5) {\n var indexer = _ref5.indexer,\n id = _ref5.id,\n detailed = _ref5.detailed,\n fetch = _ref5.fetch;\n var commit = context.commit;\n var params = {};\n\n if (detailed !== undefined) {\n params.detailed = Boolean(detailed);\n }\n\n if (fetch !== undefined) {\n params.fetch = Boolean(fetch);\n }\n\n return _api__WEBPACK_IMPORTED_MODULE_1__[\"api\"].get('/series/' + indexer + id, {\n params: params\n }).then(function (res) {\n commit(_mutation_types__WEBPACK_IMPORTED_MODULE_2__[\"ADD_SHOW\"], res.data);\n });\n },\n\n /**\n * Get shows from API and commit them to the store.\n *\n * @param {*} context - The store context.\n * @param {ShowParameteres[]} shows - Shows to get. If not provided, gets the first 10k shows.\n * @returns {(undefined|Promise)} undefined if `shows` was provided or the API response if not.\n */\n getShows: function getShows(context, shows) {\n var commit = context.commit,\n dispatch = context.dispatch; // If no shows are provided get the first 10k\n\n if (!shows) {\n var params = {\n limit: 10000\n };\n return _api__WEBPACK_IMPORTED_MODULE_1__[\"api\"].get('/series', {\n params: params\n }).then(function (res) {\n var shows = res.data;\n return shows.forEach(function (show) {\n commit(_mutation_types__WEBPACK_IMPORTED_MODULE_2__[\"ADD_SHOW\"], show);\n });\n });\n }\n\n return shows.forEach(function (show) {\n return dispatch('getShow', show);\n });\n }\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n state: state,\n mutations: mutations,\n getters: getters,\n actions: actions\n});\n\n//# sourceURL=webpack:///./src/store/modules/shows.js?"); /***/ }), diff --git a/themes/light/assets/js/medusa-runtime.js b/themes/light/assets/js/medusa-runtime.js index 4f9bdd62ab..73b03febb2 100644 --- a/themes/light/assets/js/medusa-runtime.js +++ b/themes/light/assets/js/medusa-runtime.js @@ -3316,7 +3316,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _mut /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.esm.js\");\n/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../api */ \"./src/api.js\");\n/* harmony import */ var _mutation_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mutation-types */ \"./src/store/mutation-types.js\");\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\nvar state = {\n shows: []\n};\n\nvar mutations = _defineProperty({}, _mutation_types__WEBPACK_IMPORTED_MODULE_2__[\"ADD_SHOW\"], function (state, show) {\n var existingShow = state.shows.find(function (_ref) {\n var id = _ref.id,\n indexer = _ref.indexer;\n return Number(show.id[show.indexer]) === Number(id[indexer]);\n });\n\n if (!existingShow) {\n console.debug(\"Adding \".concat(show.title || show.indexer + String(show.id), \" as it wasn't found in the shows array\"), show);\n state.shows.push(show);\n return;\n } // Merge new show object over old one\n // this allows detailed queries to update the record\n // without the non-detailed removing the extra data\n\n\n console.debug(\"Found \".concat(show.title || show.indexer + String(show.id), \" in shows array attempting merge\"));\n\n var newShow = _objectSpread({}, existingShow, show); // Update state\n\n\n vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].set(state.shows, state.shows.indexOf(existingShow), newShow);\n console.debug(\"Merged \".concat(newShow.title || newShow.indexer + String(newShow.id)), newShow);\n});\n\nvar getters = {\n getShowById: function getShowById(state) {\n return function (_ref2) {\n var id = _ref2.id,\n indexer = _ref2.indexer;\n return state.shows.find(function (show) {\n return Number(show.id[indexer]) === Number(id);\n });\n };\n },\n getShowByTitle: function getShowByTitle(state) {\n return function (title) {\n return state.shows.find(function (show) {\n return show.title === title;\n });\n };\n },\n getSeason: function getSeason(state) {\n return function (_ref3) {\n var id = _ref3.id,\n indexer = _ref3.indexer,\n season = _ref3.season;\n var show = state.shows.find(function (show) {\n return Number(show.id[indexer]) === Number(id);\n });\n return show && show.seasons ? show.seasons[season] : undefined;\n };\n },\n getEpisode: function getEpisode(state) {\n return function (_ref4) {\n var id = _ref4.id,\n indexer = _ref4.indexer,\n season = _ref4.season,\n episode = _ref4.episode;\n var show = state.shows.find(function (show) {\n return Number(show.id[indexer]) === Number(id);\n });\n return show && show.seasons && show.seasons[season] ? show.seasons[season][episode] : undefined;\n };\n }\n};\n/**\n * An object representing request parameters for getting a show from the API.\n *\n * @typedef {Object} ShowParameteres\n * @property {string} indexer - The indexer name (e.g. `tvdb`)\n * @property {string} id - The show ID on the indexer (e.g. `12345`)\n * @property {boolean} detailed - Whether to fetch detailed information (seasons & episodes)\n * @property {boolean} fetch - Whether to fetch external information (for example AniDB release groups)\n */\n\nvar actions = {\n /**\n * Get show from API and commit it to the store.\n *\n * @param {*} context - The store context.\n * @param {ShowParameteres} parameters - Request parameters.\n * @returns {Promise} The API response.\n */\n getShow: function getShow(context, _ref5) {\n var indexer = _ref5.indexer,\n id = _ref5.id,\n detailed = _ref5.detailed,\n fetch = _ref5.fetch;\n var commit = context.commit;\n var params = {};\n\n if (detailed !== undefined) {\n params.detailed = Boolean(detailed);\n }\n\n if (fetch !== undefined) {\n params.fetch = Boolean(fetch);\n }\n\n return _api__WEBPACK_IMPORTED_MODULE_1__[\"api\"].get('/series/' + indexer + id, {\n params: params\n }).then(function (res) {\n commit(_mutation_types__WEBPACK_IMPORTED_MODULE_2__[\"ADD_SHOW\"], res.data);\n });\n },\n\n /**\n * Get shows from API and commit them to the store.\n *\n * @param {*} context - The store context.\n * @param {ShowParameteres[]} shows - Shows to get. If not provided, gets the first 1000 shows.\n * @returns {(undefined|Promise)} undefined if `shows` was provided or the API response if not.\n */\n getShows: function getShows(context, shows) {\n var commit = context.commit,\n dispatch = context.dispatch; // If no shows are provided get the first 1000\n\n if (!shows) {\n var params = {\n limit: 1000\n };\n return _api__WEBPACK_IMPORTED_MODULE_1__[\"api\"].get('/series', {\n params: params\n }).then(function (res) {\n var shows = res.data;\n return shows.forEach(function (show) {\n commit(_mutation_types__WEBPACK_IMPORTED_MODULE_2__[\"ADD_SHOW\"], show);\n });\n });\n }\n\n return shows.forEach(function (show) {\n return dispatch('getShow', show);\n });\n }\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n state: state,\n mutations: mutations,\n getters: getters,\n actions: actions\n});\n\n//# sourceURL=webpack:///./src/store/modules/shows.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vue__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vue */ \"./node_modules/vue/dist/vue.esm.js\");\n/* harmony import */ var _api__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../api */ \"./src/api.js\");\n/* harmony import */ var _mutation_types__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../mutation-types */ \"./src/store/mutation-types.js\");\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\n\n\n\nvar state = {\n shows: []\n};\n\nvar mutations = _defineProperty({}, _mutation_types__WEBPACK_IMPORTED_MODULE_2__[\"ADD_SHOW\"], function (state, show) {\n var existingShow = state.shows.find(function (_ref) {\n var id = _ref.id,\n indexer = _ref.indexer;\n return Number(show.id[show.indexer]) === Number(id[indexer]);\n });\n\n if (!existingShow) {\n console.debug(\"Adding \".concat(show.title || show.indexer + String(show.id), \" as it wasn't found in the shows array\"), show);\n state.shows.push(show);\n return;\n } // Merge new show object over old one\n // this allows detailed queries to update the record\n // without the non-detailed removing the extra data\n\n\n console.debug(\"Found \".concat(show.title || show.indexer + String(show.id), \" in shows array attempting merge\"));\n\n var newShow = _objectSpread({}, existingShow, show); // Update state\n\n\n vue__WEBPACK_IMPORTED_MODULE_0__[\"default\"].set(state.shows, state.shows.indexOf(existingShow), newShow);\n console.debug(\"Merged \".concat(newShow.title || newShow.indexer + String(newShow.id)), newShow);\n});\n\nvar getters = {\n getShowById: function getShowById(state) {\n return function (_ref2) {\n var id = _ref2.id,\n indexer = _ref2.indexer;\n return state.shows.find(function (show) {\n return Number(show.id[indexer]) === Number(id);\n });\n };\n },\n getShowByTitle: function getShowByTitle(state) {\n return function (title) {\n return state.shows.find(function (show) {\n return show.title === title;\n });\n };\n },\n getSeason: function getSeason(state) {\n return function (_ref3) {\n var id = _ref3.id,\n indexer = _ref3.indexer,\n season = _ref3.season;\n var show = state.shows.find(function (show) {\n return Number(show.id[indexer]) === Number(id);\n });\n return show && show.seasons ? show.seasons[season] : undefined;\n };\n },\n getEpisode: function getEpisode(state) {\n return function (_ref4) {\n var id = _ref4.id,\n indexer = _ref4.indexer,\n season = _ref4.season,\n episode = _ref4.episode;\n var show = state.shows.find(function (show) {\n return Number(show.id[indexer]) === Number(id);\n });\n return show && show.seasons && show.seasons[season] ? show.seasons[season][episode] : undefined;\n };\n }\n};\n/**\n * An object representing request parameters for getting a show from the API.\n *\n * @typedef {Object} ShowParameteres\n * @property {string} indexer - The indexer name (e.g. `tvdb`)\n * @property {string} id - The show ID on the indexer (e.g. `12345`)\n * @property {boolean} detailed - Whether to fetch detailed information (seasons & episodes)\n * @property {boolean} fetch - Whether to fetch external information (for example AniDB release groups)\n */\n\nvar actions = {\n /**\n * Get show from API and commit it to the store.\n *\n * @param {*} context - The store context.\n * @param {ShowParameteres} parameters - Request parameters.\n * @returns {Promise} The API response.\n */\n getShow: function getShow(context, _ref5) {\n var indexer = _ref5.indexer,\n id = _ref5.id,\n detailed = _ref5.detailed,\n fetch = _ref5.fetch;\n var commit = context.commit;\n var params = {};\n\n if (detailed !== undefined) {\n params.detailed = Boolean(detailed);\n }\n\n if (fetch !== undefined) {\n params.fetch = Boolean(fetch);\n }\n\n return _api__WEBPACK_IMPORTED_MODULE_1__[\"api\"].get('/series/' + indexer + id, {\n params: params\n }).then(function (res) {\n commit(_mutation_types__WEBPACK_IMPORTED_MODULE_2__[\"ADD_SHOW\"], res.data);\n });\n },\n\n /**\n * Get shows from API and commit them to the store.\n *\n * @param {*} context - The store context.\n * @param {ShowParameteres[]} shows - Shows to get. If not provided, gets the first 10k shows.\n * @returns {(undefined|Promise)} undefined if `shows` was provided or the API response if not.\n */\n getShows: function getShows(context, shows) {\n var commit = context.commit,\n dispatch = context.dispatch; // If no shows are provided get the first 10k\n\n if (!shows) {\n var params = {\n limit: 10000\n };\n return _api__WEBPACK_IMPORTED_MODULE_1__[\"api\"].get('/series', {\n params: params\n }).then(function (res) {\n var shows = res.data;\n return shows.forEach(function (show) {\n commit(_mutation_types__WEBPACK_IMPORTED_MODULE_2__[\"ADD_SHOW\"], show);\n });\n });\n }\n\n return shows.forEach(function (show) {\n return dispatch('getShow', show);\n });\n }\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n state: state,\n mutations: mutations,\n getters: getters,\n actions: actions\n});\n\n//# sourceURL=webpack:///./src/store/modules/shows.js?"); /***/ }),