Changeset 11660


Ignore:
Timestamp:
19 May 2014, 17:30:44 (11 years ago)
Author:
uli
Message:

Add fileformat checker for fpm files.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/helpers.py

    r11476 r11660  
    619619
    620620
     621def imghdr_test_fpm(h, f):
     622    """FPM fileformat test.
     623
     624    The `fpm` fileformat is the binary fingerprint data as created by
     625    `libfprint`.
     626    """
     627    if len(h) >= 3 and h[:3] == 'FP1':
     628        return 'fpm'
     629
     630
     631#: Add test function in stdlib's imghdr tests.
     632imghdr.tests.append(imghdr_test_fpm)
     633
     634
    621635def get_fileformat(path, bytestream=None):
    622636    """Try to determine the file format of a given media file.
     
    632646    file-format can be recognized, ``None`` else.
    633647
    634     Tested recognized filetypes currently are `jpg`, `png`, and `pdf`.
     648    Tested recognized filetypes currently are `jpg`, `png`, `fpm`, and
     649    `pdf`.
    635650
    636651    More filetypes (though untested in waeup.kofa) are automatically
Note: See TracChangeset for help on using the changeset viewer.