Skip to content

Commit 3f34823

Browse files
committed
Add --pure-barcode option to CLI
Possible workaround for some seemingly-sane barcodes that ZXing fails to decode? (ping #27)
1 parent bed97e7 commit 3f34823

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ If it encounters any other recognizable error from the Java ZXing library, it ra
4444
The command-line interface can decode images into barcodes and output in either a human-readable or CSV format:
4545

4646
```
47-
usage: zxing [-h] [-c] [--try-harder] [-V] image [image ...]
47+
usage: zxing [-h] [-c] [--try-harder] [--pure-barcode] [-V] image [image ...]
4848
```
4949

5050
Human-readable:

zxing/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def main():
2323
p = ErrorDeferredArgumentParser()
2424
p.add_argument('-c', '--csv', action='store_true')
2525
p.add_argument('--try-harder', action='store_true')
26+
p.add_argument('--pure-barcode', action='store_true')
2627
p.add_argument('image', nargs='+')
2728
p.add_argument('-P', '--classpath', help=argparse.SUPPRESS)
2829
p.add_argument('-J', '--java', help=argparse.SUPPRESS)
@@ -49,7 +50,7 @@ def main():
4950
ff = fn
5051

5152
try:
52-
bc = bcr.decode(ff, try_harder=args.try_harder)
53+
bc = bcr.decode(ff, try_harder=args.try_harder, pure_barcode=args.pure_barcode)
5354
except BarCodeReaderException as e:
5455
p.error(e.message + ((': ' + e.filename) if e.filename else '') + (('\n\tCaused by: ' + repr(e.__cause__) if e.__cause__ else '')))
5556
if args.csv:

0 commit comments

Comments
 (0)