Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does it support decompression progress display? #460

Closed
boynton89 opened this issue Jul 1, 2022 · 3 comments
Closed

Does it support decompression progress display? #460

boynton89 opened this issue Jul 1, 2022 · 3 comments
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed no-issue-activity question Further information is requested

Comments

@boynton89
Copy link

Does it support decompression progress display?

@miurahr miurahr added the question Further information is requested label Jul 1, 2022
@miurahr
Copy link
Owner

miurahr commented Jul 1, 2022

@boynton89 you can see callback API that give you a way to get a progress.

py7zr/tests/test_misc.py

Lines 129 to 152 in 96c2745

def test_extract_callback(tmp_path):
# test the case when good callback passed.
class ECB(py7zr.callbacks.ExtractCallback):
def __init__(self, ofd):
self.ofd = ofd
def report_start_preparation(self):
self.ofd.write("preparation.\n")
def report_start(self, processing_file_path, processing_bytes):
self.ofd.write('start "{}" (compressed in {} bytes)\n'.format(processing_file_path, processing_bytes))
def report_end(self, processing_file_path, wrote_bytes):
self.ofd.write('end "{}" extracted to {} bytes\n'.format(processing_file_path, wrote_bytes))
def report_postprocess(self):
self.ofd.write("post processing.\n")
def report_warning(self, message):
self.ofd.write("warning: {:s}\n".format(message))
cb = ECB(sys.stdout)
with py7zr.SevenZipFile(open(os.path.join(testdata_path, "test_1.7z"), "rb")) as archive:
archive.extractall(path=tmp_path, callback=cb)

This test case define a class ECB that print callback message to stdout, inherited from ExtractCallBack, and pass its instance to extractall method.

@miurahr
Copy link
Owner

miurahr commented Jul 3, 2022

A CLI does not implement it yet.

@miurahr miurahr added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Aug 22, 2022
@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days

Repository owner locked and limited conversation to collaborators Jan 30, 2024
@miurahr miurahr converted this issue into discussion #563 Jan 30, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed no-issue-activity question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants