skip file if have same file or passwd

This commit is contained in:
zmr 2022-05-29 14:26:07 +08:00
parent 4928f3fc50
commit aa7776875b
2 changed files with 39 additions and 9 deletions

View File

@ -18,8 +18,34 @@
7zr is a light executable supporting only the 7z archive format. 7zr is a light executable supporting only the 7z archive format.
""" """
from .p7zip import \ #from .p7zip import \
extract_7z, \ # extract_7z, \
list_7z, \ # list_7z, \
test_7z, \ # test_7z, \
create_7z # create_7z
from .p7zip import create_7z
def extract_7z(archive, compression, cmd, verbosity, interactive, outdir):
"""Extract a 7z archive."""
cmdlist = [cmd, 'x']
if not interactive:
cmdlist.append('-y')
cmdlist.extend(['-o%s' % outdir, '--', archive])
return cmdlist
def list_7z(archive, compression, cmd, verbosity, interactive):
"""List a 7z archive."""
cmdlist = [cmd, 'l']
if not interactive:
cmdlist.append('-y')
cmdlist.extend(['--', archive])
return cmdlist
def test_7z(archive, compression, cmd, verbosity, interactive):
"""Test a 7z archive."""
cmdlist = [cmd, 't']
if not interactive:
cmdlist.append('-y')
cmdlist.extend(['--', archive])
return cmdlist

View File

@ -23,7 +23,8 @@ def extract_7z(archive, compression, cmd, verbosity, interactive, outdir, passwo
"""Extract a 7z archive.""" """Extract a 7z archive."""
cmdlist = [cmd, 'x'] cmdlist = [cmd, 'x']
if not interactive: if not interactive:
cmdlist.append('-y') #cmdlist.append('-y')
cmdlist.extend(['-p-', '-y'])
_maybe_add_password(cmdlist, password) _maybe_add_password(cmdlist, password)
cmdlist.extend(['-o%s' % outdir, '--', archive]) cmdlist.extend(['-o%s' % outdir, '--', archive])
return cmdlist return cmdlist
@ -34,7 +35,8 @@ def extract_7z_singlefile(archive, compression, cmd, verbosity, interactive, out
which would cause errors with patool repack.""" which would cause errors with patool repack."""
cmdlist = [cmd, 'e'] cmdlist = [cmd, 'e']
if not interactive: if not interactive:
cmdlist.append('-y') #cmdlist.append('-y')
cmdlist.extend(['-p-', '-y'])
_maybe_add_password(cmdlist, password) _maybe_add_password(cmdlist, password)
cmdlist.extend(['-o%s' % outdir, '--', archive]) cmdlist.extend(['-o%s' % outdir, '--', archive])
return cmdlist return cmdlist
@ -61,7 +63,8 @@ def list_7z (archive, compression, cmd, verbosity, interactive, password=None):
"""List a 7z archive.""" """List a 7z archive."""
cmdlist = [cmd, 'l'] cmdlist = [cmd, 'l']
if not interactive: if not interactive:
cmdlist.append('-y') #cmdlist.append('-y')
cmdlist.extend(['-p-', '-y'])
_maybe_add_password(cmdlist, password) _maybe_add_password(cmdlist, password)
cmdlist.extend(['--', archive]) cmdlist.extend(['--', archive])
return cmdlist return cmdlist
@ -87,7 +90,8 @@ def test_7z (archive, compression, cmd, verbosity, interactive, password=None):
"""Test a 7z archive.""" """Test a 7z archive."""
cmdlist = [cmd, 't'] cmdlist = [cmd, 't']
if not interactive: if not interactive:
cmdlist.append('-y') #cmdlist.append('-y')
cmdlist.extend(['-p-', '-y'])
_maybe_add_password(cmdlist, password) _maybe_add_password(cmdlist, password)
cmdlist.extend(['--', archive]) cmdlist.extend(['--', archive])
return cmdlist return cmdlist