Skip to content

Commit

Permalink
Support comic book archives
Browse files Browse the repository at this point in the history
  • Loading branch information
wummel committed Jan 9, 2016
1 parent 1d121c4 commit 06166e7
Show file tree
Hide file tree
Showing 28 changed files with 100 additions and 32 deletions.
26 changes: 13 additions & 13 deletions doc/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@ Patool

Patool is an archive file manager.

Various archive formats can be created, extracted, tested, listed,
searched, repacked and compared with patool. The advantage of patool is its simplicity in
handling archive files without having to remember a myriad of
programs and options.
Various archive formats can be created, extracted, tested, listed,
searched, repacked and compared with patool. The advantage of patool is
its simplicity in handling archive files without having to remember a
myriad of programs and options.

The archive format is determined by the file(1) program and as
a fallback by the archive file extension.

patool supports 7z (.7z), ACE (.ace), ADF (.adf), ALZIP (.alz),
patool supports 7z (.7z, .cb7), ACE (.ace, .cba), ADF (.adf), ALZIP (.alz),
APE (.ape), AR (.a), ARC (.arc), ARJ (.arj), BZIP2 (.bz2),
CAB (.cab), COMPRESS (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms),
FLAC (.flac), GZIP (.gz), ISO (.iso), LRZIP (.lrz), LZH (.lha, .lzh),
LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar),
RZIP (.rz), SHN (.shn), TAR (.tar), XZ (.xz), ZIP (.zip, .jar) and
ZOO (.zoo) formats. It relies on helper applications to handle
those archive formats (for example bzip2 for BZIP2 archives).

The archive formats TAR, ZIP, BZIP2 and GZIP
are supported natively and do not require helper
applications to be installed.
LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar, .cbr),
RZIP (.rz), SHN (.shn), TAR (.tar, .cbt), XZ (.xz),
ZIP (.zip, .jar, .cbz) and ZOO (.zoo) archive formats.
It relies on helper applications to handle those archive formats
(for example bzip2 for BZIP2 archives).

The archive formats TAR, ZIP, BZIP2 and GZIP are supported natively
and do not require helper applications to be installed.

Examples
---------
Expand Down
2 changes: 2 additions & 0 deletions doc/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
1.11 (released xx.xx.216)

* Fix 7z unpacking when only p7zip with /usr/bin/7zr is installed.
* Support comic book archives: .cb7 for 7z, .cba for ACE, .cbr for RAR,
.cbt for TAR and .cbz for ZIP archives.


1.10 (released 10.12.2015)
Expand Down
12 changes: 7 additions & 5 deletions doc/patool.1
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,14 @@ files without having to remember a myriad of programs and options.
The archive format is determined by the file(1) program and as a fallback
by the archive file extension.
.PP
\fBpatool\fP supports 7z (.7z), ACE (.ace), ADF (.adf), ALZIP (.alz),
APE (.ape), AR (.a), ARC (.arc), ARJ (.arj),
\fBpatool\fP supports 7z (.7z, .cb7), ACE (.ace, .cba), ADF (.adf),
ALZIP (.alz), APE (.ape), AR (.a), ARC (.arc), ARJ (.arj),
BZIP2 (.bz2), CAB (.cab), COMPRESS (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms),
FLAC (.flac), GZIP (.gz), ISO (.iso), LRZIP (.lrz), LZH (.lha, .lzh), LZIP (.lz),
LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar), RZIP (.rz), SHN (.shn),
TAR (.tar), XZ (.xz), ZIP (.zip, .jar), ZOO (.zoo) and ZPAQ (.zpaq) formats.
FLAC (.flac), GZIP (.gz), ISO (.iso), LRZIP (.lrz), LZH (.lha, .lzh),
LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar, .cbr),
RZIP (.rz), SHN (.shn), TAR (.tar, .cbt), XZ (.xz), ZIP (.zip, .jar, .cbz),
ZOO (.zoo) and ZPAQ (.zpaq) archive formats.
.br
It relies on helper applications to handle those archive formats
(for example bzip2 for BZIP2 archives).
.PP
Expand Down
19 changes: 10 additions & 9 deletions doc/patool.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ DESCRIPTION
The archive format is determined by the file(1) program and as
a fallback by the archive file extension.

