Skip to content

Commit

Permalink
* Update playlist page titles
Browse files Browse the repository at this point in the history
  • Loading branch information
PikachuEXE committed Jun 17, 2024
1 parent 26e3619 commit e8260d5
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/renderer/views/Playlist/Playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ export default defineComponent({
channelName = subtitle.substring(0, index).trim()
}

this.setPlaylistTitle(result.info.title)
this.playlistTitle = result.info.title
this.playlistDescription = result.info.description ?? ''
this.firstVideoId = result.items[0].id
this.playlistThumbnail = result.info.thumbnails[0].url
Expand Down Expand Up @@ -334,6 +334,8 @@ export default defineComponent({
// auto load next page again when no. of parsed items < page size
if (shouldGetNextPage) { this.getNextPageLocal() }

this.updatePageTitle()

this.isLoading = false
}).catch((err) => {
console.error(err)
Expand All @@ -348,7 +350,7 @@ export default defineComponent({

getPlaylistInvidious: function () {
invidiousGetPlaylistInfo(this.playlistId).then((result) => {
this.setPlaylistTitle(result.title)
this.playlistTitle = result.title
this.playlistDescription = result.description
this.firstVideoId = result.videos[0].videoId
this.viewCount = result.viewCount
Expand All @@ -371,6 +373,8 @@ export default defineComponent({

this.playlistItems = result.videos

this.updatePageTitle()

this.isLoading = false
}).catch((err) => {
console.error(err)
Expand All @@ -385,7 +389,7 @@ export default defineComponent({
},

parseUserPlaylist: function (playlist) {
this.setPlaylistTitle(playlist.playlistName)
this.playlistTitle = playlist.playlistName
this.playlistDescription = playlist.description ?? ''

if (playlist.videos.length > 0) {
Expand All @@ -406,6 +410,8 @@ export default defineComponent({

this.playlistItems = playlist.videos

this.updatePageTitle()

this.isLoading = false
},
showUserPlaylistNotFound() {
Expand Down Expand Up @@ -546,7 +552,16 @@ export default defineComponent({

setPlaylistTitle: function (value) {
this.playlistTitle = value
document.title = `${value} - ${packageDetails.productName}`
},

updatePageTitle() {
const playlistTitle = this.playlistTitle
const channelName = this.channelName
const titleText = [
playlistTitle,
channelName,
].filter(v => v).join(' | ')
document.title = `${titleText} - ${packageDetails.productName}`
},

handleResize: function () {
Expand Down

0 comments on commit e8260d5

Please sign in to comment.