mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-20 19:52:04 +00:00
fix: chapters
This commit is contained in:
parent
ce3665f2d8
commit
667062031e
3 changed files with 6 additions and 6 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ui",
|
||||
"version": "6.1.0",
|
||||
"version": "6.1.1",
|
||||
"license": "BUSL-1.1",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@9.14.4",
|
||||
|
|
|
|||
|
|
@ -71,8 +71,8 @@ export async function getChaptersAniSkip (idMal: number, episode: number, durati
|
|||
const chapters = results.map(result => {
|
||||
const diff = duration - result.episodeLength
|
||||
return {
|
||||
start: (result.interval.startTime + diff) * 1000,
|
||||
end: (result.interval.endTime + diff) * 1000,
|
||||
start: Math.max(0, (result.interval.startTime + diff) * 1000),
|
||||
end: Math.min(duration * 1000, Math.max(0, (result.interval.endTime + diff) * 1000)),
|
||||
text: result.skipType.toUpperCase()
|
||||
}
|
||||
})
|
||||
|
|
@ -122,8 +122,8 @@ export function sanitizeChapters (chapters: Chapter[], length: number): Chapter[
|
|||
let currentTime = 0
|
||||
|
||||
const sortedChapters = chapters.map(chapter => {
|
||||
const end = Math.min(length, chapter.end)
|
||||
const start = Math.min(Math.max(0, chapter.start), end)
|
||||
const end = Math.max(0, Math.min(length, chapter.end / 1000))
|
||||
const start = Math.min(Math.max(0, chapter.start / 1000), end)
|
||||
return { start, end, text: chapter.text }
|
||||
}).sort((a, b) => a.start - b.start)
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ export default Object.assign<Native, Partial<Native>>({
|
|||
{ start: 1.0 * 60, end: 1.2 * 60, text: 'Chapter 1' },
|
||||
{ start: 1.4 * 60, end: 88, text: 'Chapter 2 ' }
|
||||
],
|
||||
version: async () => 'v6.0.0',
|
||||
version: async () => 'v6.1.0',
|
||||
updateSettings: async () => undefined,
|
||||
setDOH: async () => undefined,
|
||||
cachedTorrents: async () => ['40a9047de61859035659e449d7b84286934486b0'],
|
||||
|
|
|
|||
Loading…
Reference in a new issue