Fix playlist watch video playlist information and fix recommended videos list

This commit is contained in:
Preston 2020-11-28 19:44:17 -05:00
parent fdb258b4e3
commit 895906e2f6
3 changed files with 13 additions and 8 deletions

View File

@ -52,7 +52,11 @@ export default Vue.extend({
currentVideoIndex: function () { currentVideoIndex: function () {
const index = this.playlistItems.findIndex((item) => { const index = this.playlistItems.findIndex((item) => {
return item.id === this.videoId if (typeof item.videoId !== 'undefined') {
return item.videoId === this.videoId
} else {
return item.id === this.videoId
}
}) })
return index + 1 return index + 1
@ -280,14 +284,14 @@ export default Vue.extend({
this.playlistTitle = result.title this.playlistTitle = result.title
this.playlistItems = result.items this.playlistItems = result.items
this.videoCount = result.total_items this.videoCount = result.total_items
this.channelName = result.author.name this.channelName = '' // result.author.name
this.channelThumbnail = result.author.avatar this.channelThumbnail = '' // result.author.avatar
this.channelId = result.author.id this.channelId = '' // result.author.id
this.playlistItems = result.items.filter((video) => { this.playlistItems = result.items.filter((video) => {
return !(video.title === '[Private video]' || video.title === '[Deleted video]') return !(video.title === '[Private video]' || video.title === '[Deleted video]')
}).map((video) => { }).map((video) => {
if (video.author !== null) { if (typeof video.author !== 'undefined') {
const channelName = video.author.name const channelName = video.author.name
const channelId = video.author.ref.replace(/https:\/\/(www\.)?youtube\.com\/(user|channel)\//g, '') const channelId = video.author.ref.replace(/https:\/\/(www\.)?youtube\.com\/(user|channel)\//g, '')
video.author = channelName video.author = channelName

View File

@ -69,7 +69,7 @@
> >
<div class="videoIndexContainer"> <div class="videoIndexContainer">
<font-awesome-icon <font-awesome-icon
v-if="item.id === videoId" v-if="currentVideoIndex === (index + 1)"
class="videoIndexIcon" class="videoIndexIcon"
icon="play" icon="play"
/> />

View File

@ -202,7 +202,7 @@ export default Vue.extend({
) )
this.channelId = result.videoDetails.author.id this.channelId = result.videoDetails.author.id
this.channelName = result.videoDetails.author.name this.channelName = result.videoDetails.author.name
this.channelThumbnail = result.videoDetails.author.avatar this.channelThumbnail = result.videoDetails.author.thumbnails[0].url
this.videoPublished = new Date(result.videoDetails.publishDate.replace('-', '/')).getTime() this.videoPublished = new Date(result.videoDetails.publishDate.replace('-', '/')).getTime()
this.videoDescription = result.player_response.videoDetails.shortDescription this.videoDescription = result.player_response.videoDetails.shortDescription
@ -223,9 +223,10 @@ export default Vue.extend({
this.recommendedVideos = result.related_videos.map((video) => { this.recommendedVideos = result.related_videos.map((video) => {
video.videoId = video.id video.videoId = video.id
video.authorId = video.ucid video.authorId = video.author.id
video.viewCount = video.view_count video.viewCount = video.view_count
video.lengthSeconds = video.length_seconds video.lengthSeconds = video.length_seconds
video.author = video.author.name
return video return video
}) })
if (this.hideVideoLikesAndDislikes) { if (this.hideVideoLikesAndDislikes) {