Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the ability to view Invidious playlists #4299

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
3e900c0
allow displaying the playlist page for invidious playlists
ChunkyProgrammer Aug 22, 2023
1f91214
Fix share button and load thumbnail
ChunkyProgrammer Nov 8, 2023
5f27c61
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Nov 26, 2023
947080d
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Dec 18, 2023
f4b083b
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Jan 2, 2024
4064bf3
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Jan 31, 2024
c5d518e
Fix playlist view
ChunkyProgrammer Jan 31, 2024
65ac0c6
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Jan 31, 2024
f6db454
make sure viewcount exists
ChunkyProgrammer Feb 1, 2024
dabfeaf
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Feb 1, 2024
3f4d867
fix watch-video-playlist
ChunkyProgrammer Feb 1, 2024
dfd67ea
Fix share button title for invidious playlists
ChunkyProgrammer Feb 7, 2024
e381722
Add trailing commas
PikachuEXE Feb 8, 2024
22549ca
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Feb 13, 2024
8f0d224
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Feb 26, 2024
89b6467
prompt to view playlist when on local api with no fallback
ChunkyProgrammer Feb 29, 2024
4b0b0f6
fix typo
ChunkyProgrammer Feb 29, 2024
c0d1ec3
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Feb 29, 2024
44a610c
fix playlist styling
ChunkyProgrammer Mar 2, 2024
7ac172b
show message if invidious instance of playlist doesnt match freetube'…
ChunkyProgrammer Mar 2, 2024
62c687d
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Mar 8, 2024
54add61
don't prompt to view playlist if playlist is cached
ChunkyProgrammer Mar 8, 2024
460a9e1
fix next/previous buttons
ChunkyProgrammer Mar 8, 2024
994de50
dont use cached playlist if it's empty
ChunkyProgrammer Mar 8, 2024
6926faa
fix empty playlist view sometimes showing before playlist starts loading
ChunkyProgrammer Mar 8, 2024
ce2076f
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Mar 13, 2024
ca9290c
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Mar 25, 2024
30e3d7c
make space consistent
ChunkyProgrammer Mar 25, 2024
4d68eaf
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Mar 25, 2024
96c798b
Default to empty searchQueryTextRequested when nullable
ChunkyProgrammer Mar 27, 2024
85d59c4
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer Apr 12, 2024
8f1a72b
Merge branch 'development' into iv-playlist-support
ChunkyProgrammer May 30, 2024
c787393
merge latest changes into branch
ChunkyProgrammer Jul 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/renderer/components/ft-element-list/ft-element-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ export default defineComponent({
type: String,
default: null
},
isInvidiousPlaylist: {
type: Boolean,
default: false,
},
origin: {
type: String,
default: null
}
},
emits: ['move-video-down', 'move-video-up', 'remove-from-playlist'],
computed: {
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/ft-element-list/ft-element-list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
:playlist-id="playlistId"
:playlist-type="playlistType"
:playlist-item-id="result.playlistItemId"
:is-invidious-playlist="isInvidiousPlaylist"
:origin="origin"
@move-video-up="moveVideoUp(result.videoId, result.playlistItemId)"
@move-video-down="moveVideoDown(result.videoId, result.playlistItemId)"
@remove-from-playlist="removeFromPlaylist(result.videoId, result.playlistItemId)"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ export default defineComponent({
type: Boolean,
default: false,
},
isInvidiousPlaylist: {
type: Boolean,
default: false,
},
origin: {
type: String,
default: null
}
},
emits: ['move-video-down', 'move-video-up', 'remove-from-playlist'],
data: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
:can-move-video-up="canMoveVideoUp"
:can-move-video-down="canMoveVideoDown"
:can-remove-from-playlist="canRemoveFromPlaylist"
:is-invidious-playlist="isInvidiousPlaylist"
:origin="origin"
@move-video-up="moveVideoUp"
@move-video-down="moveVideoDown"
@remove-from-playlist="removeFromPlaylist"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,19 @@ export default defineComponent({
isCurrentVideo: {
type: Boolean,
default: false
}
},
useChannelsHiddenPreference: {
type: Boolean,
default: false,
},
isInvidiousPlaylist: {
type: Boolean,
default: false
},
origin: {
type: String,
default: null
},
},
emits: ['move-video-down', 'move-video-up', 'pause-player', 'remove-from-playlist'],
data: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
:can-move-video-up="canMoveVideoUp"
:can-move-video-down="canMoveVideoDown"
:can-remove-from-playlist="canRemoveFromPlaylist"
:origin="origin"
:is-invidious-playlist="isInvidiousPlaylist"
@pause-player="pausePlayer"
@move-video-up="moveVideoUp"
@move-video-down="moveVideoDown"
Expand Down
11 changes: 11 additions & 0 deletions src/renderer/components/ft-list-video/ft-list-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ export default defineComponent({
type: Boolean,
default: false,
},
isInvidiousPlaylist: {
type: Boolean,
default: false,
},
origin: {
type: String,
default: null
}
},
emits: ['move-video-down', 'move-video-up', 'pause-player', 'remove-from-playlist'],
data: function () {
Expand Down Expand Up @@ -485,6 +493,9 @@ export default defineComponent({
if (this.playlistIdFinal) { query.playlistId = this.playlistIdFinal }
if (this.playlistTypeFinal) { query.playlistType = this.playlistTypeFinal }
if (this.playlistItemIdFinal) { query.playlistItemId = this.playlistItemIdFinal }
if (this.isInvidiousPlaylist) { query.isInvidiousPlaylist = true }
if (this.origin) { query.origin = this.origin }

return query
},

Expand Down
20 changes: 17 additions & 3 deletions src/renderer/components/ft-share-button/ft-share-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ export default defineComponent({
dropdownPositionY: {
type: String,
default: 'bottom'
}
},
invidiousInstance: {
type: String,
default: null
},
},
data: function () {
return {
Expand All @@ -54,6 +58,10 @@ export default defineComponent({
return this.shareTargetType === 'Playlist'
},

isIVPlaylist: function () {
return this.shareTargetType === 'IVPlaylist'
},

isVideo: function() {
return this.shareTargetType === 'Video'
},
Expand All @@ -62,7 +70,7 @@ export default defineComponent({
if (this.isChannel) {
return this.$t('Share.Share Channel')
}
if (this.isPlaylist) {
if (this.isPlaylist || this.isIVPlaylist) {
return this.$t('Share.Share Playlist')
}
return this.$t('Share.Share Video')
Expand Down Expand Up @@ -91,6 +99,9 @@ export default defineComponent({
if (this.isPlaylist) {
return `${this.currentInvidiousInstance}/playlist?list=${this.id}`
}
if (this.isIVPlaylist) {
return `${this.invidiousInstance}/playlist?list=${this.id}`
}
let videoUrl = `${this.currentInvidiousInstance}/watch?v=${this.id}`
// `playlistId` can be undefined
if (this.playlistSharable) {
Expand All @@ -104,6 +115,9 @@ export default defineComponent({
if (this.isPlaylist) {
return `${this.currentInvidiousInstance}/embed/videoseries?list=${this.id}`
}
if (this.isIVPlaylist) {
return `${this.invidiousInstance}/embed/videoseries?list=${this.id}`
}
return `${this.currentInvidiousInstance}/embed/${this.id}`
},

Expand Down Expand Up @@ -150,7 +164,7 @@ export default defineComponent({
return `https://www.youtube-nocookie.com/embed/videoseries?list=${this.id}`
}
return `https://www.youtube-nocookie.com/embed/${this.id}`
},
}
},
mounted() {
// Prevents to instantiate a ft-share-button for a video without a get-timestamp function
Expand Down
15 changes: 12 additions & 3 deletions src/renderer/components/ft-share-button/ft-share-button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
/>
</ft-flex-box>
<div class="shareLinks">
<div class="header">
<div
v-if="!isIVPlaylist"
class="header"
>
<img
id="youtubeShareImage"
class="youtubeLogo"
Expand All @@ -30,7 +33,10 @@
>
</div>

<div class="buttons">
<div
v-if="!isIVPlaylist"
class="buttons"
>
<ft-button
class="action"
aria-describedby="youtubeShareImage"
Expand Down Expand Up @@ -69,7 +75,10 @@
</ft-button>
</div>

<div class="divider" />
<div
v-if="!isIVPlaylist"
class="divider"
/>

<div
id="invidiousShare"
Expand Down
17 changes: 13 additions & 4 deletions src/renderer/components/playlist-info/playlist-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default defineComponent({
},
channelThumbnail: {
type: String,
required: true,
default: null
},
channelName: {
type: String,
Expand All @@ -70,7 +70,7 @@ export default defineComponent({
},
viewCount: {
type: Number,
required: true,
default: null,
},
lastUpdated: {
type: String,
Expand All @@ -84,6 +84,14 @@ export default defineComponent({
type: String,
required: true,
},
isInvidiousPlaylist: {
type: Boolean,
default: false
},
origin: {
type: String,
default: null
},
moreVideoDataAvailable: {
type: Boolean,
required: true,
Expand Down Expand Up @@ -190,7 +198,7 @@ export default defineComponent({
},

parsedViewCount() {
return formatNumber(this.viewCount)
return this.viewCount ? formatNumber(this.viewCount) : null
},

parsedVideoCount() {
Expand All @@ -205,7 +213,7 @@ export default defineComponent({
let baseUrl = 'https://i.ytimg.com'
if (this.backendPreference === 'invidious') {
baseUrl = this.currentInvidiousInstance
} else if (typeof this.playlistThumbnail === 'string' && this.playlistThumbnail.length > 0) {
} else if (typeof this.playlistThumbnail === 'string' && this.playlistThumbnail.length > 0 && !this.isInvidiousPlaylist) {
// Use playlist thumbnail provided by YT when available
return this.playlistThumbnail
}
Expand Down Expand Up @@ -316,6 +324,7 @@ export default defineComponent({
return this.inputPlaylistNameEmpty || this.inputPlaylistNameBlank || this.inputPlaylistWithNameExists
},
},

watch: {
showDeletePlaylistPrompt(shown) {
this.$emit(shown ? 'prompt-open' : 'prompt-close')
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/components/playlist-info/playlist-info.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</h2>
<p>
{{ $tc('Global.Counts.Video Count', videoCount, {count: parsedVideoCount}) }}
<span v-if="!hideViews && !isUserPlaylist">
<span v-if="!hideViews && viewCount != null && !isUserPlaylist">
- {{ $tc('Global.Counts.View Count', viewCount, {count: parsedViewCount}) }}
</span>
<span>- </span>
Expand Down Expand Up @@ -128,7 +128,6 @@
{{ channelName }}
</h3>
</div>

<div class="playlistOptionsAndSearch">
<div class="playlistOptions">
<ft-icon-button
Expand Down Expand Up @@ -197,7 +196,8 @@
:id="id"
class="sharePlaylistIcon"
:dropdown-position-y="description ? 'top' : 'bottom'"
share-target-type="Playlist"
:share-target-type="isInvidiousPlaylist ? 'IVPlaylist' : 'Playlist'"
:invidious-instance="origin"
/>
</div>
<div
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/components/top-nav/top-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,14 +151,16 @@ export default defineComponent({
this.getYoutubeUrlInfo(query).then((result) => {
switch (result.urlType) {
case 'video': {
const { videoId, timestamp, playlistId } = result
const { videoId, timestamp, playlistId, origin, playlistType } = result

const query = {}
if (timestamp) {
query.timestamp = timestamp
}
if (playlistId && playlistId.length > 0) {
query.playlistId = playlistId
query.origin = origin
query.playlistType = playlistType
}

openInternalPath({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,33 @@
position: relative;
inset-block-end: 7px;
}

.messageContainer {
inline-size: 100%;
block-size: 100%;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
text-align: center;
row-gap: 16px;
}

.messageContainer.message {
font-size: 18px;
padding: 0;
margin: 0;
}

.errorIcon {
inline-size: 100%;
color: var(--tertiary-text-color);
font-size: 70px;
}

.viewPlaylist {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
Loading