h5ai icon indicating copy to clipboard operation
h5ai copied to clipboard

Fix thumbnail generation for mis-detected file types

Open glubsy opened this issue 3 years ago • 1 comments

  • If a file failed to be detected via filename extension by the javascript frontend, try to detect its type to generate a thumbnail.
  • Use mime type detection to determine the actual file type (if FileInfo module is indeed loaded, otherwise skip detection).
  • Don't write capture file to hard drive disk anymore, but keep it in memory until final thumbnails have been generated.
  • Fix SWF files not having thumbnails generated when they could (usually they can be handled by ffmpeg).
  • Various performance improvements by reducing superfluous or redundant checks.

Fixes #770.

glubsy avatar Nov 28 '20 19:11 glubsy

Note:

  • This is based off of the base branch in #765, this is a continuation/extension of that work.
  • I don't see the point in keeping capture files on disk, since they are only used once or twice, and then just sit there wasting disk space forever. Instead, I chose to keep the capture data in memory until the final thumbnails have been generated, after which it will be discarded.
  • I tried to make the code as clear as possible, had to refactor things to that end.
  • Even if the thumbnail is generated for a file, the javascript front-end still doesn't know the actual file type. This might need an update to the javascript code for "previews". It should not be too hard to send back the detected file type in the response to the request and use the proper player.

glubsy avatar Nov 28 '20 20:11 glubsy