Skip to content

Commit

Permalink
Merge branch 'development' into feature/video-added-to-playlist-count
Browse files Browse the repository at this point in the history
* development:
  Fix channel sort values to show the values they are (FreeTubeApp#5162)
  Translated using Weblate (Russian)
  Translated using Weblate (French)
  Quick bookmark button RTL & hover fixes (FreeTubeApp#5157)
  Use addVideo instead of addVideos for quick bookmark button (FreeTubeApp#5168)
  Cache quick bookmark playlist to reduce the amount of lookups (FreeTubeApp#5169)
  Translated using Weblate (Arabic)
  Translated using Weblate (Indonesian)
  Fix hide/show channel in ft-list-video (FreeTubeApp#5149)

# Conflicts:
#	src/renderer/components/ft-list-video/ft-list-video.js
#	src/renderer/components/watch-video-info/watch-video-info.js
  • Loading branch information
PikachuEXE committed May 26, 2024
2 parents de255e5 + decce53 commit 838f242
Show file tree
Hide file tree
Showing 14 changed files with 375 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export default defineComponent({
if (tag.invalid) continue

// process if no preferred name and is possibly a YouTube ID
if (tag.preferredName === '' && checkYoutubeChannelId(tag.name)) {
if ((tag.preferredName === '' || !tag.icon) && checkYoutubeChannelId(tag.name)) {
this.channelHiderDisabled = true

const { preferredName, icon, iconHref, invalidId } = await this.findChannelTagInfo(tag.name)
Expand Down
4 changes: 4 additions & 0 deletions src/renderer/components/ft-icon-button/ft-icon-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@
}

&.favorite, &.favorite:hover, &.favorite:focus-visible {
&:not(.disabled) {
color: var(--favorite-icon-color);
}

color: var(--favorite-icon-color);
}
}
Expand Down
5 changes: 1 addition & 4 deletions src/renderer/components/ft-list-playlist/ft-list-playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ export default defineComponent({
quickBookmarkPlaylistId() {
return this.$store.getters.getQuickBookmarkTargetPlaylistId
},
quickBookmarkPlaylist() {
return this.$store.getters.getPlaylist(this.quickBookmarkPlaylistId)
},
markedAsQuickBookmarkTarget() {
// Only user playlists can be target
if (this.playlistId == null) { return false }
Expand Down Expand Up @@ -174,7 +171,7 @@ export default defineComponent({
},

enableQuickBookmarkForThisPlaylist: function () {
const currentQuickBookmarkTargetPlaylist = this.quickBookmarkPlaylist
const currentQuickBookmarkTargetPlaylist = this.$store.getters.getQuickBookmarkPlaylist

this.updateQuickBookmarkTargetPlaylistId(this.playlistId)
if (currentQuickBookmarkTargetPlaylist != null) {
Expand Down
19 changes: 7 additions & 12 deletions src/renderer/components/ft-list-video/ft-list-video.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ export default defineComponent({

if (this.channelId !== null) {
const hiddenChannels = JSON.parse(this.$store.getters.getChannelsHidden)
const channelShouldBeHidden = hiddenChannels.some(c => c === this.channelId)
const channelShouldBeHidden = hiddenChannels.some(c => c.name === this.channelId)

options.push(
{
Expand Down Expand Up @@ -437,11 +437,8 @@ export default defineComponent({
return this.playlistIdTypePairFinal?.playlistItemId
},

quickBookmarkPlaylistId() {
return this.$store.getters.getQuickBookmarkTargetPlaylistId
},
quickBookmarkPlaylist() {
return this.$store.getters.getPlaylist(this.quickBookmarkPlaylistId)
return this.$store.getters.getQuickBookmarkPlaylist
},
isQuickBookmarkEnabled() {
return this.quickBookmarkPlaylist != null
Expand Down Expand Up @@ -738,15 +735,15 @@ export default defineComponent({

hideChannel: function(channelName, channelId) {
const hiddenChannels = JSON.parse(this.$store.getters.getChannelsHidden)
hiddenChannels.push(channelId)
hiddenChannels.push({ name: channelId, preferredName: channelName })
this.updateChannelsHidden(JSON.stringify(hiddenChannels))

showToast(this.$t('Channel Hidden', { channel: channelName }))
},

unhideChannel: function(channelName, channelId) {
const hiddenChannels = JSON.parse(this.$store.getters.getChannelsHidden)
this.updateChannelsHidden(JSON.stringify(hiddenChannels.filter(c => c !== channelId)))
this.updateChannelsHidden(JSON.stringify(hiddenChannels.filter(c => c.name !== channelId)))

showToast(this.$t('Channel Unhidden', { channel: channelName }))
},
Expand All @@ -769,14 +766,12 @@ export default defineComponent({
title: this.title,
author: this.channelName,
authorId: this.channelId,
description: this.description,
viewCount: this.viewCount,
lengthSeconds: this.data.lengthSeconds,
}

this.addVideos({
this.addVideo({
_id: this.quickBookmarkPlaylist._id,
videos: [videoData],
videoData,
})
// Update playlist's `lastUpdatedAt`
this.updatePlaylist({ _id: this.quickBookmarkPlaylist._id })
Expand Down Expand Up @@ -813,7 +808,7 @@ export default defineComponent({
'updateHistory',
'removeFromHistory',
'updateChannelsHidden',
'addVideos',
'addVideo',
'updatePlaylist',
'removeVideo',
])
Expand Down
5 changes: 1 addition & 4 deletions src/renderer/components/playlist-info/playlist-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,8 @@ export default defineComponent({
return !this.hideSharingActions
},

quickBookmarkPlaylistId() {
return this.$store.getters.getQuickBookmarkTargetPlaylistId
},
quickBookmarkPlaylist() {
return this.$store.getters.getPlaylist(this.quickBookmarkPlaylistId)
return this.$store.getters.getQuickBookmarkPlaylist
},
markedAsQuickBookmarkTarget() {
// Only user playlists can be target
Expand Down
13 changes: 4 additions & 9 deletions src/renderer/components/watch-video-info/watch-video-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,8 @@ export default defineComponent({
return this.$store.getters.getDefaultPlayback
},

quickBookmarkPlaylistId() {
return this.$store.getters.getQuickBookmarkTargetPlaylistId
},
quickBookmarkPlaylist() {
return this.$store.getters.getPlaylist(this.quickBookmarkPlaylistId)
return this.$store.getters.getQuickBookmarkPlaylist
},
isQuickBookmarkEnabled() {
return this.quickBookmarkPlaylist != null
Expand Down Expand Up @@ -352,14 +349,12 @@ export default defineComponent({
title: this.title,
author: this.channelName,
authorId: this.channelId,
description: this.description,
viewCount: this.viewCount,
lengthSeconds: this.lengthSeconds,
}

this.addVideos({
this.addVideo({
_id: this.quickBookmarkPlaylist._id,
videos: [videoData],
videoData,
})
// Update playlist's `lastUpdatedAt`
this.updatePlaylist({ _id: this.quickBookmarkPlaylist._id })
Expand Down Expand Up @@ -387,7 +382,7 @@ export default defineComponent({
...mapActions([
'openInExternalPlayer',
'downloadMedia',
'addVideos',
'addVideo',
'updatePlaylist',
'removeVideo',
])
Expand Down
9 changes: 6 additions & 3 deletions src/renderer/helpers/channels.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { invidiousGetChannelInfo } from './api/invidious'
import { getLocalChannel } from './api/local'
import { getLocalChannel, parseLocalChannelHeader } from './api/local'

/**
* @param {string} id
Expand Down Expand Up @@ -54,9 +54,12 @@ export async function findChannelTagInfo(id, backendOptions) {
}
} else {
if (channel.alert) return { invalidId: true }

const { name, thumbnailUrl } = parseLocalChannelHeader(channel)

return {
preferredName: channel.header.author.name,
icon: channel.header.author.thumbnails.pop().url,
preferredName: name,
icon: thumbnailUrl,
iconHref: `/channel/${id}`
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/renderer/store/modules/playlists.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ const getters = {
getPlaylist: (state) => (playlistId) => {
return state.playlists.find(playlist => playlist._id === playlistId)
},
getQuickBookmarkPlaylist(state, getters) {
const playlistId = getters.getQuickBookmarkTargetPlaylistId

if (!playlistId) {
return undefined
}

return state.playlists.find((playlist) => playlist._id === playlistId)
}
}

const actions = {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/themes.css
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ body[dir='rtl'] {
--horizontal-directionality-coefficient: -1;
}

body[dir='rtl'] [data-prefix="fas"]:not([data-icon="magnifying-glass"], [data-icon="circle-question"]) {
body[dir='rtl'] [data-prefix="fas"]:not([data-icon="magnifying-glass"], [data-icon="circle-question"], [data-icon="check"]) {
transform: scale(-1,1);
}

Expand Down
8 changes: 4 additions & 4 deletions src/renderer/views/Channel/Channel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
<ft-select
v-if="showVideoSortBy"
v-show="currentTab === 'videos' && latestVideos.length > 0"
:value="videoLiveShortSelectValues[0]"
:value="videoSortBy"
:select-names="videoLiveShortSelectNames"
:select-values="videoLiveShortSelectValues"
:placeholder="$t('Search Filters.Sort By.Sort By')"
Expand All @@ -242,7 +242,7 @@
<ft-select
v-if="!hideChannelShorts && showShortSortBy"
v-show="currentTab === 'shorts' && latestShorts.length > 0"
:value="videoLiveShortSelectValues[0]"
:value="shortSortBy"
:select-names="videoLiveShortSelectNames"
:select-values="videoLiveShortSelectValues"
:placeholder="$t('Search Filters.Sort By.Sort By')"
Expand All @@ -252,7 +252,7 @@
<ft-select
v-if="!hideLiveStreams && showLiveSortBy"
v-show="currentTab === 'live' && latestLive.length > 0"
:value="videoLiveShortSelectValues[0]"
:value="liveSortBy"
:select-names="videoLiveShortSelectNames"
:select-values="videoLiveShortSelectValues"
:placeholder="$t('Search Filters.Sort By.Sort By')"
Expand All @@ -262,7 +262,7 @@
<ft-select
v-if="!hideChannelPlaylists && showPlaylistSortBy"
v-show="currentTab === 'playlists' && latestPlaylists.length > 0"
:value="playlistSelectValues[0]"
:value="playlistSortBy"
:select-names="playlistSelectNames"
:select-values="playlistSelectValues"
:placeholder="$t('Search Filters.Sort By.Sort By')"
Expand Down
7 changes: 7 additions & 0 deletions static/locales/ar.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ User Playlists:
Reverted to use {oldPlaylistName} for quick bookmark: تمت العودة لاستخدام {oldPlaylistName}
للإشارة المرجعية السريعة
Quick bookmark disabled: تم تعطيل الإشارة المرجعية السريعة
This playlist is already being used for quick bookmark.: يتم استخدام قائمة التشغيل
هذه بالفعل لوضع إشارة مرجعية سريعة.
Playlist {playlistName} is the new quick bookmark playlist.: قائمة التشغيل {playlistName}
هي قائمة تشغيل الإشارات المرجعية السريعة الجديدة.
Search for Videos: ‬البحث عن مقاطع الفيديو
AddVideoPrompt:
Select a playlist to add your N videos to: حدد قائمة تشغيل لإضافة الفيديو الخاص
Expand Down Expand Up @@ -211,6 +215,9 @@ User Playlists:
التشغيل هذه
Disable Quick Bookmark: تعطيل الإشارة المرجعية السريعة
Playlists with Matching Videos: قوائم التشغيل مع مقاطع الفيديو المطابقة
Quick Bookmark Enabled: تم تمكين الإشارة المرجعية السريعة
Cannot delete the quick bookmark target playlist.: لا يمكن حذف قائمة التشغيل المستهدفة
للإشارات المرجعية السريعة.
History:
# On History Page
History: 'السجلّ'
Expand Down
8 changes: 4 additions & 4 deletions static/locales/fr-FR.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,15 @@ User Playlists:
This video cannot be moved up.: Cette vidéo ne peut pas être déplacée vers le
haut.
This playlist is protected and cannot be removed.: Cette liste de lecture est
protégée et ne peut être supprimée.
protégée et ne peut pas être supprimée.
Playlist {playlistName} has been deleted.: La liste de lecture {playlistName}
a été supprimée.
Some videos in the playlist are not loaded yet. Click here to copy anyway.: Certaines
vidéos de la liste de lecture ne sont pas encore chargées. Cliquez ici pour
les copier quand même.
This playlist does not exist: Cette liste de lecture n'existe pas
Playlist name cannot be empty. Please input a name.: Le nom de la liste de lecture
ne peut être vide. Veuillez saisir un nom.
ne peut pas être vide. Veuillez saisir un nom.
There was a problem with removing this video: Il y a eu un problème lors de
la suppression de cette vidéo
"{videoCount} video(s) have been removed": 1 vidéo a été supprimée | {videoCount}
Expand All @@ -187,8 +187,8 @@ User Playlists:
{playlistName} est la nouvelle liste de lecture des signets rapides.
Search for Videos: Rechercher des vidéos
Are you sure you want to delete this playlist? This cannot be undone: Êtes-vous
sûr(e) de vouloir supprimer cette liste de lecture ? Cette opération ne peut être
annulée.
sûr(e) de vouloir supprimer cette liste de lecture ? Cette opération ne peut pas
être annulée.
Sort By:
LatestPlayedFirst: Joué récemment
EarliestCreatedFirst: Création la plus ancienne
Expand Down
Loading

0 comments on commit 838f242

Please sign in to comment.