mirror of
https://github.com/ThaUnknown/miru.git
synced 2026-04-21 07:32:04 +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",
|
"name": "Miru",
|
||||||
"version": "1.1.3",
|
"version": "1.1.4",
|
||||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
"homepage": "https://github.com/ThaUnknown/miru#readme",
|
"homepage": "https://github.com/ThaUnknown/miru#readme",
|
||||||
|
|
|
||||||
|
|
@ -76,12 +76,6 @@ function createWindow () {
|
||||||
mainWindow.webContents.openDevTools()
|
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.
|
// Emitted when the window is closed.
|
||||||
mainWindow.on('closed', () => {
|
mainWindow.on('closed', () => {
|
||||||
// Dereference the window object, usually you would store windows
|
// 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 rootHighest = (rootMedia.nextAiringEpisode?.episode || rootMedia.episodes)
|
||||||
|
|
||||||
const prequel = !increment && findEdge(media, 'PREQUEL')?.node
|
const prequel = !increment && findEdge(media, 'PREQUEL', undefined, force)?.node
|
||||||
const sequel = !prequel && findEdge(media, 'SEQUEL')?.node
|
const sequel = !prequel && (increment || increment == null) && findEdge(media, 'SEQUEL', undefined, force)?.node
|
||||||
const edge = prequel || sequel
|
const edge = prequel || sequel
|
||||||
increment = !prequel
|
increment = increment ?? !prequel
|
||||||
|
|
||||||
if (!prequel && !sequel) {
|
if (!edge) {
|
||||||
const obj = { media, episode: episode - offset, offset, increment, rootMedia }
|
const obj = { media, episode: episode - offset, offset, increment, rootMedia }
|
||||||
if (!force) {
|
if (!force) {
|
||||||
console.warn('Error in parsing!', obj)
|
console.warn('Error in parsing!', obj)
|
||||||
|
|
@ -210,7 +210,7 @@ async function resolveSeason (opts) {
|
||||||
const diff = episode - (highest + offset)
|
const diff = episode - (highest + offset)
|
||||||
media = temp
|
media = temp
|
||||||
offset += highest
|
offset += highest
|
||||||
if (diff <= rootHighest) {
|
if (!force && diff <= rootHighest) {
|
||||||
episode -= offset
|
episode -= offset
|
||||||
if (sequel) rootMedia = temp
|
if (sequel) rootMedia = temp
|
||||||
return { media, episode, offset, increment, rootMedia }
|
return { media, episode, offset, increment, rootMedia }
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue