Skip to content

Commit

Permalink
reuse template in the view when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
ChunkyProgrammer committed Jan 21, 2025
1 parent eeb0c48 commit be1663d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 37 deletions.
7 changes: 2 additions & 5 deletions src/renderer/helpers/api/local.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ClientType, Innertube, Misc, Mixins, Parser, UniversalCache, Utils, YT, YTNodes } from 'youtubei.js'
import { ClientType, Innertube, Misc, Parser, UniversalCache, Utils, YT, YTNodes } from 'youtubei.js'
import Autolinker from 'autolinker'
import { IpcChannels, SEARCH_CHAR_LIMIT } from '../../../constants'

Expand Down Expand Up @@ -256,10 +256,7 @@ export async function getLocalVideoInfo(id) {
}

if (hasTrailer && info.playability_status.status !== 'OK') {
/** @type {import('youtubei.js').YTNodes.PlayerLegacyDesktopYpcTrailer | import('youtubei.js').YTNodes.YpcTrailer} */
const trailerScreen = info.playability_status.error_screen

const trailerInfo = new Mixins.MediaInfo([{ data: trailerScreen.trailer.player_response }])
const trailerInfo = info.getTrailerInfo()

// don't override the timestamp of when the video will premiere for upcoming videos
if (info.playability_status.status !== 'LIVE_STREAM_OFFLINE') {
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/Watch/Watch.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
}
}

.trailer.premiereDate {
.trailer .premiereDate {
margin-block-start: 8px;
}

Expand Down
33 changes: 2 additions & 31 deletions src/renderer/views/Watch/Watch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -49,42 +49,13 @@
@toggle-autoplay="toggleAutoplay"
@playback-rate-updated="updatePlaybackRate"
/>
<div
v-if="!isLoading && isUpcoming && playabilityStatus === 'OK'"
class="trailer premiereDate"
>
<font-awesome-icon
:icon="['fas', 'satellite-dish']"
class="premiereIcon"
/>
<p
v-if="upcomingTimestamp !== null"
class="premiereText"
>
<span
class="premiereTextTimeLeft"
>
{{ $t("Video.Premieres") }} {{ upcomingTimeLeft }}
</span>
<br>
<span
class="premiereTextTimestamp"
>
{{ upcomingTimestamp }}
</span>
</p>
<p
v-else
class="premiereText"
>
{{ $t("Video.Starting soon, please refresh the page to check again") }}
</p>
</div>
<div
v-else-if="!isLoading && (isUpcoming || errorMessage)"
class="videoPlayer"
:class="{trailer: isUpcoming && playabilityStatus === 'OK'}"
>
<img
v-if="!isUpcoming || playabilityStatus !== 'OK'"
:src="thumbnail"
class="videoThumbnail"
alt=""
Expand Down

0 comments on commit be1663d

Please sign in to comment.