patool supports 7z (.7z), ACE (.ace), ADF (.adf), ALZIP (.alz),
APE (.ape), AR (.a), ARC (.arc), ARJ (.arj), BZIP2 (.bz2), CAB
(.cab), COMPRESS (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms),
FLAC (.flac), GZIP (.gz), ISO (.iso), LRZIP (.lrz), LZH (.lha,
.lzh), LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR
(.rar), RZIP (.rz), SHN (.shn), TAR (.tar), XZ (.xz), ZIP
(.zip, .jar), ZOO (.zoo) and ZPAQ (.zpaq) formats. It relies
on helper applications to handle those archive formats (for
example bzip2 for BZIP2 archives).
patool supports 7z (.7z, .cb7), ACE (.ace, .cba), ADF (.adf),
ALZIP (.alz), APE (.ape), AR (.a), ARC (.arc), ARJ (.arj),
BZIP2 (.bz2), CAB (.cab), COMPRESS (.Z), CPIO (.cpio), DEB
(.deb), DMS (.dms), FLAC (.flac), GZIP (.gz), ISO (.iso), LRZIP
(.lrz), LZH (.lha, .lzh), LZIP (.lz), LZMA (.lzma), LZOP
(.lzo), RPM (.rpm), RAR (.rar, .cbr), RZIP (.rz), SHN (.shn),
TAR (.tar, .cbt), XZ (.xz), ZIP (.zip, .jar, .cbz), ZOO (.zoo)
and ZPAQ (.zpaq) archive formats.
It relies on helper applications to handle those archive for‐
mats (for example bzip2 for BZIP2 archives).

The archive formats TAR, ZIP, BZIP2 and GZIP are supported
natively and do not require helper applications to be
Expand Down
5 changes: 5 additions & 0 deletions patoolib/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,14 @@ def add_mimedb_data(mimedb):
add_mimetype(mimedb, 'application/x-xz', '.xz')
add_mimetype(mimedb, 'application/java-archive', '.jar')
add_mimetype(mimedb, 'application/x-rar', '.rar')
add_mimetype(mimedb, 'application/x-rar', '.cbr')
add_mimetype(mimedb, 'application/x-7z-compressed', '.7z')
add_mimetype(mimedb, 'application/x-7z-compressed', '.cb7')
add_mimetype(mimedb, 'application/x-cab', '.cab')
add_mimetype(mimedb, 'application/x-rpm', '.rpm')
add_mimetype(mimedb, 'application/x-debian-package', '.deb')
add_mimetype(mimedb, 'application/x-ace', '.ace')
add_mimetype(mimedb, 'application/x-ace', '.cba')
add_mimetype(mimedb, 'application/x-archive', '.a')
add_mimetype(mimedb, 'application/x-alzip', '.alz')
add_mimetype(mimedb, 'application/x-arc', '.arc')
Expand All @@ -125,12 +128,14 @@ def add_mimedb_data(mimedb):
add_mimetype(mimedb, 'application/x-dms', '.dms')
add_mimetype(mimedb, 'application/x-zip-compressed', '.crx')
add_mimetype(mimedb, 'application/x-shar', '.shar')
add_mimetype(mimedb, 'application/x-tar', '.cbt')
add_mimetype(mimedb, 'application/x-vhd', '.vhd')
add_mimetype(mimedb, 'audio/x-ape', '.ape')
add_mimetype(mimedb, 'audio/x-shn', '.shn')
add_mimetype(mimedb, 'audio/flac', '.flac')
add_mimetype(mimedb, 'application/x-chm', '.chm')
add_mimetype(mimedb, 'application/x-iso9660-image', '.iso')
add_mimetype(mimedb, 'application/zip', '.cbz')
add_mimetype(mimedb, 'application/zip', '.epub')
add_mimetype(mimedb, 'application/zip', '.apk')
add_mimetype(mimedb, 'application/zpaq', '.zpaq')
Expand Down
4 changes: 4 additions & 0 deletions tests/archives/test_7z.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class Test7z (ArchiveTest):
@needs_program(program)
def test_7z (self):
self.archive_commands('t .7z')
self.archive_commands('t .cb7')
self.archive_commands('t.zip')
self.archive_commands('t.cbz')
self.archive_commands('t.txt.xz', check=Content.Singlefile)
self.archive_list('t.txt.gz')
self.archive_list('t.txt.bz2')
Expand Down Expand Up @@ -75,7 +77,9 @@ def test_7z_rar (self):
@needs_program(program)
def test_7z_file (self):
self.archive_commands('t.7z.foo', skip_create=True)
self.archive_commands('t.cb7.foo', skip_create=True)
self.archive_commands('t.zip.foo', skip_create=True)
self.archive_commands('t.cbz.foo', skip_create=True)
self.archive_commands('t.txt.xz.foo', skip_create=True, check=Content.Singlefile)
self.archive_list('t.txt.gz.foo')
self.archive_list('t.txt.bz2.foo')
Expand Down
4 changes: 4 additions & 0 deletions tests/archives/test_7za.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ class Test7za (ArchiveTest):
@needs_program(program)
def test_p7azip (self):
self.archive_commands('t .7z')
self.archive_commands('t .cb7')
self.archive_commands('t.zip')
self.archive_commands('t.cbz')
self.archive_list('t.txt.gz')
self.archive_list('t.txt.bz2')
self.archive_list('t.jar')
Expand All @@ -47,7 +49,9 @@ def test_p7azip (self):
@needs_program(program)
def test_7za_file (self):
self.archive_commands('t.7z.foo', skip_create=True)
self.archive_commands('t.cb7.foo', skip_create=True)
self.archive_commands('t.zip.foo', skip_create=True)
self.archive_commands('t.cbz.foo', skip_create=True)
self.archive_list('t.txt.gz.foo')
self.archive_list('t.txt.bz2.foo')
self.archive_list('t.jar.foo')
Expand Down
2 changes: 2 additions & 0 deletions tests/archives/test_7zr.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ class Test7zr (ArchiveTest):
@needs_program(program)
def test_7zr (self):
self.archive_commands('t .7z')
self.archive_commands('t .cb7')

