mirror of
https://github.com/TeamPiped/Piped.git
synced 2025-01-06 01:20:27 +05:30
parent
f8e4c70ea0
commit
9539d51126
@ -148,6 +148,7 @@ export default {
|
|||||||
this.contentItems = this.channel.relatedStreams;
|
this.contentItems = this.channel.relatedStreams;
|
||||||
this.fetchSubscribedStatus();
|
this.fetchSubscribedStatus();
|
||||||
this.updateWatched(this.channel.relatedStreams);
|
this.updateWatched(this.channel.relatedStreams);
|
||||||
|
this.fetchDeArrowContent(this.channel.relatedStreams);
|
||||||
this.tabs.push({
|
this.tabs.push({
|
||||||
translatedName: this.$t("video.videos"),
|
translatedName: this.$t("video.videos"),
|
||||||
});
|
});
|
||||||
@ -186,6 +187,7 @@ export default {
|
|||||||
this.loading = false;
|
this.loading = false;
|
||||||
this.updateWatched(json.relatedStreams);
|
this.updateWatched(json.relatedStreams);
|
||||||
json.relatedStreams.map(stream => this.contentItems.push(stream));
|
json.relatedStreams.map(stream => this.contentItems.push(stream));
|
||||||
|
this.fetchDeArrowContent(this.contentItems);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
fetchChannelTabNextPage() {
|
fetchChannelTabNextPage() {
|
||||||
@ -196,6 +198,7 @@ export default {
|
|||||||
this.tabs[this.selectedTab].tabNextPage = json.nextpage;
|
this.tabs[this.selectedTab].tabNextPage = json.nextpage;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
json.content.map(item => this.contentItems.push(item));
|
json.content.map(item => this.contentItems.push(item));
|
||||||
|
this.fetchDeArrowContent(this.contentItems);
|
||||||
this.tabs[this.selectedTab].content = this.contentItems;
|
this.tabs[this.selectedTab].content = this.contentItems;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -258,6 +261,7 @@ export default {
|
|||||||
data: this.tabs[index].data,
|
data: this.tabs[index].data,
|
||||||
}).then(tab => {
|
}).then(tab => {
|
||||||
this.contentItems = this.tabs[index].content = tab.content;
|
this.contentItems = this.tabs[index].content = tab.content;
|
||||||
|
this.fetchDeArrowContent(this.contentItems);
|
||||||
this.tabs[this.selectedTab].tabNextPage = tab.nextpage;
|
this.tabs[this.selectedTab].tabNextPage = tab.nextpage;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -138,18 +138,8 @@ export default {
|
|||||||
loadMoreVideos() {
|
loadMoreVideos() {
|
||||||
this.currentVideoCount = Math.min(this.currentVideoCount + this.videoStep, this.videosStore.length);
|
this.currentVideoCount = Math.min(this.currentVideoCount + this.videoStep, this.videosStore.length);
|
||||||
if (this.videos.length != this.videosStore.length) {
|
if (this.videos.length != this.videosStore.length) {
|
||||||
const videoIds = this.videosStore
|
|
||||||
.slice(this.videos.length, this.currentVideoCount)
|
|
||||||
.map(video => video.url.substr(-11))
|
|
||||||
.sort();
|
|
||||||
if (this.getPreferenceBoolean("dearrow", false))
|
|
||||||
this.fetchDeArrowContent(videoIds).then(json => {
|
|
||||||
Object.keys(json).forEach(key => {
|
|
||||||
const video = this.videosStore.find(video => video.url.substr(-11) == key);
|
|
||||||
video.dearrow = json[key];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
this.videos = this.videosStore.slice(0, this.currentVideoCount);
|
this.videos = this.videosStore.slice(0, this.currentVideoCount);
|
||||||
|
this.fetchDeArrowContent(this.videos);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
handleScroll() {
|
handleScroll() {
|
||||||
|
@ -116,6 +116,7 @@ export default {
|
|||||||
.then(() => {
|
.then(() => {
|
||||||
this.updateTitle();
|
this.updateTitle();
|
||||||
this.updateWatched(this.playlist.relatedStreams);
|
this.updateWatched(this.playlist.relatedStreams);
|
||||||
|
this.fetchDeArrowContent(this.playlist.relatedStreams);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async updateTitle() {
|
async updateTitle() {
|
||||||
@ -132,6 +133,7 @@ export default {
|
|||||||
this.playlist.nextpage = json.nextpage;
|
this.playlist.nextpage = json.nextpage;
|
||||||
this.loading = false;
|
this.loading = false;
|
||||||
json.relatedStreams.map(stream => this.playlist.relatedStreams.push(stream));
|
json.relatedStreams.map(stream => this.playlist.relatedStreams.push(stream));
|
||||||
|
this.fetchDeArrowContent(this.playlist.relatedStreams);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -29,13 +29,7 @@ export default {
|
|||||||
this.fetchTrending(region).then(videos => {
|
this.fetchTrending(region).then(videos => {
|
||||||
this.videos = videos;
|
this.videos = videos;
|
||||||
this.updateWatched(this.videos);
|
this.updateWatched(this.videos);
|
||||||
const videoIds = this.videos.map(video => video.url.substr(-11)).sort();
|
this.fetchDeArrowContent(this.videos);
|
||||||
this.fetchDeArrowContent(videoIds).then(json => {
|
|
||||||
Object.keys(json).forEach(key => {
|
|
||||||
const video = this.videos.find(video => video.url.substr(-11) == key);
|
|
||||||
video.dearrow = json[key];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
activated() {
|
activated() {
|
||||||
|
@ -454,16 +454,7 @@ export default {
|
|||||||
this.video.description = this.rewriteDescription(xmlDoc.querySelector("body").innerHTML);
|
this.video.description = this.rewriteDescription(xmlDoc.querySelector("body").innerHTML);
|
||||||
this.updateWatched(this.video.relatedStreams);
|
this.updateWatched(this.video.relatedStreams);
|
||||||
|
|
||||||
const videoIds = this.video.relatedStreams
|
this.fetchDeArrowContent(this.video.relatedStreams);
|
||||||
.filter(obj => obj.type === "stream")
|
|
||||||
.map(video => video.url.substr(-11))
|
|
||||||
.sort();
|
|
||||||
this.fetchDeArrowContent(videoIds).then(json => {
|
|
||||||
Object.keys(json).forEach(key => {
|
|
||||||
const video = this.video.relatedStreams.find(video => video.url.substr(-11) == key);
|
|
||||||
video.dearrow = json[key];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -485,16 +476,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
await this.fetchPlaylistPages().then(() => {
|
await this.fetchPlaylistPages().then(() => {
|
||||||
const videoIds = this.playlist.relatedStreams
|
this.fetchDeArrowContent(this.playlist.relatedStreams);
|
||||||
.filter(obj => obj.type === "stream")
|
|
||||||
.map(video => video.url.substr(-11))
|
|
||||||
.sort();
|
|
||||||
this.fetchDeArrowContent(videoIds).then(json => {
|
|
||||||
Object.keys(json).forEach(key => {
|
|
||||||
const video = this.playlist.relatedStreams.find(video => video.url.substr(-11) == key);
|
|
||||||
video.dearrow = json[key];
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
20
src/main.js
20
src/main.js
@ -542,10 +542,24 @@ const mixin = {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fetchDeArrowContent(videoIds) {
|
fetchDeArrowContent(content) {
|
||||||
if (!this.getPreferenceBoolean("dearrow", false)) return new Promise(resolve => resolve({}));
|
if (!this.getPreferenceBoolean("dearrow", false)) return;
|
||||||
return this.fetchJson(this.apiUrl() + "/dearrow", {
|
|
||||||
|
const videoIds = content
|
||||||
|
.filter(item => item.type === "stream")
|
||||||
|
.filter(item => item.dearrow === undefined)
|
||||||
|
.map(item => item.url.substr(-11))
|
||||||
|
.sort();
|
||||||
|
|
||||||
|
if (videoIds.length === 0) return;
|
||||||
|
|
||||||
|
this.fetchJson(this.apiUrl() + "/dearrow", {
|
||||||
videoIds: videoIds.join(","),
|
videoIds: videoIds.join(","),
|
||||||
|
}).then(json => {
|
||||||
|
Object.keys(json).forEach(videoId => {
|
||||||
|
const item = content.find(item => item.url.endsWith(videoId));
|
||||||
|
if (item) item.dearrow = json[videoId];
|
||||||
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user