Bugfix for tag traversal in anime ID retrieval
This commit is contained in:
parent
305c20f5a6
commit
8e1196cd98
@ -289,8 +289,13 @@ export default class AudioPlayer {
|
|||||||
this.trackLink.href = "/soundtrack/" + track.id
|
this.trackLink.href = "/soundtrack/" + track.id
|
||||||
this.trackLink.textContent = track.title.canonical || track.title.native
|
this.trackLink.textContent = track.title.canonical || track.title.native
|
||||||
|
|
||||||
|
// Find anime ID by looking at the tags
|
||||||
let animeId = ""
|
let animeId = ""
|
||||||
|
|
||||||
|
if(!track.tags) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
for(let tag of (track.tags as string[])) {
|
for(let tag of (track.tags as string[])) {
|
||||||
if(tag.startsWith("anime:")) {
|
if(tag.startsWith("anime:")) {
|
||||||
animeId = tag.split(":")[1]
|
animeId = tag.split(":")[1]
|
||||||
@ -298,8 +303,11 @@ export default class AudioPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(animeId === "") {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// Set anime info
|
// Set anime info
|
||||||
if(animeId !== "") {
|
|
||||||
this.animeInfo.classList.remove("hidden")
|
this.animeInfo.classList.remove("hidden")
|
||||||
let animeResponse = await fetch("/api/anime/" + animeId)
|
let animeResponse = await fetch("/api/anime/" + animeId)
|
||||||
let anime = await animeResponse.json() as Anime
|
let anime = await animeResponse.json() as Anime
|
||||||
@ -309,5 +317,4 @@ export default class AudioPlayer {
|
|||||||
this.animeImage.classList.remove("hidden")
|
this.animeImage.classList.remove("hidden")
|
||||||
this.animeImage["became visible"]()
|
this.animeImage["became visible"]()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user