Skip to content

Commit

Permalink
Add --pure-barcode option to CLI
Browse files Browse the repository at this point in the history
Possible workaround for some seemingly-sane barcodes that ZXing fails to
decode?  (ping #27)
  • Loading branch information
dlenski committed Apr 29, 2023
1 parent bed97e7 commit 3f34823
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ If it encounters any other recognizable error from the Java ZXing library, it ra
The command-line interface can decode images into barcodes and output in either a human-readable or CSV format:

```
usage: zxing [-h] [-c] [--try-harder] [-V] image [image ...]
usage: zxing [-h] [-c] [--try-harder] [--pure-barcode] [-V] image [image ...]
```

Human-readable:
Expand Down
3 changes: 2 additions & 1 deletion zxing/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def main():
p = ErrorDeferredArgumentParser()
p.add_argument('-c', '--csv', action='store_true')
p.add_argument('--try-harder', action='store_true')
p.add_argument('--pure-barcode', action='store_true')
p.add_argument('image', nargs='+')
p.add_argument('-P', '--classpath', help=argparse.SUPPRESS)
p.add_argument('-J', '--java', help=argparse.SUPPRESS)
Expand All @@ -49,7 +50,7 @@ def main():
ff = fn

try:
bc = bcr.decode(ff, try_harder=args.try_harder)
bc = bcr.decode(ff, try_harder=args.try_harder, pure_barcode=args.pure_barcode)
except BarCodeReaderException as e:
p.error(e.message + ((': ' + e.filename) if e.filename else '') + (('\n\tCaused by: ' + repr(e.__cause__) if e.__cause__ else '')))
if args.csv:
Expand Down

0 comments on commit 3f34823

Please sign in to comment.