mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-05 04:19:59 +00:00
fix: edge case when season resolving would get stuck in an infinite loop
This commit is contained in:
parent
264b267f57
commit
a0b1d4d60f
3 changed files with 6 additions and 12 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Miru",
|
||||
"version": "1.1.3",
|
||||
"version": "1.1.4",
|
||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||
"main": "src/index.js",
|
||||
"homepage": "https://github.com/ThaUnknown/miru#readme",
|
||||
|
|
|
|||
|
|
@ -76,12 +76,6 @@ function createWindow () {
|
|||
mainWindow.webContents.openDevTools()
|
||||
}
|
||||
|
||||
// Uncomment the following line of code when app is ready to be packaged.
|
||||
// loadURL(mainWindow);
|
||||
|
||||
// Open the DevTools and also disable Electron Security Warning.
|
||||
process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = true
|
||||
|
||||
// Emitted when the window is closed.
|
||||
mainWindow.on('closed', () => {
|
||||
// Dereference the window object, usually you would store windows
|
||||
|
|
|
|||
|
|
@ -186,12 +186,12 @@ async function resolveSeason (opts) {
|
|||
|
||||
const rootHighest = (rootMedia.nextAiringEpisode?.episode || rootMedia.episodes)
|
||||
|
||||
const prequel = !increment && findEdge(media, 'PREQUEL')?.node
|
||||
const sequel = !prequel && findEdge(media, 'SEQUEL')?.node
|
||||
const prequel = !increment && findEdge(media, 'PREQUEL', undefined, force)?.node
|
||||
const sequel = !prequel && (increment || increment == null) && findEdge(media, 'SEQUEL', undefined, force)?.node
|
||||
const edge = prequel || sequel
|
||||
increment = !prequel
|
||||
increment = increment ?? !prequel
|
||||
|
||||
if (!prequel && !sequel) {
|
||||
if (!edge) {
|
||||
const obj = { media, episode: episode - offset, offset, increment, rootMedia }
|
||||
if (!force) {
|
||||
console.warn('Error in parsing!', obj)
|
||||
|
|
@ -210,7 +210,7 @@ async function resolveSeason (opts) {
|
|||
const diff = episode - (highest + offset)
|
||||
media = temp
|
||||
offset += highest
|
||||
if (diff <= rootHighest) {
|
||||
if (!force && diff <= rootHighest) {
|
||||
episode -= offset
|
||||
if (sequel) rootMedia = temp
|
||||
return { media, episode, offset, increment, rootMedia }
|
||||
|
|
|
|||
Loading…
Reference in a new issue