From e1c2d7244a43b59036767e191295c7b292021e2b Mon Sep 17 00:00:00 2001 From: Sudharaka Date: Mon, 20 Jan 2025 12:48:42 -0800 Subject: [PATCH 1/3] feat: add creative commons license to description --- .../components/watch-video-info/watch-video-info.js | 4 ++++ .../components/watch-video-info/watch-video-info.vue | 6 ++++++ src/renderer/views/Watch/Watch.js | 2 ++ src/renderer/views/Watch/Watch.vue | 1 + 4 files changed, 13 insertions(+) diff --git a/src/renderer/components/watch-video-info/watch-video-info.js b/src/renderer/components/watch-video-info/watch-video-info.js index 1fd5e53c82d48..aa44f2a52b9c0 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.js +++ b/src/renderer/components/watch-video-info/watch-video-info.js @@ -114,6 +114,10 @@ export default defineComponent({ isUnlisted: { type: Boolean, required: false + }, + license: { + type: String, + default: null, } }, emits: ['change-format', 'pause-player', 'set-info-area-sticky', 'scroll-to-info-area'], diff --git a/src/renderer/components/watch-video-info/watch-video-info.vue b/src/renderer/components/watch-video-info/watch-video-info.vue index 165f9c33e59d1..d7a6448fa87b7 100644 --- a/src/renderer/components/watch-video-info/watch-video-info.vue +++ b/src/renderer/components/watch-video-info/watch-video-info.vue @@ -141,6 +141,12 @@ /> +
+ {{ license }} +
diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index e768dd733869c..940b90e27f7d5 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -82,6 +82,7 @@ export default defineComponent({ isUpcoming: false, isPostLiveDvr: false, isUnlisted: false, + license: null, upcomingTimestamp: null, upcomingTimeLeft: null, /** @type {'dash' | 'audio' | 'legacy'} */ @@ -408,6 +409,7 @@ export default defineComponent({ // extract localised title first and fall back to the not localised one this.videoTitle = result.primary_info?.title.text ?? result.basic_info.title this.videoViewCount = result.basic_info.view_count ?? (result.primary_info.view_count ? extractNumberFromString(result.primary_info.view_count.text) : null) + this.license = result.secondary_info.metadata.rows.matchCondition(element => element.title.text === 'License')?.contents[0].text this.channelId = result.basic_info.channel_id ?? result.secondary_info.owner?.author.id this.channelName = result.basic_info.author ?? result.secondary_info.owner?.author.name diff --git a/src/renderer/views/Watch/Watch.vue b/src/renderer/views/Watch/Watch.vue index e5eab3bc24364..9ebe8f80038c7 100644 --- a/src/renderer/views/Watch/Watch.vue +++ b/src/renderer/views/Watch/Watch.vue @@ -150,6 +150,7 @@ :in-user-playlist="!!selectedUserPlaylist" class="watchVideo" :class="{ theatreWatchVideo: useTheatreMode }" + :license="license" @change-format="handleFormatChange" @pause-player="pausePlayer" @set-info-area-sticky="infoAreaSticky = $event" From 15c447b432506ef65fe7c961f8c4de9806b1792d Mon Sep 17 00:00:00 2001 From: Sudharaka Date: Tue, 21 Jan 2025 22:07:47 -0800 Subject: [PATCH 2/3] fix: change the cc license position to video description --- .../WatchVideoDescription/WatchVideoDescription.css | 4 ++++ .../WatchVideoDescription/WatchVideoDescription.vue | 10 ++++++++++ .../components/watch-video-info/watch-video-info.js | 4 ---- .../components/watch-video-info/watch-video-info.vue | 6 ------ src/renderer/views/Watch/Watch.js | 3 +-- src/renderer/views/Watch/Watch.vue | 2 +- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/renderer/components/WatchVideoDescription/WatchVideoDescription.css b/src/renderer/components/WatchVideoDescription/WatchVideoDescription.css index 9c6c207dfd40a..b66aa4897a9c0 100644 --- a/src/renderer/components/WatchVideoDescription/WatchVideoDescription.css +++ b/src/renderer/components/WatchVideoDescription/WatchVideoDescription.css @@ -43,3 +43,7 @@ max-block-size: 4lh; overflow: hidden; } + +.license { + margin-block: 1em; +} diff --git a/src/renderer/components/WatchVideoDescription/WatchVideoDescription.vue b/src/renderer/components/WatchVideoDescription/WatchVideoDescription.vue index 7223d2543494b..ffdee92b5f389 100644 --- a/src/renderer/components/WatchVideoDescription/WatchVideoDescription.vue +++ b/src/renderer/components/WatchVideoDescription/WatchVideoDescription.vue @@ -22,6 +22,12 @@ @timestamp-event="onTimestamp" @click.native="expandDescriptionWithClick" /> + + {{ license }} + -
- {{ license }} -
diff --git a/src/renderer/views/Watch/Watch.js b/src/renderer/views/Watch/Watch.js index 940b90e27f7d5..5574693cd571d 100644 --- a/src/renderer/views/Watch/Watch.js +++ b/src/renderer/views/Watch/Watch.js @@ -82,7 +82,6 @@ export default defineComponent({ isUpcoming: false, isPostLiveDvr: false, isUnlisted: false, - license: null, upcomingTimestamp: null, upcomingTimeLeft: null, /** @type {'dash' | 'audio' | 'legacy'} */ @@ -409,7 +408,7 @@ export default defineComponent({ // extract localised title first and fall back to the not localised one this.videoTitle = result.primary_info?.title.text ?? result.basic_info.title this.videoViewCount = result.basic_info.view_count ?? (result.primary_info.view_count ? extractNumberFromString(result.primary_info.view_count.text) : null) - this.license = result.secondary_info.metadata.rows.matchCondition(element => element.title.text === 'License')?.contents[0].text + this.license = result.secondary_info.metadata.rows.find(element => element.title.text === 'License')?.contents[0].text this.channelId = result.basic_info.channel_id ?? result.secondary_info.owner?.author.id this.channelName = result.basic_info.author ?? result.secondary_info.owner?.author.name diff --git a/src/renderer/views/Watch/Watch.vue b/src/renderer/views/Watch/Watch.vue index 9ebe8f80038c7..b1f9e03c7c61c 100644 --- a/src/renderer/views/Watch/Watch.vue +++ b/src/renderer/views/Watch/Watch.vue @@ -150,7 +150,6 @@ :in-user-playlist="!!selectedUserPlaylist" class="watchVideo" :class="{ theatreWatchVideo: useTheatreMode }" - :license="license" @change-format="handleFormatChange" @pause-player="pausePlayer" @set-info-area-sticky="infoAreaSticky = $event" @@ -169,6 +168,7 @@ v-if="!isLoading && !hideVideoDescription" :description="videoDescription" :description-html="videoDescriptionHtml" + :license="license" class="watchVideo" :class="{ theatreWatchVideo: useTheatreMode }" @timestamp-event="changeTimestamp" From 5d523bdb2863b4bc75d723ddbc710ee42fd96484 Mon Sep 17 00:00:00 2001 From: Sudharaka Date: Tue, 28 Jan 2025 13:01:10 -0800 Subject: [PATCH 3/3] fix: add license only for the full description --- .../components/WatchVideoDescription/WatchVideoDescription.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/renderer/components/WatchVideoDescription/WatchVideoDescription.vue b/src/renderer/components/WatchVideoDescription/WatchVideoDescription.vue index ffdee92b5f389..31a8d784f248f 100644 --- a/src/renderer/components/WatchVideoDescription/WatchVideoDescription.vue +++ b/src/renderer/components/WatchVideoDescription/WatchVideoDescription.vue @@ -23,7 +23,7 @@ @click.native="expandDescriptionWithClick" /> {{ license }}