diff --git a/src/renderer/views/Search/Search.js b/src/renderer/views/Search/Search.js index c0328929..16855e45 100644 --- a/src/renderer/views/Search/Search.js +++ b/src/renderer/views/Search/Search.js @@ -16,6 +16,8 @@ export default Vue.extend({ data: function () { return { isLoading: false, + apiUsed: 'local', + amountOfResults: 0, query: '', searchPage: 1, nextPageRef: '', @@ -122,6 +124,10 @@ export default Vue.extend({ return } + this.apiUsed = 'local' + + this.amountOfResults = result.results + const returnData = result.items.filter((item) => { if (typeof item !== 'undefined') { return item.type === 'video' || item.type === 'channel' || item.type === 'playlist' @@ -179,7 +185,8 @@ export default Vue.extend({ query: payload.query, data: this.shownResults, searchSettings: this.searchSettings, - nextPageRef: result.continuation + nextPageRef: result.continuation, + amountOfResults: result.results } this.$store.commit('addToSessionSearchHistory', historyPayload) @@ -228,6 +235,8 @@ export default Vue.extend({ return } + this.apiUsed = 'invidious' + console.log(result) const returnData = result.filter((item) => { @@ -287,13 +296,21 @@ export default Vue.extend({ console.log(payload) - this.showToast({ - message: this.$t('Search Filters["Fetching results. Please wait"]') - }) - - if (this.nextPageRef !== '') { - this.performSearchLocal(payload) + if (this.apiUsed === 'local') { + if (this.amountOfResults <= this.shownResults.length) { + this.showToast({ + message: this.$t('Search Filters.There are no more results for this search') + }) + } else { + this.showToast({ + message: this.$t('Search Filters["Fetching results. Please wait"]') + }) + this.performSearchLocal(payload) + } } else { + this.showToast({ + message: this.$t('Search Filters["Fetching results. Please wait"]') + }) this.performSearchInvidious(payload) } }, @@ -302,6 +319,7 @@ export default Vue.extend({ this.query = history.query this.shownResults = history.data this.searchSettings = history.searchSettings + this.amountOfResults = history.amountOfResults if (typeof (history.nextPageRef) !== 'undefined') { this.nextPageRef = history.nextPageRef diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index e1e19785..68388530 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -864,12 +864,16 @@ export default Vue.extend({ console.log('update watch progress') this.updateWatchProgress(payload) } + } + + if (!this.isUpcoming && !this.isLoading) { + const player = this.$refs.videoPlayer.player if (player !== null && !player.paused() && player.isInPictureInPicture()) { const playerId = this.videoId setTimeout(() => { player.play() - player.on('leavepictureinpicture', () => { + player.on('leavepictureinpicture', (event) => { const watchTime = player.currentTime() if (this.$route.fullPath.includes('/watch')) { const routeId = this.$route.params.id