Skip to content

Commit 587dadc

Browse files
reuse template in the view when possible
1 parent bd8f0c9 commit 587dadc

File tree

3 files changed

+5
-37
lines changed

3 files changed

+5
-37
lines changed

src/renderer/helpers/api/local.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ClientType, Innertube, Misc, Mixins, Parser, UniversalCache, Utils, YT, YTNodes } from 'youtubei.js'
1+
import { ClientType, Innertube, Misc, Parser, UniversalCache, Utils, YT, YTNodes } from 'youtubei.js'
22
import Autolinker from 'autolinker'
33
import { IpcChannels, SEARCH_CHAR_LIMIT } from '../../../constants'
44

@@ -256,10 +256,7 @@ export async function getLocalVideoInfo(id) {
256256
}
257257

258258
if (hasTrailer && info.playability_status.status !== 'OK') {
259-
/** @type {import('youtubei.js').YTNodes.PlayerLegacyDesktopYpcTrailer | import('youtubei.js').YTNodes.YpcTrailer} */
260-
const trailerScreen = info.playability_status.error_screen
261-
262-
const trailerInfo = new Mixins.MediaInfo([{ data: trailerScreen.trailer.player_response }])
259+
const trailerInfo = info.getTrailerInfo()
263260

264261
// don't override the timestamp of when the video will premiere for upcoming videos
265262
if (info.playability_status.status !== 'LIVE_STREAM_OFFLINE') {

src/renderer/views/Watch/Watch.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
}
5353
}
5454

55-
.trailer.premiereDate {
55+
.trailer .premiereDate {
5656
margin-block-start: 8px;
5757
}
5858

src/renderer/views/Watch/Watch.vue

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -49,42 +49,13 @@
4949
@toggle-autoplay="toggleAutoplay"
5050
@playback-rate-updated="updatePlaybackRate"
5151
/>
52-
<div
53-
v-if="!isLoading && isUpcoming && playabilityStatus === 'OK'"
54-
class="trailer premiereDate"
55-
>
56-
<font-awesome-icon
57-
:icon="['fas', 'satellite-dish']"
58-
class="premiereIcon"
59-
/>
60-
<p
61-
v-if="upcomingTimestamp !== null"
62-
class="premiereText"
63-
>
64-
<span
65-
class="premiereTextTimeLeft"
66-
>
67-
{{ $t("Video.Premieres") }} {{ upcomingTimeLeft }}
68-
</span>
69-
<br>
70-
<span
71-
class="premiereTextTimestamp"
72-
>
73-
{{ upcomingTimestamp }}
74-
</span>
75-
</p>
76-
<p
77-
v-else
78-
class="premiereText"
79-
>
80-
{{ $t("Video.Starting soon, please refresh the page to check again") }}
81-
</p>
82-
</div>
8352
<div
8453
v-else-if="!isLoading && (isUpcoming || errorMessage)"
8554
class="videoPlayer"
55+
:class="{trailer: isUpcoming && playabilityStatus === 'OK'}"
8656
>
8757
<img
58+
v-if="!isUpcoming || playabilityStatus !== 'OK'"
8859
:src="thumbnail"
8960
class="videoThumbnail"
9061
alt=""

0 commit comments

Comments
 (0)