Add track position

environments/review-docs-renov-b1i8ag/deployments/15025
wvffle 2022-10-28 14:42:46 +00:00 zatwierdzone przez Georg Krause
rodzic 8c62d516b0
commit db932f2470
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 2970D504B2183D22
2 zmienionych plików z 4 dodań i 5 usunięć

Wyświetl plik

@ -31,6 +31,7 @@ export interface QueueTrack {
title: string
artistName: string
albumTitle: string
position?: number
// TODO: Add urls for those
coverUrl: string
@ -109,10 +110,9 @@ export const useQueue = createGlobalState(() => {
return {
id: track.id,
title: track.title,
// TODO (wvffle): i18n
artistName: track.artist?.name ?? $pgettext('*/*/*', 'Unknown artist'),
// TODO (wvffle): i18n
albumTitle: track.album?.title ?? $pgettext('*/*/*', 'Unknown album'),
position: track.position,
artistId: track.artist?.id ?? -1,
albumId: track.album?.id ?? -1,
coverUrl: (track.cover?.urls ?? track.album?.cover?.urls ?? track.artist?.cover?.urls)?.original
@ -171,7 +171,7 @@ export const useQueue = createGlobalState(() => {
if (currentIndex.value !== trackIndex) currentSound.value?.seekTo(0)
const shouldRestart = forceRestartIfCurrent && currentIndex.value === trackIndex
const nextTrackIsTheSame = queue.value[trackIndex].id === currentTrack.value.id
const nextTrackIsTheSame = queue.value[trackIndex]?.id === currentTrack.value?.id
if (shouldRestart || nextTrackIsTheSame) {
currentSound.value?.seekTo(0)

Wyświetl plik

@ -176,8 +176,7 @@ export default (props: PlayOptionsProps) => {
addMessage(tracksToPlay)
}
const activateTrack = async (track: Track, index: number) => {
// TODO (wvffle): Check if position checking did not break anything
const activateTrack = async (track: Track) => {
if (track.id === currentTrack.value?.id && track.position === currentTrack.value?.position) {
isPlaying.value = true
}