Skip to content

Commit

Permalink
Disable progbar for linearizing when --no-progress-bar set
Browse files Browse the repository at this point in the history
Fixes #1332
  • Loading branch information
jbarlow83 committed Jun 14, 2024
1 parent 7726777 commit 2f53b27
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ocrmypdf/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,10 @@ def _set_language(pdf: Pdf, languages: list[str]):


class MetadataProgress:
def __init__(self, progressbar_class):
def __init__(self, progressbar_class, enable: bool = True):
self.progressbar_class = progressbar_class
self.progressbar = self.progressbar_class(
total=100, desc="Linearizing", unit='%'
total=100, desc="Linearizing", unit='%', disable=not enable
)

def __enter__(self):
Expand Down Expand Up @@ -190,7 +190,7 @@ def metadata_fixup(
with (
Pdf.open(context.origin) as original,
Pdf.open(working_file) as pdf,
MetadataProgress(pbar_class) as pbar,
MetadataProgress(pbar_class, options.progress_bar) as pbar,
):
docinfo = get_docinfo(original, context)
with (
Expand Down

0 comments on commit 2f53b27

Please sign in to comment.