Video-hub-app: Error extracting screenshots (reduce empty array with no initial value)

Created on 1 Feb 2020  路  10Comments  路  Source: whyboris/Video-Hub-App

The new code added in #338 causes a bug (should be easy to fix)

Results in:

image

Happens here:
https://github.com/whyboris/Video-Hub-App/blob/master/main-support.ts#L393

@kevinseelbach

bug

Most helpful comment

Closed with #354 馃憤
Thank you @kevinseelbach 馃

Don't thank me too soon @whyboris

A file without metadata.streams will still throw an error at the next line after getBestStream is called:

      const stream = getBestStream(metadata);
      const fileDuration = metadata.streams[0].duration || metadata.format.duration;

Wouldn't it be ideal to wrap the entire extractMetadataForThisONEFile call in a try/catch somewhere so you don't have to worry about a single bad file crashing the entire app and extraction process? So far, I've needed to quit the app when errors are raised during scanning, because the progress bar just freezes wherever it is.

All 10 comments

@whyboris sorry about that , i think this will fix it
https://github.com/whyboris/Video-Hub-App/pull/354

No worries at all! I should have caught it -- I'm just unfamiliar with how reliable the _ffmpeg_ output is when it comes to identifying streams.

As far as I can tell this happens in exceedingly rare cases -- I only had 2 bug reports occur and it hasn't happened to me 馃し鈥嶁檪

No rush -- and do let me know if you prefer I fix it -- seems like just setting an initial value in the .reduce will fix the problem.

As far as I can tell this happens in exceedingly rare cases -- I only had 2 bug reports occur and it hasn't happened to me 馃し鈥嶁檪

I think it would only happen on files that do not have any streams. I pushed some commits that should fix the issue? Just wrap it in a try/catch
@whyboris
https://github.com/kevinseelbach/Video-Hub-App/commit/11f24005c77cf23fb14746ddfc2bcfee9bdfc83d

Sorry I've not gotten back to VHA this week -- had been busy with my 3 other projects 馃槄

I'll try to merge in your change tomorrow (just want to test it for a second before merging 馃憣 ).

Closed with #354 馃憤
Thank you @kevinseelbach 馃

Closed with #354 馃憤
Thank you @kevinseelbach 馃

Don't thank me too soon @whyboris

A file without metadata.streams will still throw an error at the next line after getBestStream is called:

      const stream = getBestStream(metadata);
      const fileDuration = metadata.streams[0].duration || metadata.format.duration;

Wouldn't it be ideal to wrap the entire extractMetadataForThisONEFile call in a try/catch somewhere so you don't have to worry about a single bad file crashing the entire app and extraction process? So far, I've needed to quit the app when errors are raised during scanning, because the progress bar just freezes wherever it is.

@kevinseelbach I may have a solution with #357 馃槄

I'm uneasy at this time about wrapping the whole extractMetadataForThisONEFile because I'm unsure how the app will behave with nothing returned ... I think with this we squashed the last possible bug in this method 馃

That looks good!

Unrelated, but why the file scanning process (for example rescan) is sync and not async? Im guessing there is very good reason just trying to understand why

There isn't a particularly good reason why the process is _sync_ instead of _async_.

When the scan is happening I wanted to lock up the app so no state could change. It would require some care to not let users mess around with things while the extraction process is happening, so I took a shortcut: just disallow any interaction.

It _would_ be good to let users at least minimize the app 馃槄 I think currently at least for a short period of time the app is just frozen.

I'm happy to accept a PR updating things for the better -- it's just a lower-priority than adding some cool features 馃し鈥嶁檪

All feedback & questions welcome! I may have not fully addressed your question as well.

Makes sense! On Mac at least you can definitely minimize or change apps, fyi, just can鈥檛 navigate or do anything within the app until scanning is complete

Was this page helpful?
0 / 5 - 0 ratings

Related issues

whyboris picture whyboris  路  3Comments

cal2195 picture cal2195  路  4Comments

cal2195 picture cal2195  路  6Comments

cal2195 picture cal2195  路  5Comments

whyboris picture whyboris  路  5Comments