From a0d4a633a271078844844ee50ea95f61453fe119 Mon Sep 17 00:00:00 2001 From: P0psicles Date: Sat, 1 Jun 2019 09:28:55 +0200 Subject: [PATCH] Python rebase conflict fixing --- medusa/server/web/home/handler.py | 38 +++++++++---------- .../slim/src/components/subtitle-search.vue | 4 +- themes/dark/assets/js/medusa-runtime.js | 2 +- themes/light/assets/js/medusa-runtime.js | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-) diff --git a/medusa/server/web/home/handler.py b/medusa/server/web/home/handler.py index f302699301..8642786d66 100644 --- a/medusa/server/web/home/handler.py +++ b/medusa/server/web/home/handler.py @@ -1553,20 +1553,20 @@ def setStatus(self, showSlug=None, eps=None, status=None): # @TODO: Merge this with the other PUT commands for /api/v2/show/{id} if not all([showSlug, eps, status]): error_message = 'You must specify a show and at least one episode' - ui.notifications.error('Error', error_message) - return json.dumps({ - 'result': 'error', - 'message': error_message - }) + ui.notifications.error('Error', error_message) + return json.dumps({ + 'result': 'error', + 'message': error_message + }) status = int(status) if status not in statusStrings: error_message = 'Invalid status' - ui.notifications.error('Error', error_message) - return json.dumps({ - 'result': 'error', - 'message': error_message - }) + ui.notifications.error('Error', error_message) + return json.dumps({ + 'result': 'error', + 'message': error_message + }) identifier = SeriesIdentifier.from_slug(showSlug) if not identifier: @@ -1580,16 +1580,16 @@ def setStatus(self, showSlug=None, eps=None, status=None): series_obj = Series.find_by_identifier(identifier) if not series_obj: error_message = 'Error', 'Show not in show list' - ui.notifications.error('Error', error_message) - return json.dumps({ - 'result': 'error', - 'message': error_message - }) + ui.notifications.error('Error', error_message) + return json.dumps({ + 'result': 'error', + 'message': error_message + }) segments = {} trakt_data = [] - if eps: + if eps: sql_l = [] for cur_ep in eps.split('|'): @@ -1718,10 +1718,10 @@ def setStatus(self, showSlug=None, eps=None, status=None): if segments: ui.notifications.message('Retry Search started', msg) - return json.dumps({ - 'result': 'success', + return json.dumps({ + 'result': 'success', 'message': '' - }) + }) def testRename(self, indexername=None, seriesid=None): if not indexername or not seriesid: diff --git a/themes-default/slim/src/components/subtitle-search.vue b/themes-default/slim/src/components/subtitle-search.vue index 7dff97b578..0625637894 100644 --- a/themes-default/slim/src/components/subtitle-search.vue +++ b/themes-default/slim/src/components/subtitle-search.vue @@ -224,9 +224,9 @@ export default { }, close() { this.$emit('close', this); - // destroy the vue listeners, etc + // Destroy the vue listeners, etc this.$destroy(); - // remove the element from the DOM + // Remove the element from the DOM this.$el.parentNode.removeChild(this.$el); } } diff --git a/themes/dark/assets/js/medusa-runtime.js b/themes/dark/assets/js/medusa-runtime.js index 80803af323..20813c545e 100644 --- a/themes/dark/assets/js/medusa-runtime.js +++ b/themes/dark/assets/js/medusa-runtime.js @@ -440,7 +440,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(f /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n/* harmony import */ var vue_good_table__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-good-table */ \"./node_modules/vue-good-table/dist/vue-good-table.es.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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'subtitle-search',\n components: {\n VueGoodTable: vue_good_table__WEBPACK_IMPORTED_MODULE_1__[\"VueGoodTable\"]\n },\n props: {\n show: {\n type: Object,\n required: true\n },\n season: {\n type: [String, Number],\n required: true\n },\n episode: {\n type: [String, Number],\n required: true\n }\n },\n\n data() {\n return {\n columns: [{\n label: 'Filename',\n field: 'filename'\n }, {\n label: 'Language',\n field: 'lang'\n }, {\n label: 'Provider',\n field: 'provider'\n }, {\n label: 'Score',\n field: 'score',\n type: 'number'\n }, {\n label: 'Sub Score',\n field: 'sub_score',\n type: 'number'\n }, {\n label: 'Missing Matches',\n field: rowObj => {\n if (rowObj.missing_guess) {\n return rowObj.missing_guess.join(', ');\n }\n },\n type: 'array'\n }, {\n label: 'Download',\n field: 'download',\n sortable: false\n }],\n subtitles: [],\n displayQuestion: false,\n loading: false,\n loadingMessage: ''\n };\n },\n\n computed: _objectSpread({}, Object(vuex__WEBPACK_IMPORTED_MODULE_0__[\"mapState\"])({\n config: state => state.config\n })),\n\n mounted() {\n this.displayQuestion = true;\n },\n\n methods: {\n autoSearch() {\n const {\n episode,\n season\n } = this;\n this.displayQuestion = false;\n this.loadingMessage = 'Searching for subtitles and downloading if available... ';\n this.loading = true;\n apiRoute('home/searchEpisodeSubtitles', {\n params: getSubtitleParams(season, episode)\n }) // eslint-disable-line no-undef\n .then(response => {\n if (response.data.result !== 'failure') {\n // Update the show, as we have new information (subtitles)\n // Let's emit an event, telling the displayShow component, to update the show using the api/store.\n this.$emit('update', {\n reason: 'new subtitles found',\n codes: response.data.subtitles,\n languages: response.data.languages\n });\n }\n }).catch(error => {\n console.log(\"Error trying to search for subtitles. Error: \".concat(error));\n }).finally(() => {\n // Cleanup\n this.loadingMessage = '';\n this.loading = false;\n this.close();\n });\n },\n\n manualSearch() {\n const {\n season,\n episode,\n getSubtitleParams\n } = this;\n this.displayQuestion = false;\n this.loading = true;\n this.loadingMessage = 'Searching for subtitles... ';\n apiRoute('home/manualSearchSubtitles', {\n params: getSubtitleParams(season, episode)\n }) // eslint-disable-line no-undef\n .then(response => {\n if (response.data.result === 'success') {\n this.subtitles.push(...response.data.subtitles);\n }\n }).catch(error => {\n console.log(\"Error trying to search for subtitles. Error: \".concat(error));\n }).finally(() => {\n this.loading = false;\n });\n },\n\n pickSubtitle(subtitleId) {\n // Download and save this subtitle with the episode.\n const {\n season,\n episode\n } = this;\n this.displayQuestion = false;\n this.loadingMessage = 'downloading subtitle... ';\n this.loading = true;\n apiRoute('home/manualSearchSubtitles', {\n params: getSubtitleParams(season, episode, subtitleId)\n }) // eslint-disable-line no-undef\n .then(response => {\n if (response.data.result === 'success') {\n // Update the show, as we have new information (subtitles)\n // Let's emit an event, telling the displayShow component, to update the show using the api/store.\n this.$emit('update', {\n reason: 'new subtitles found',\n codes: response.data.subtitles,\n languages: response.data.languages\n });\n }\n }).catch(error => {\n console.log(\"Error trying to search for subtitles. Error: \".concat(error));\n }).finally(() => {\n // Cleanup\n this.loadingMessage = '';\n this.loading = false;\n this.close();\n });\n },\n\n getSubtitleParams(season, episode, subtitleId) {\n const {\n show\n } = this;\n const params = {\n indexername: show.indexer,\n seriesid: show.id[show.indexer],\n season,\n episode\n };\n\n if (subtitleId) {\n params['picked_id'] = subtitleId; // eslint-disable-line dot-notation\n }\n\n return params;\n },\n\n close() {\n this.$emit('close', this); // destroy the vue listeners, etc\n\n this.$destroy(); // remove the element from the DOM\n\n this.$el.parentNode.removeChild(this.$el);\n }\n\n }\n});\n\n//# sourceURL=webpack:///./src/components/subtitle-search.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n/* harmony import */ var vue_good_table__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-good-table */ \"./node_modules/vue-good-table/dist/vue-good-table.es.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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'subtitle-search',\n components: {\n VueGoodTable: vue_good_table__WEBPACK_IMPORTED_MODULE_1__[\"VueGoodTable\"]\n },\n props: {\n show: {\n type: Object,\n required: true\n },\n season: {\n type: [String, Number],\n required: true\n },\n episode: {\n type: [String, Number],\n required: true\n }\n },\n\n data() {\n return {\n columns: [{\n label: 'Filename',\n field: 'filename'\n }, {\n label: 'Language',\n field: 'lang'\n }, {\n label: 'Provider',\n field: 'provider'\n }, {\n label: 'Score',\n field: 'score',\n type: 'number'\n }, {\n label: 'Sub Score',\n field: 'sub_score',\n type: 'number'\n }, {\n label: 'Missing Matches',\n field: rowObj => {\n if (rowObj.missing_guess) {\n return rowObj.missing_guess.join(', ');\n }\n },\n type: 'array'\n }, {\n label: 'Download',\n field: 'download',\n sortable: false\n }],\n subtitles: [],\n displayQuestion: false,\n loading: false,\n loadingMessage: ''\n };\n },\n\n computed: _objectSpread({}, Object(vuex__WEBPACK_IMPORTED_MODULE_0__[\"mapState\"])({\n config: state => state.config\n })),\n\n mounted() {\n this.displayQuestion = true;\n },\n\n methods: {\n autoSearch() {\n const {\n episode,\n season\n } = this;\n this.displayQuestion = false;\n this.loadingMessage = 'Searching for subtitles and downloading if available... ';\n this.loading = true;\n apiRoute('home/searchEpisodeSubtitles', {\n params: getSubtitleParams(season, episode)\n }) // eslint-disable-line no-undef\n .then(response => {\n if (response.data.result !== 'failure') {\n // Update the show, as we have new information (subtitles)\n // Let's emit an event, telling the displayShow component, to update the show using the api/store.\n this.$emit('update', {\n reason: 'new subtitles found',\n codes: response.data.subtitles,\n languages: response.data.languages\n });\n }\n }).catch(error => {\n console.log(\"Error trying to search for subtitles. Error: \".concat(error));\n }).finally(() => {\n // Cleanup\n this.loadingMessage = '';\n this.loading = false;\n this.close();\n });\n },\n\n manualSearch() {\n const {\n season,\n episode,\n getSubtitleParams\n } = this;\n this.displayQuestion = false;\n this.loading = true;\n this.loadingMessage = 'Searching for subtitles... ';\n apiRoute('home/manualSearchSubtitles', {\n params: getSubtitleParams(season, episode)\n }) // eslint-disable-line no-undef\n .then(response => {\n if (response.data.result === 'success') {\n this.subtitles.push(...response.data.subtitles);\n }\n }).catch(error => {\n console.log(\"Error trying to search for subtitles. Error: \".concat(error));\n }).finally(() => {\n this.loading = false;\n });\n },\n\n pickSubtitle(subtitleId) {\n // Download and save this subtitle with the episode.\n const {\n season,\n episode\n } = this;\n this.displayQuestion = false;\n this.loadingMessage = 'downloading subtitle... ';\n this.loading = true;\n apiRoute('home/manualSearchSubtitles', {\n params: getSubtitleParams(season, episode, subtitleId)\n }) // eslint-disable-line no-undef\n .then(response => {\n if (response.data.result === 'success') {\n // Update the show, as we have new information (subtitles)\n // Let's emit an event, telling the displayShow component, to update the show using the api/store.\n this.$emit('update', {\n reason: 'new subtitles found',\n codes: response.data.subtitles,\n languages: response.data.languages\n });\n }\n }).catch(error => {\n console.log(\"Error trying to search for subtitles. Error: \".concat(error));\n }).finally(() => {\n // Cleanup\n this.loadingMessage = '';\n this.loading = false;\n this.close();\n });\n },\n\n getSubtitleParams(season, episode, subtitleId) {\n const {\n show\n } = this;\n const params = {\n indexername: show.indexer,\n seriesid: show.id[show.indexer],\n season,\n episode\n };\n\n if (subtitleId) {\n params['picked_id'] = subtitleId; // eslint-disable-line dot-notation\n }\n\n return params;\n },\n\n close() {\n this.$emit('close', this); // Destroy the vue listeners, etc\n\n this.$destroy(); // Remove the element from the DOM\n\n this.$el.parentNode.removeChild(this.$el);\n }\n\n }\n});\n\n//# sourceURL=webpack:///./src/components/subtitle-search.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options"); /***/ }), diff --git a/themes/light/assets/js/medusa-runtime.js b/themes/light/assets/js/medusa-runtime.js index 80803af323..20813c545e 100644 --- a/themes/light/assets/js/medusa-runtime.js +++ b/themes/light/assets/js/medusa-runtime.js @@ -440,7 +440,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* WEBPACK VAR INJECTION */(f /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n/* harmony import */ var vue_good_table__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-good-table */ \"./node_modules/vue-good-table/dist/vue-good-table.es.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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'subtitle-search',\n components: {\n VueGoodTable: vue_good_table__WEBPACK_IMPORTED_MODULE_1__[\"VueGoodTable\"]\n },\n props: {\n show: {\n type: Object,\n required: true\n },\n season: {\n type: [String, Number],\n required: true\n },\n episode: {\n type: [String, Number],\n required: true\n }\n },\n\n data() {\n return {\n columns: [{\n label: 'Filename',\n field: 'filename'\n }, {\n label: 'Language',\n field: 'lang'\n }, {\n label: 'Provider',\n field: 'provider'\n }, {\n label: 'Score',\n field: 'score',\n type: 'number'\n }, {\n label: 'Sub Score',\n field: 'sub_score',\n type: 'number'\n }, {\n label: 'Missing Matches',\n field: rowObj => {\n if (rowObj.missing_guess) {\n return rowObj.missing_guess.join(', ');\n }\n },\n type: 'array'\n }, {\n label: 'Download',\n field: 'download',\n sortable: false\n }],\n subtitles: [],\n displayQuestion: false,\n loading: false,\n loadingMessage: ''\n };\n },\n\n computed: _objectSpread({}, Object(vuex__WEBPACK_IMPORTED_MODULE_0__[\"mapState\"])({\n config: state => state.config\n })),\n\n mounted() {\n this.displayQuestion = true;\n },\n\n methods: {\n autoSearch() {\n const {\n episode,\n season\n } = this;\n this.displayQuestion = false;\n this.loadingMessage = 'Searching for subtitles and downloading if available... ';\n this.loading = true;\n apiRoute('home/searchEpisodeSubtitles', {\n params: getSubtitleParams(season, episode)\n }) // eslint-disable-line no-undef\n .then(response => {\n if (response.data.result !== 'failure') {\n // Update the show, as we have new information (subtitles)\n // Let's emit an event, telling the displayShow component, to update the show using the api/store.\n this.$emit('update', {\n reason: 'new subtitles found',\n codes: response.data.subtitles,\n languages: response.data.languages\n });\n }\n }).catch(error => {\n console.log(\"Error trying to search for subtitles. Error: \".concat(error));\n }).finally(() => {\n // Cleanup\n this.loadingMessage = '';\n this.loading = false;\n this.close();\n });\n },\n\n manualSearch() {\n const {\n season,\n episode,\n getSubtitleParams\n } = this;\n this.displayQuestion = false;\n this.loading = true;\n this.loadingMessage = 'Searching for subtitles... ';\n apiRoute('home/manualSearchSubtitles', {\n params: getSubtitleParams(season, episode)\n }) // eslint-disable-line no-undef\n .then(response => {\n if (response.data.result === 'success') {\n this.subtitles.push(...response.data.subtitles);\n }\n }).catch(error => {\n console.log(\"Error trying to search for subtitles. Error: \".concat(error));\n }).finally(() => {\n this.loading = false;\n });\n },\n\n pickSubtitle(subtitleId) {\n // Download and save this subtitle with the episode.\n const {\n season,\n episode\n } = this;\n this.displayQuestion = false;\n this.loadingMessage = 'downloading subtitle... ';\n this.loading = true;\n apiRoute('home/manualSearchSubtitles', {\n params: getSubtitleParams(season, episode, subtitleId)\n }) // eslint-disable-line no-undef\n .then(response => {\n if (response.data.result === 'success') {\n // Update the show, as we have new information (subtitles)\n // Let's emit an event, telling the displayShow component, to update the show using the api/store.\n this.$emit('update', {\n reason: 'new subtitles found',\n codes: response.data.subtitles,\n languages: response.data.languages\n });\n }\n }).catch(error => {\n console.log(\"Error trying to search for subtitles. Error: \".concat(error));\n }).finally(() => {\n // Cleanup\n this.loadingMessage = '';\n this.loading = false;\n this.close();\n });\n },\n\n getSubtitleParams(season, episode, subtitleId) {\n const {\n show\n } = this;\n const params = {\n indexername: show.indexer,\n seriesid: show.id[show.indexer],\n season,\n episode\n };\n\n if (subtitleId) {\n params['picked_id'] = subtitleId; // eslint-disable-line dot-notation\n }\n\n return params;\n },\n\n close() {\n this.$emit('close', this); // destroy the vue listeners, etc\n\n this.$destroy(); // remove the element from the DOM\n\n this.$el.parentNode.removeChild(this.$el);\n }\n\n }\n});\n\n//# sourceURL=webpack:///./src/components/subtitle-search.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var vuex__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! vuex */ \"./node_modules/vuex/dist/vuex.esm.js\");\n/* harmony import */ var vue_good_table__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! vue-good-table */ \"./node_modules/vue-good-table/dist/vue-good-table.es.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//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n name: 'subtitle-search',\n components: {\n VueGoodTable: vue_good_table__WEBPACK_IMPORTED_MODULE_1__[\"VueGoodTable\"]\n },\n props: {\n show: {\n type: Object,\n required: true\n },\n season: {\n type: [String, Number],\n required: true\n },\n episode: {\n type: [String, Number],\n required: true\n }\n },\n\n data() {\n return {\n columns: [{\n label: 'Filename',\n field: 'filename'\n }, {\n label: 'Language',\n field: 'lang'\n }, {\n label: 'Provider',\n field: 'provider'\n }, {\n label: 'Score',\n field: 'score',\n type: 'number'\n }, {\n label: 'Sub Score',\n field: 'sub_score',\n type: 'number'\n }, {\n label: 'Missing Matches',\n field: rowObj => {\n if (rowObj.missing_guess) {\n return rowObj.missing_guess.join(', ');\n }\n },\n type: 'array'\n }, {\n label: 'Download',\n field: 'download',\n sortable: false\n }],\n subtitles: [],\n displayQuestion: false,\n loading: false,\n loadingMessage: ''\n };\n },\n\n computed: _objectSpread({}, Object(vuex__WEBPACK_IMPORTED_MODULE_0__[\"mapState\"])({\n config: state => state.config\n })),\n\n mounted() {\n this.displayQuestion = true;\n },\n\n methods: {\n autoSearch() {\n const {\n episode,\n season\n } = this;\n this.displayQuestion = false;\n this.loadingMessage = 'Searching for subtitles and downloading if available... ';\n this.loading = true;\n apiRoute('home/searchEpisodeSubtitles', {\n params: getSubtitleParams(season, episode)\n }) // eslint-disable-line no-undef\n .then(response => {\n if (response.data.result !== 'failure') {\n // Update the show, as we have new information (subtitles)\n // Let's emit an event, telling the displayShow component, to update the show using the api/store.\n this.$emit('update', {\n reason: 'new subtitles found',\n codes: response.data.subtitles,\n languages: response.data.languages\n });\n }\n }).catch(error => {\n console.log(\"Error trying to search for subtitles. Error: \".concat(error));\n }).finally(() => {\n // Cleanup\n this.loadingMessage = '';\n this.loading = false;\n this.close();\n });\n },\n\n manualSearch() {\n const {\n season,\n episode,\n getSubtitleParams\n } = this;\n this.displayQuestion = false;\n this.loading = true;\n this.loadingMessage = 'Searching for subtitles... ';\n apiRoute('home/manualSearchSubtitles', {\n params: getSubtitleParams(season, episode)\n }) // eslint-disable-line no-undef\n .then(response => {\n if (response.data.result === 'success') {\n this.subtitles.push(...response.data.subtitles);\n }\n }).catch(error => {\n console.log(\"Error trying to search for subtitles. Error: \".concat(error));\n }).finally(() => {\n this.loading = false;\n });\n },\n\n pickSubtitle(subtitleId) {\n // Download and save this subtitle with the episode.\n const {\n season,\n episode\n } = this;\n this.displayQuestion = false;\n this.loadingMessage = 'downloading subtitle... ';\n this.loading = true;\n apiRoute('home/manualSearchSubtitles', {\n params: getSubtitleParams(season, episode, subtitleId)\n }) // eslint-disable-line no-undef\n .then(response => {\n if (response.data.result === 'success') {\n // Update the show, as we have new information (subtitles)\n // Let's emit an event, telling the displayShow component, to update the show using the api/store.\n this.$emit('update', {\n reason: 'new subtitles found',\n codes: response.data.subtitles,\n languages: response.data.languages\n });\n }\n }).catch(error => {\n console.log(\"Error trying to search for subtitles. Error: \".concat(error));\n }).finally(() => {\n // Cleanup\n this.loadingMessage = '';\n this.loading = false;\n this.close();\n });\n },\n\n getSubtitleParams(season, episode, subtitleId) {\n const {\n show\n } = this;\n const params = {\n indexername: show.indexer,\n seriesid: show.id[show.indexer],\n season,\n episode\n };\n\n if (subtitleId) {\n params['picked_id'] = subtitleId; // eslint-disable-line dot-notation\n }\n\n return params;\n },\n\n close() {\n this.$emit('close', this); // Destroy the vue listeners, etc\n\n this.$destroy(); // Remove the element from the DOM\n\n this.$el.parentNode.removeChild(this.$el);\n }\n\n }\n});\n\n//# sourceURL=webpack:///./src/components/subtitle-search.vue?./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options"); /***/ }),