Add flac file detection.

This commit is contained in:
Bastian Kleineidam 2012-05-17 14:59:33 +02:00
parent de18ff9ca3
commit 52762df5c6
5 changed files with 8 additions and 1 deletions

View File

@ -23,7 +23,7 @@ ArchiveCommands = ('list', 'extract', 'test', 'create')
# Supported archive formats
ArchiveFormats = ('7z', 'ace', 'alzip', 'ape', 'ar', 'arc', 'arj', 'bzip2',
'cab', 'compress', 'cpio', 'deb', 'dms', 'gzip', 'lrzip', 'lzh',
'cab', 'compress', 'cpio', 'deb', 'dms', 'flac', 'gzip', 'lrzip', 'lzh',
'lzip', 'lzma', 'lzop', 'rar', 'rpm', 'rzip', 'shn', 'tar', 'xz',
'zip', 'zoo')
@ -66,6 +66,7 @@ ArchiveMimetypes = {
'application/x-dms': 'dms',
'audio/x-ape': 'ape',
'audio/x-shn': 'shn',
'audio/flac': 'flac',
}
# List of programs supporting the given archive format and command.
@ -104,6 +105,8 @@ ArchivePrograms = {
'create': ('pbzip2', 'lbzip2', 'bzip2', 'py_bz2'),
'list': ('py_echo',),
},
'flac': {
},
'tar': {
None: ('tar', 'star', 'py_tarfile'),
},

View File

@ -246,6 +246,7 @@ FileText2Mime = {
"Zoo archive data": "application/x-zoo",
"DMS archive data": "application/x-dms",
"Monkey's Audio": "audio/x-ape",
"FLAC audio bitstream data": "audio/flac",
}
def guess_mime_file_text (file_prog, filename):

BIN
tests/data/t.flac Normal file

Binary file not shown.

BIN
tests/data/t.flac.foo Normal file

Binary file not shown.

View File

@ -121,6 +121,8 @@ class TestMime (unittest.TestCase):
# file(1) does not recognize .shn files
#self.mime_test_file("t.shn", "audio/x-shn", None)
#self.mime_test_file("t.shn.foo", "audio/x-shn", None)
self.mime_test_file("t.flac", "audio/flac", None)
self.mime_test_file("t.flac.foo", "audio/flac", None)
@needs_program('file')
@needs_program('lzip')
@ -190,3 +192,4 @@ class TestMime (unittest.TestCase):
self.mime_test_mimedb("t.dms", "application/x-dms", None)
self.mime_test_mimedb("t.ape", "audio/x-ape", None)
self.mime_test_mimedb("t.shn", "audio/x-shn", None)
self.mime_test_mimedb("t.flac", "audio/flac", None)