Skip to content

Commit

Permalink
! Fix navigation in user playlist between entries of same video
Browse files Browse the repository at this point in the history
  • Loading branch information
PikachuEXE committed Sep 12, 2023
1 parent 2462099 commit 6e7a627
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ export default defineComponent({
type: Boolean,
default: false
},
uniqueId: {
type: String,
default: null,
},
forceListType: {
type: String,
default: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
:playlist-reverse="playlistReverse"
:playlist-shuffle="playlistShuffle"
:playlist-loop="playlistLoop"
:unique-id="uniqueId"
:force-list-type="forceListType"
:appearance="appearance"
:always-show-add-to-playlist-button="alwaysShowAddToPlaylistButton"
Expand Down
10 changes: 9 additions & 1 deletion src/renderer/components/ft-list-video/ft-list-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export default defineComponent({
type: String,
default: null
},
uniqueId: {
type: String,
default: null
},
playlistIndex: {
type: Number,
default: null
Expand Down Expand Up @@ -348,6 +352,7 @@ export default defineComponent({
return {
playlistId: this.playlistId,
playlistType: null,
uniqueId: this.uniqueId,
}
}

Expand All @@ -368,15 +373,18 @@ export default defineComponent({
playlistIdFinal: function () {
return this.playlistIdTypePairFinal?.playlistId
},

playlistTypeFinal: function () {
return this.playlistIdTypePairFinal?.playlistType
},
uniqueIdFinal: function () {
return this.playlistIdTypePairFinal?.uniqueId
},

watchPageLinkQuery() {
const query = {}
if (this.playlistIdFinal) { query.playlistId = this.playlistIdFinal }
if (this.playlistTypeFinal) { query.playlistType = this.playlistTypeFinal }
if (this.uniqueIdFinal) { query.uniqueId = this.uniqueIdFinal }
return query
},

Expand Down
4 changes: 4 additions & 0 deletions src/renderer/components/playlist-info/playlist-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export default defineComponent({
type: String,
required: true,
},
firstVideoUniqueId: {
type: String,
required: true,
},
playlistThumbnail: {
type: String,
required: true,
Expand Down
5 changes: 4 additions & 1 deletion src/renderer/components/playlist-info/playlist-info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
<router-link
:to="{
path: `/watch/${firstVideoId}`,
query: { playlistId: id }
query: {
playlistId: id,
uniqueId: firstVideoUniqueId,
},
}"
tabindex="-1"
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@
:playlist-reverse="reversePlaylist"
:playlist-shuffle="shuffleEnabled"
:playlist-loop="loopEnabled"
:unique-id="item.uniqueId"
appearance="watchPlaylistItem"
force-list-type="list"
:initial-visible-state="index < ((currentVideoIndex - 1) + 4) && index > ((currentVideoIndex - 1) - 4)"
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/store/modules/playlists.js
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ const mutations = {
removeVideo(state, payload) {
const playlist = state.playlists.find(playlist => playlist._id === payload._id)
if (playlist) {
playlist.videos = playlist.videos.filter(video => video.videoId !== payload.videoId || video.uniqueId !== payload.uniqueId)
playlist.videos = playlist.videos.filter(video => video.uniqueId !== payload.uniqueId)
}
},

Expand Down
3 changes: 3 additions & 0 deletions src/renderer/views/Playlist/Playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export default defineComponent({
playlistTitle: '',
playlistDescription: '',
firstVideoId: '',
firstVideoUniqueId: '',
playlistThumbnail: '',
viewCount: 0,
videoCount: 0,
Expand Down Expand Up @@ -268,8 +269,10 @@ export default defineComponent({

if (playlist.videos.length > 0) {
this.firstVideoId = playlist.videos[0].videoId
this.firstVideoUniqueId = playlist.videos[0].uniqueId
} else {
this.firstVideoId = ''
this.firstVideoUniqueId = ''
}
this.viewCount = 0
this.videoCount = playlist.videos.length
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/views/Playlist/Playlist.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
v-if="!isLoading"
:id="playlistId"
:first-video-id="firstVideoId"
:first-video-unique-id="firstVideoUniqueId"
:playlist-thumbnail="playlistThumbnail"
:title="playlistTitle"
:channel-name="channelName"
Expand Down Expand Up @@ -52,6 +53,7 @@
:playlist-id="playlistId"
:playlist-type="infoSource"
:playlist-index="index"
:unique-id="item.uniqueId"
appearance="result"
force-list-type="list"
:always-show-add-to-playlist-button="true"
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/views/Watch/Watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ export default defineComponent({
watchingPlaylist: false,
playlistId: '',
playlistType: '',
uniqueId: null,
timestamp: null,
playNextTimeout: null,
playNextCountDownIntervalId: null,
Expand Down Expand Up @@ -1098,6 +1099,7 @@ export default defineComponent({
}

this.playlistId = this.$route.query.playlistId
this.uniqueId = this.$route.query.uniqueId

if (this.playlistId == null || this.playlistId.length === 0) {
this.playlistType = ''
Expand Down
1 change: 1 addition & 0 deletions src/renderer/views/Watch/Watch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
:watch-view-loading="isLoading"
:playlist-id="playlistId"
:video-id="videoId"
:unique-id="uniqueId"
class="watchVideoSideBar watchVideoPlaylist"
:class="{ theatrePlaylist: useTheatreMode }"
@pause-player="pausePlayer"
Expand Down

0 comments on commit 6e7a627

Please sign in to comment.