route v1
All checks were successful
Deploy App / build (push) Successful in 2m25s
Deploy App / deploy (push) Successful in 15s

This commit is contained in:
valere
2025-10-21 00:09:26 +02:00
parent 61b0b6395f
commit f59c496c5d
18 changed files with 391 additions and 137 deletions

View File

@@ -136,12 +136,34 @@ export const usePlayerStore = defineStore('player', {
if (!isNaN(progression)) {
this.progressionLast = progression
}
// update current track when changing time in compilation
const cur = this.currentTrack
if (cur && cur.type === 'compilation') {
const dataStore = useDataStore()
const tracks = dataStore
.getTracksByboxId(cur.boxId)
.slice()
.filter((t) => t.type === 'compilation')
.sort((a, b) => (a.start ?? 0) - (b.start ?? 0))
// auto advance behavior: playlists use 'ended', compilations use time boundary
const track = this.currentTrack
if (!track) return
const dataStore = useDataStore()
const t = audio.currentTime
if (tracks.length > 0) {
const now = audio.currentTime
// find the last track whose start <= now (fallback to first track)
let found = tracks[0]
for (const t of tracks) {
const s = t.start ?? 0
if (s <= now) {
found = t
} else {
break
}
}
if (found && found.id !== cur.id) {
// only update metadata reference; do not reload audio
this.currentTrack = found
}
}
}
}
},