Skip to content

Commit

Permalink
Update playlist name with title
Browse files Browse the repository at this point in the history
  • Loading branch information
kommunarr committed May 22, 2024
1 parent 5b83e75 commit 4154b64
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/renderer/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default defineComponent({
},
windowTitle: function () {
const routePath = this.$route.path
if (!routePath.startsWith('/channel/') && !routePath.startsWith('/watch/') && !routePath.startsWith('/hashtag/')) {
if (!routePath.startsWith('/channel/') && !routePath.startsWith('/watch/') && !routePath.startsWith('/hashtag/') && !routePath.startsWith('/playlist/')) {
let title = translateWindowTitle(this.$route.meta.title, this.$i18n)
if (!title) {
title = packageDetails.productName
Expand Down
12 changes: 9 additions & 3 deletions src/renderer/views/Playlist/Playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
showToast,
} from '../../helpers/utils'
import { invidiousGetPlaylistInfo, youtubeImageUrlToInvidious } from '../../helpers/api/invidious'
import packageDetails from '../../../../package.json'

const SORT_BY_VALUES = {
DateAddedNewest: 'date_added_descending',
Expand Down Expand Up @@ -323,7 +324,7 @@ export default defineComponent({
channelName = subtitle.substring(0, index).trim()
}

this.playlistTitle = result.info.title
this.setPlaylistTitle(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 @@ -366,7 +367,7 @@ export default defineComponent({

getPlaylistInvidious: function () {
invidiousGetPlaylistInfo(this.playlistId).then((result) => {
this.playlistTitle = result.title
this.setPlaylistTitle(result.title)
this.playlistDescription = result.description
this.firstVideoId = result.videos[0].videoId
this.viewCount = result.viewCount
Expand Down Expand Up @@ -403,7 +404,7 @@ export default defineComponent({
},

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

if (playlist.videos.length > 0) {
Expand Down Expand Up @@ -562,6 +563,11 @@ export default defineComponent({
}
},

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

getIconForSortPreference: (s) => getIconForSortPreference(s),

...mapActions([
Expand Down

0 comments on commit 4154b64

Please sign in to comment.