@needs_program('file')
@needs_program(program)
def test_7z_file (self):
self.archive_commands('t.7z.foo', skip_create=True)
self.archive_commands('t.cb7.foo', skip_create=True)
2 changes: 2 additions & 0 deletions tests/archives/test_bsdtar.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TestBsdtar (ArchiveTest):
@needs_program(program)
def test_bsdtar (self):
self.archive_commands('t.tar')
self.archive_commands('t.cbt')

@needs_codec(program, 'gzip')
def test_bsdtar_gz (self):
Expand Down Expand Up @@ -58,6 +59,7 @@ def test_bsdtar_xz (self):
@needs_program(program)
def test_bsdtar_file (self):
self.archive_commands('t.tar.foo', skip_create=True)
self.archive_commands('t.cbt.foo', skip_create=True)

@needs_program('file')
@needs_codec(program, 'gzip')
Expand Down
3 changes: 2 additions & 1 deletion tests/archives/test_pytarfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class TestPytarfile (ArchiveTest):

def test_py_tarfile (self):
self.archive_commands('t.tar')
self.archive_commands('t.cbt')

def test_py_tarfile_gz (self):
self.archive_commands('t.tar.gz')
Expand All @@ -34,6 +35,7 @@ def test_py_tarfile_bz2 (self):
@needs_program('file')
def test_py_tarfile_file (self):
self.archive_commands('t.tar.foo', skip_create=True)
self.archive_commands('t.cbt.foo', skip_create=True)

@needs_program('file')
def test_py_tarfile_gz_file (self):
Expand All @@ -44,4 +46,3 @@ def test_py_tarfile_gz_file (self):
def test_py_tarfile_bz2_file (self):
self.archive_commands('t.tar.bz2.foo', skip_create=True)
self.archive_commands('t.tbz2.foo', skip_create=True)

2 changes: 2 additions & 0 deletions tests/archives/test_pyzipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@ class TestPyzipfile (ArchiveTest):

def test_py_zipfile(self):
self.archive_commands('t.zip')
self.archive_commands('t.cbz')

@needs_program('file')
def test_py_zipfile_file(self):
self.archive_commands('t.zip.foo', skip_create=True)
self.archive_commands('t.cbz.foo', skip_create=True)

2 changes: 2 additions & 0 deletions tests/archives/test_rar.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ class TestRar (ArchiveTest):
@needs_program(program)
def test_rar(self):
self.archive_commands('t.rar')
self.archive_commands('t.cbr')

@needs_program('file')
@needs_program(program)
def test_rar_file(self):
self.archive_commands('t.rar.foo', skip_create=True)
self.archive_commands('t.cbr.foo', skip_create=True)

3 changes: 2 additions & 1 deletion tests/archives/test_star.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TestStar (ArchiveTest):
@needs_program(program)
def test_star (self):
self.archive_commands('t.tar')
self.archive_commands('t.cbt')

@needs_codec(program, 'gzip')
def test_star_gz (self):
Expand Down Expand Up @@ -57,6 +58,7 @@ def test_star_xz (self):
@needs_program(program)
def test_star_file (self):
self.archive_commands('t.tar.foo', skip_create=True)
self.archive_commands('t.cbt.foo', skip_create=True)

