whyboris/Video-Hub-App

JavaScript Error JSON

Pompey69 opened this issue ยท 7 comments

I'm on mac osx, would love some help on anything I can do to prevent this bug

I'm getting a:

A JavaScript error occurred in the main process

Uncaught Exception:
SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at /Applications/Video Hub App 3.app/Contents/Resources/app.asar/main.js:215:36
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:61:3)

https://ibb.co/MRyL59M

Sorry about this bug - I really should have had this fixed by now ... I thought I did ๐Ÿ˜“

Just to be sure, when you click OK does the app resume normal operations, or is it frozen?

There are two possible reasons:

  1. the settings.json file got corrupt, and now the app doesn't remember your settings.
    • I don't think that's what happened here - looks like the app remembers your "recently-opened" history
  2. the .vha2 file (hub) you are trying to open is corrupt and the app will not be able to open it.
    • This can be fixed, please back up the.vha2 and .vha2.bak file just in case (copy to another location) and then rename the .vha2.bak file to .vha2 and the last-successfully-saved version of the hub should be there.

Please let me know how it goes, and whether you're on version 3.1.0 (latest release -- click on settings, scroll to very bottom, see on the right).

I am on version 3.1.
The app did not resume normal operations, I couldn't keep going it was frozen.

I was able to use the backup. My follow up question is, does it create another backup after I use that one?

Thanks!

Sorry I've been busy with work and life stuff and forgot to reply ๐Ÿ˜…

The backup is created, IIRC (if I recall correctly), whenever a new .vha2 is saved. The new .vha2 file is saved every time there is an update to the hub (e.g. a tag is added/removed, new video added, or a file is played -- because the "number of times played" goes up by 1). Just opening the hub and searching and browsing does not cause an update to the hub.

is there at least some way to decrease the frequency that this error occurs? without having to completely empty the thumbnail cache? like i've been doing the above workaround for a while but it used be required like once a week and now it gives me the error like every other time I open the app

Thank you for sharing that you too have this bug. Could you clarify what exactly is happening? It's not clear to me what you mean by "empty the thumbnail cache" - are you deleting the .jpg files? Unsure why that would be useful.

Is there any pattern about when / why the bug happens? Is it after using the app and closing the computer in some different way (standby mode / sleep / shutdown) while having the app open? If there's any pattern you notice, or a hypothesis you have - all will be welcome - I don't know what's causing the issue (I never run into it on my machine) ๐Ÿ˜…

Thank you for any feedback ๐Ÿ™‡

sorry just saw this, by emptying the cache I mean just going into AppData/Roaming and clearing everything out and then doing a reinstall (worst case scenario for me), although this didn't totally fix the problem it just made it so whenever I constructed a new library, it worked for a longer stretch of time before starting up with the .json error.

It takes forever to reload my thumbnails (I use the animated ones) after starting from scratch and even then the progress bar in the upper right will go to 100% after however many hours, but then every time I open the app after it will be at the same random percentage (80% for example) and just stay with that in the upper right corner even though it had previously "completed" building the thumbnails back. I think this might have something to do with why I'm getting the error (just a hunch), because I noticed the "stuck percentage" issue and the .json error started happening around the same time. I don't think it likes that I close the app while it's "loading", which I have to because like I said, it just stays at some percentage and goes back to the same number the next time I successfully open the library.

This is what I get when I try to open the "corrupted" library until I do your "rename the .bak file" trick.

image

@lolDayus -- I'm unsure, but it seems like you might have "watch folder" enabled - so the hub, as soon as it opens, triggers a full re-scan of the input directory and then tries to add any videos.

There's likely a bug (my fault) where something weird happens (unsure what) and in the process of rescanning, it gets tripped up. I think I've seen some unexpected behavior on my end when rescanning a directory where I deleted a single video file - and the progress bar showed up and got stuck.

I wonder if there's also some bug that closing the app while the extraction is running, something unexpected happens. I'm pretty sure I put in a "stop import process first" before starting the close procedure, but just in case, please press "Stop" if it's visible - before closing. Though I think the "Stop" might not disappear even if you press it - I think I saw that bug once.

The takeaway: if you have "watch folder" enabled, consider disabling it -- perhaps this file-corruption bug will go away ๐Ÿคž ๐Ÿ˜… ๐Ÿคž

I do hope to have a bugfix release in the coming months, but now it looks like it would be in July at the earliest ๐Ÿ˜“ If you are able to compile the app from code - give it a try: the current main branch already has FFmpeg version 5 which might help with extraction ๐Ÿคทโ€โ™‚๏ธ