#69 Look inside the file (with libmagic) to determined file-type

Unstable (example)
open
5
2012-01-10
2012-01-10
Mikhail Teterin
No

Currently minidlna determines the file-type based on the filename extension. Although faster, this is a MS-DOS/Windows way :-)

Perhaps, using libmagic(3) API should be an option? The attached patch provides a simple-minded illustration -- if the use of libmagic is deemed a good idea, things would have to be rearranged to avoid re-opening the file multiple times (as is done by magic_file(3)).

Also, libmagic's results can be used to set the mime-type for the accepted files...

Discussion

  • Sample implementation of is_image() and friends using libmagic(3) API

     
    Attachments