Support zpaq files.
This commit is contained in:
parent
aa3fb394de
commit
3b5a9f79ad
|
@ -36,7 +36,7 @@ ArchiveFormats = (
|
|||
'bzip2', 'cab', 'chm', 'compress', 'cpio', 'deb', 'dms',
|
||||
'flac', 'gzip', 'iso', 'lrzip', 'lzh', 'lzip', 'lzma', 'lzop',
|
||||
'rar', 'rpm', 'rzip', 'shar', 'shn', 'tar', 'xz',
|
||||
'zip', 'zoo')
|
||||
'zip', 'zoo', 'zpaq')
|
||||
|
||||
# Supported compressions (used with tar for example)
|
||||
# Note that all compressions must also be archive formats
|
||||
|
@ -80,6 +80,7 @@ ArchiveMimetypes = {
|
|||
'application/x-zip-compressed': 'zip',
|
||||
'application/x-zoo': 'zoo',
|
||||
'application/zip': 'zip',
|
||||
'application/zpaq': 'zpaq',
|
||||
'audio/x-ape': 'ape',
|
||||
'audio/x-shn': 'shn',
|
||||
'audio/flac': 'flac',
|
||||
|
@ -253,6 +254,9 @@ ArchivePrograms = {
|
|||
'zoo': {
|
||||
None: ('zoo',),
|
||||
},
|
||||
'zpaq': {
|
||||
None: ('zpaq',),
|
||||
},
|
||||
'dms': {
|
||||
'extract': ('xdms',),
|
||||
'list': ('xdms',),
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2014 Bastian Kleineidam
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""Archive commands for the zpaq program."""
|
||||
import os
|
||||
|
||||
def extract_zpaq(archive, compression, cmd, verbosity, outdir):
|
||||
"""Extract a ZPAQ archive."""
|
||||
cmdlist = [cmd, 'x', os.path.abspath(archive)]
|
||||
return (cmdlist, {'cwd': outdir})
|
||||
|
||||
|
||||
def list_zpaq(archive, compression, cmd, verbosity):
|
||||
"""List a ZPAQ archive."""
|
||||
return [cmd, 'l', archive]
|
||||
|
||||
|
||||
def create_zpaq(archive, compression, cmd, verbosity, filenames):
|
||||
"""Create a ZPAQ archive."""
|
||||
cmdlist = [cmd, 'c', archive]
|
||||
cmdlist.extend(filenames)
|
||||
return cmdlist
|
||||
|
||||
|
||||
def test_zpaq(archive, compression, cmd, verbosity):
|
||||
"""Test a ZPAQ archive."""
|
||||
return [cmd, 'l', archive]
|
|
@ -131,6 +131,7 @@ def add_mimedb_data(mimedb):
|
|||
add_mimetype(mimedb, 'application/x-iso9660-image', '.iso')
|
||||
add_mimetype(mimedb, 'application/zip', '.epub')
|
||||
add_mimetype(mimedb, 'application/zip', '.apk')
|
||||
add_mimetype(mimedb, 'application/zpaq', '.zpaq')
|
||||
|
||||
|
||||
def add_mimetype(mimedb, mimetype, extension):
|
||||
|
@ -353,6 +354,7 @@ FileText2Mime = {
|
|||
"Monkey's Audio": "audio/x-ape",
|
||||
"FLAC audio bitstream data": "audio/flac",
|
||||
"MS Windows HtmlHelp Data": "application/x-chm",
|
||||
"ZPAQ stream": "application/zpaq",
|
||||
}
|
||||
|
||||
def guess_mime_file_text (file_prog, filename):
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Copyright (C) 2010-2014 Bastian Kleineidam
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
from . import ArchiveTest, Content
|
||||
from .. import needs_program
|
||||
|
||||
class TestZpaq(ArchiveTest):
|
||||
|
||||
program = 'zpaq'
|
||||
|
||||
@needs_program(program)
|
||||
def test_zpaq(self):
|
||||
self.archive_commands('t.zpaq', check=Content.Multifile)
|
||||
|
||||
@needs_program('file')
|
||||
@needs_program(program)
|
||||
def test_zpaq_file(self):
|
||||
self.archive_extract('t.zpaq.foo', check=Content.Multifile)
|
||||
self.archive_test('t.zpaq.foo')
|
||||
self.archive_list('t.zpaq.foo')
|
Binary file not shown.
Binary file not shown.
|
@ -126,6 +126,8 @@ class TestMime (unittest.TestCase):
|
|||
self.mime_test_file("t.iso", "application/x-iso9660-image")
|
||||
self.mime_test_file("t.epub", "application/zip")
|
||||
self.mime_test_file("t.apk", "application/zip")
|
||||
self.mime_test_file("t.zpaq", "application/zpaq")
|
||||
self.mime_test_file("t.zpaq.foo", "application/zpaq")
|
||||
|
||||
@needs_program('file')
|
||||
@needs_program('lzip')
|
||||
|
@ -202,3 +204,4 @@ class TestMime (unittest.TestCase):
|
|||
self.mime_test_mimedb("t.iso", "application/x-iso9660-image")
|
||||
self.mime_test_mimedb("t.epub", "application/zip")
|
||||
self.mime_test_mimedb("t.apk", "application/zip")
|
||||
self.mime_test_mimedb("t.zpaq", "application/zpaq")
|
||||
|
|
Loading…
Reference in New Issue