mirror of
https://github.com/tcsenpai/qrare.git
synced 2025-06-06 19:25:26 +00:00
better verbosity
This commit is contained in:
parent
2a588025d7
commit
d4b2713702
9
qraro.py
9
qraro.py
@ -17,6 +17,8 @@ def bin_to_qr(data, chunk_size=100, filename_prefix="qr_code", box_size=10, bord
|
|||||||
print(f"[OK]")
|
print(f"[OK]")
|
||||||
|
|
||||||
print(f"Generated {total_chunks} QR codes.")
|
print(f"Generated {total_chunks} QR codes.")
|
||||||
|
print(f"Each QR code except the last one will contain {chunk_size} bytes of data.")
|
||||||
|
print(f"The last QR code will contain the remaining bytes of data ({len(chunks[-1] )} bytes).")
|
||||||
|
|
||||||
def qr_to_bin(filename_prefix="qr_code"):
|
def qr_to_bin(filename_prefix="qr_code"):
|
||||||
chunks = {}
|
chunks = {}
|
||||||
@ -34,15 +36,18 @@ def qr_to_bin(filename_prefix="qr_code"):
|
|||||||
chunk_info, chunk_data = decoded.split(':', 1)
|
chunk_info, chunk_data = decoded.split(':', 1)
|
||||||
chunk_num, total_chunks = map(int, chunk_info.split('/'))
|
chunk_num, total_chunks = map(int, chunk_info.split('/'))
|
||||||
chunks[chunk_num] = chunk_data
|
chunks[chunk_num] = chunk_data
|
||||||
|
print(f"binary data extracted [OK]")
|
||||||
if chunk_num == total_chunks:
|
if chunk_num == total_chunks:
|
||||||
break
|
break
|
||||||
|
else:
|
||||||
|
print(f"Error decoding QR code {i}: {barcode.raw}")
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
print(f"binary data extracted [OK]")
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
break
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error decoding QR code {i}: {e}")
|
print(f"Error decoding QR code {i}: {e}")
|
||||||
break
|
exit(-1)
|
||||||
|
|
||||||
if not chunks:
|
if not chunks:
|
||||||
print("No QR codes found.")
|
print("No QR codes found.")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user