Add support for flac files.
This commit is contained in:
parent
52762df5c6
commit
36c2be760d
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
* Added support for Monkey's Audio Compressor handling APE (.ape) files.
|
* Added support for Monkey's Audio Compressor handling APE (.ape) files.
|
||||||
* Added support for shorten handling SHN (.shn) files.
|
* Added support for shorten handling SHN (.shn) files.
|
||||||
|
* Added support for flac handling FLAC (.flac) files.
|
||||||
|
|
||||||
|
|
||||||
0.16 "Game of thrones" (released 12.5.2012)
|
0.16 "Game of thrones" (released 12.5.2012)
|
||||||
|
|
|
@ -32,9 +32,9 @@ by the archive file extension.
|
||||||
\fBpatool\fP supports 7z (.7z), ACE (.ace), ALZIP (.alz), APE (.ape), AR (.a),
|
\fBpatool\fP supports 7z (.7z), ACE (.ace), ALZIP (.alz), APE (.ape), AR (.a),
|
||||||
ARC (.arc), ARJ (.arj),
|
ARC (.arc), ARJ (.arj),
|
||||||
BZIP2 (.bz2), CAB (.cab), compress (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms),
|
BZIP2 (.bz2), CAB (.cab), compress (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms),
|
||||||
GZIP (.gz), LRZIP (.lrz), LZH (.lha, .lzh), LZIP (.lz), LZMA (.lzma),
|
FLAC (.flac), GZIP (.gz), LRZIP (.lrz), LZH (.lha, .lzh), LZIP (.lz),
|
||||||
LZOP (.lzo), RPM (.rpm), RAR (.rar), RZIP (.rz), SHN (.shn), TAR (.tar),
|
LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar), RZIP (.rz), SHN (.shn),
|
||||||
XZ (.xz), ZIP (.zip, .jar) and ZOO (.zoo) formats.
|
TAR (.tar), XZ (.xz), ZIP (.zip, .jar) and ZOO (.zoo) formats.
|
||||||
It relies on helper applications to handle those archive formats
|
It relies on helper applications to handle those archive formats
|
||||||
(for example bzip2 for BZIP2 archives).
|
(for example bzip2 for BZIP2 archives).
|
||||||
.PP
|
.PP
|
||||||
|
|
|
@ -25,12 +25,12 @@ DESCRIPTION
|
||||||
|
|
||||||
patool supports 7z (.7z), ACE (.ace), ALZIP (.alz), APE (.ape),
|
patool supports 7z (.7z), ACE (.ace), ALZIP (.alz), APE (.ape),
|
||||||
AR (.a), ARC (.arc), ARJ (.arj), BZIP2 (.bz2), CAB (.cab), com‐
|
AR (.a), ARC (.arc), ARJ (.arj), BZIP2 (.bz2), CAB (.cab), com‐
|
||||||
press (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms), GZIP (.gz),
|
press (.Z), CPIO (.cpio), DEB (.deb), DMS (.dms), FLAC (.flac),
|
||||||
LRZIP (.lrz), LZH (.lha, .lzh), LZIP (.lz), LZMA (.lzma), LZOP
|
GZIP (.gz), LRZIP (.lrz), LZH (.lha, .lzh), LZIP (.lz), LZMA
|
||||||
(.lzo), RPM (.rpm), RAR (.rar), RZIP (.rz), SHN (.shn), TAR
|
(.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar), RZIP (.rz), SHN
|
||||||
(.tar), XZ (.xz), ZIP (.zip, .jar) and ZOO (.zoo) formats. It
|
(.shn), TAR (.tar), XZ (.xz), ZIP (.zip, .jar) and ZOO (.zoo)
|
||||||
relies on helper applications to handle those archive formats
|
formats. It relies on helper applications to handle those ar‐
|
||||||
(for example bzip2 for BZIP2 archives).
|
chive formats (for example bzip2 for BZIP2 archives).
|
||||||
|
|
||||||
The archive formats TAR (.tar), ZIP (.zip), BZIP2 (.bz2) and
|
The archive formats TAR (.tar), ZIP (.zip), BZIP2 (.bz2) and
|
||||||
GZIP (.gz) are supported natively and do not require helper
|
GZIP (.gz) are supported natively and do not require helper
|
||||||
|
|
|
@ -106,6 +106,10 @@ ArchivePrograms = {
|
||||||
'list': ('py_echo',),
|
'list': ('py_echo',),
|
||||||
},
|
},
|
||||||
'flac': {
|
'flac': {
|
||||||
|
'extract': ('flac',),
|
||||||
|
'test': ('flac',),
|
||||||
|
'create': ('flac',),
|
||||||
|
'list': ('py_echo',),
|
||||||
},
|
},
|
||||||
'tar': {
|
'tar': {
|
||||||
None: ('tar', 'star', 'py_tarfile'),
|
None: ('tar', 'star', 'py_tarfile'),
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2012 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 flac program."""
|
||||||
|
from patoolib import util
|
||||||
|
|
||||||
|
def extract_flac (archive, compression, cmd, **kwargs):
|
||||||
|
"""Decompress a FLAC archive to a WAV file."""
|
||||||
|
outfile = util.get_single_outfile(kwargs['outdir'], archive,
|
||||||
|
extension=".wav")
|
||||||
|
cmdlist = [cmd, '--decode', archive, '--output-name', outfile]
|
||||||
|
return cmdlist
|
||||||
|
|
||||||
|
|
||||||
|
def create_flac (archive, compression, cmd, *args, **kwargs):
|
||||||
|
"""Compress a WAV file to a FLAC archive."""
|
||||||
|
cmdlist = [cmd, args[0], '--output-name', archive]
|
||||||
|
return cmdlist
|
||||||
|
|
||||||
|
|
||||||
|
def test_flac (archive, compression, cmd, **kwargs):
|
||||||
|
"""Test a FLAC file."""
|
||||||
|
cmdlist = [cmd, '--test']
|
||||||
|
if not kwargs['verbose']:
|
||||||
|
cmdlist.append('-s')
|
||||||
|
cmdlist.append(archive)
|
||||||
|
return cmdlist
|
|
@ -54,6 +54,10 @@ def list_shn (archive, compression, cmd, **kwargs):
|
||||||
"""List a SHN archive."""
|
"""List a SHN archive."""
|
||||||
return stripext(cmd, archive, extension=".wav")
|
return stripext(cmd, archive, extension=".wav")
|
||||||
|
|
||||||
|
def list_flac (archive, compression, cmd, **kwargs):
|
||||||
|
"""List a FLAC archive."""
|
||||||
|
return stripext(cmd, archive, extension=".wav")
|
||||||
|
|
||||||
def stripext (cmd, archive, extension=""):
|
def stripext (cmd, archive, extension=""):
|
||||||
"""Print the name without suffix."""
|
"""Print the name without suffix."""
|
||||||
print util.stripext(archive)+extension
|
print util.stripext(archive)+extension
|
||||||
|
|
7
setup.py
7
setup.py
|
@ -48,9 +48,10 @@ fallback by the archive file extension.
|
||||||
|
|
||||||
patool supports 7z (.7z), ACE (.ace), ALZIP (.alz), APE (.ape), AR (.a),
|
patool supports 7z (.7z), ACE (.ace), ALZIP (.alz), APE (.ape), AR (.a),
|
||||||
ARC (.arc), ARJ (.arj), BZIP2 (.bz2), CAB (.cab), compress (.Z), CPIO (.cpio),
|
ARC (.arc), ARJ (.arj), BZIP2 (.bz2), CAB (.cab), compress (.Z), CPIO (.cpio),
|
||||||
DEB (.deb), DMS (.dms), GZIP (.gz), LRZIP (.lrz), LZH (.lha, .lzh),
|
DEB (.deb), DMS (.dms), FLAC (.flac), GZIP (.gz), LRZIP (.lrz),
|
||||||
LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm), RAR (.rar), RZIP (.rz),
|
LZH (.lha, .lzh), LZIP (.lz), LZMA (.lzma), LZOP (.lzo), RPM (.rpm),
|
||||||
SHN (.shn), TAR (.tar), XZ (.xz), ZIP (.zip, .jar) and ZOO (.zoo) formats.
|
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
|
It relies on helper applications to handle those archive formats
|
||||||
(for example bzip2 for BZIP2 archives).
|
(for example bzip2 for BZIP2 archives).
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
|
@ -151,6 +151,7 @@ class TestArchives (ArchiveTest):
|
||||||
self.archive_list('t.txt.rz')
|
self.archive_list('t.txt.rz')
|
||||||
self.archive_list('t.ape')
|
self.archive_list('t.ape')
|
||||||
self.archive_list('t.shn')
|
self.archive_list('t.shn')
|
||||||
|
self.archive_list('t.flac')
|
||||||
|
|
||||||
@needs_program('unzip')
|
@needs_program('unzip')
|
||||||
def test_unzip (self):
|
def test_unzip (self):
|
||||||
|
@ -453,3 +454,10 @@ class TestArchives (ArchiveTest):
|
||||||
self.program = 'shorten'
|
self.program = 'shorten'
|
||||||
self.archive_extract('t.shn')
|
self.archive_extract('t.shn')
|
||||||
self.archive_create('t.shn', srcfile="t.wav")
|
self.archive_create('t.shn', srcfile="t.wav")
|
||||||
|
|
||||||
|
@needs_program('flac')
|
||||||
|
def test_flac (self):
|
||||||
|
self.program = 'flac'
|
||||||
|
self.archive_extract('t.flac')
|
||||||
|
self.archive_test('t.flac')
|
||||||
|
self.archive_create('t.flac', srcfile="t.wav")
|
||||||
|
|
|
@ -167,6 +167,12 @@ class TestArchives (ArchiveTest):
|
||||||
# file(1) does not recognize .lzma files
|
# file(1) does not recognize .lzma files
|
||||||
#self.archive_list('t.lzma.foo')
|
#self.archive_list('t.lzma.foo')
|
||||||
self.archive_list('t.txt.lz.foo')
|
self.archive_list('t.txt.lz.foo')
|
||||||
|
self.archive_list('t.txt.lrz')
|
||||||
|
self.archive_list('t.txt.rz.foo')
|
||||||
|
self.archive_list('t.ape.foo')
|
||||||
|
# file(1) does not recognize .shn files
|
||||||
|
#self.archive_list('t.shn.foo')
|
||||||
|
self.archive_list('t.flac.foo')
|
||||||
|
|
||||||
@needs_program('file')
|
@needs_program('file')
|
||||||
@needs_program('unzip')
|
@needs_program('unzip')
|
||||||
|
@ -502,3 +508,11 @@ class TestArchives (ArchiveTest):
|
||||||
# self.program = 'shorten'
|
# self.program = 'shorten'
|
||||||
# self.archive_extract('t.shn.foo')
|
# self.archive_extract('t.shn.foo')
|
||||||
# self.archive_create('t.shn.foo', srcfile='t.wav')
|
# self.archive_create('t.shn.foo', srcfile='t.wav')
|
||||||
|
|
||||||
|
@needs_program('file')
|
||||||
|
@needs_program('flac')
|
||||||
|
def test_flac (self):
|
||||||
|
self.program = 'flac'
|
||||||
|
self.archive_extract('t.flac.foo')
|
||||||
|
self.archive_test('t.flac.foo')
|
||||||
|
self.archive_create('t.flac.foo', srcfile='t.wav', format='flac')
|
||||||
|
|
Loading…
Reference in New Issue