mirror of
https://github.com/NoCrypt/migu.git
synced 2026-03-11 17:45:32 +00:00
fix: episode list epoch date
This commit is contained in:
parent
2964882536
commit
a3a945bd45
3 changed files with 5 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Miru",
|
||||
"version": "4.2.11",
|
||||
"version": "4.2.12",
|
||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||
"description": "Stream anime torrents, real-time with no waiting for downloads.",
|
||||
"main": "build/main.js",
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ async function getAniDBEpisodeFromAL ({ media, episode }, { episodes, episodeCou
|
|||
|
||||
export function getEpisodeNumberByAirDate (alDate, episodes, episode) {
|
||||
if (!+alDate) return episodes[Number(episode)] || episodes[1] // what the fuck, are you braindead anilist?, the source episode number to play is from an array created from AL ep count, so how come it's missing?
|
||||
// 1 is key for episod 1, not index
|
||||
|
||||
// find closest episodes by air date, multiple episodes can have the same air date distance
|
||||
// ineffcient but reliable
|
||||
|
|
|
|||
|
|
@ -23,12 +23,12 @@
|
|||
const settled = (await episodesPromise).data.Page?.airingSchedules
|
||||
const alEpisodes = settled?.length ? settled : episodeList
|
||||
for (const { episode, airingAt } of alEpisodes) {
|
||||
const airdate = new Date((airingAt || 0) * 1000)
|
||||
const alDate = new Date((airingAt || 0) * 1000)
|
||||
|
||||
const needsValidation = !(!specialCount || (media.episodes && media.episodes === episodeCount && episodes[Number(episode)]))
|
||||
const { image, summary, rating, title, length } = needsValidation ? getEpisodeNumberByAirDate(airdate, episodes, episode) : (episodes[Number(episode)] || {})
|
||||
const { image, summary, rating, title, length, airdate } = needsValidation ? getEpisodeNumberByAirDate(alDate, episodes, episode) : (episodes[Number(episode)] || {})
|
||||
|
||||
episodeList[episode - 1] = { episode, image, summary, rating, title, length: length || duration, airdate }
|
||||
episodeList[episode - 1] = { episode, image, summary, rating, title, length: length || duration, airdate: +alDate || airdate }
|
||||
}
|
||||
}
|
||||
load()
|
||||
|
|
|
|||
Loading…
Reference in a new issue