@needs_program('file')
@needs_codec(program, 'gzip')
Expand Down Expand Up @@ -91,4 +93,3 @@ def test_star_lzip_file (self):
@needs_codec(program, 'xz')
def test_star_xz_file (self):
self.archive_commands('t.tar.xz.foo', skip_create=True)

3 changes: 2 additions & 1 deletion tests/archives/test_tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class TestTar (ArchiveTest):
@needs_program(program)
def test_tar (self):
self.archive_commands('t.tar')
self.archive_commands('t.cbt')

@needs_codec(program, 'gzip')
def test_tar_gz (self):
Expand Down Expand Up @@ -59,6 +60,7 @@ def test_tar_xz (self):
@needs_program(program)
def test_tar_file (self):
self.archive_commands('t.tar.foo', skip_create=True)
self.archive_commands('t.cbt.foo', skip_create=True)

@needs_program('file')
@needs_codec(program, 'gzip')
Expand Down Expand Up @@ -96,4 +98,3 @@ def test_tar_lzip_file (self):
@needs_codec(program, 'xz')
def test_tar_xz_file (self):
self.archive_commands('t.tar.xz.foo', skip_create=True)

7 changes: 6 additions & 1 deletion tests/archives/test_unace.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,16 @@ def test_unace(self):
self.archive_list('t.ace')
self.archive_test('t.ace')
self.archive_extract('t.ace')
self.archive_list('t.cba')
self.archive_test('t.cba')
self.archive_extract('t.cba')

@needs_program('file')
@needs_program(program)
def test_unace_file(self):
self.archive_list('t.ace.foo')
self.archive_test('t.ace.foo')
self.archive_extract('t.ace.foo')

self.archive_list('t.cba.foo')
self.archive_test('t.cba.foo')
self.archive_extract('t.cba.foo')
8 changes: 8 additions & 0 deletions tests/archives/test_unzip.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,16 @@ def test_unzip (self):
self.archive_extract('t.zip', check=None)
self.archive_list('t.zip')
self.archive_test('t.zip')
self.archive_extract('t.cbz', check=None)
self.archive_list('t.cbz')
self.archive_test('t.cbz')
self.archive_extract('t.jar', check=None)
self.archive_list('t.jar')
self.archive_test('t.jar')
self.archive_extract('t.epub', check=None)
self.archive_list('t.epub')
self.archive_test('t.epub')
self.archive_extract('t.apk', check=None)
self.archive_list('t.apk')
self.archive_test('t.apk')

Expand All @@ -40,11 +44,15 @@ def test_unzip_file (self):
self.archive_extract('t.zip.foo', check=None)
self.archive_list('t.zip.foo')
self.archive_test('t.zip.foo')
self.archive_extract('t.cbz.foo', check=None)
self.archive_list('t.cbz.foo')
self.archive_test('t.cbz.foo')
self.archive_extract('t.jar.foo', check=None)
self.archive_list('t.jar.foo')
self.archive_test('t.jar.foo')
self.archive_extract('t.epub.foo', check=None)
self.archive_list('t.epub.foo')
self.archive_test('t.epub.foo')
self.archive_extract('t.apk.foo', check=None)
self.archive_list('t.apk.foo')
self.archive_test('t.apk.foo')
12 changes: 12 additions & 0 deletions tests/archives/test_zip.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,20 @@ class TestZip (ArchiveTest):
def test_zip (self):
self.archive_create('t.zip')
self.archive_test('t.zip')
self.archive_create('t.cbz')
self.archive_test('t.cbz')
self.archive_create('t.apk')
self.archive_test('t.apk')
self.archive_create('t.jar')
self.archive_test('t.jar')
self.archive_create('t.epub')
self.archive_test('t.epub')

@needs_program('file')
@needs_program(program)
def test_zip_file (self):
self.archive_test('t.zip.foo')
self.archive_test('t.cbz.foo')
self.archive_test('t.apk.foo')
self.archive_test('t.jar.foo')
self.archive_test('t.epub.foo')
Binary file added tests/data/t .cb7
Binary file not shown.
Binary file added tests/data/t.cb7.foo
Binary file not shown.
Binary file added tests/data/t.cba
Binary file not shown.
Binary file added tests/data/t.cba.foo
Binary file not shown.
Binary file added tests/data/t.cbr
Binary file not shown.
Binary file added tests/data/t.cbr.foo
Binary file not shown.
Binary file added tests/data/t.cbt
Binary file not shown.
Binary file added tests/data/t.cbt.foo
Binary file not shown.
Binary file added tests/data/t.cbz
Binary file not shown.
Binary file added tests/data/t.cbz.foo
Binary file not shown.
Loading

0 comments on commit 06166e7

Please sign in to comment.