Skip to content

Commit

Permalink
add actual restore instructions in the document
Browse files Browse the repository at this point in the history
  • Loading branch information
anarcat committed Jun 2, 2023
1 parent 7c3f064 commit 5bee3d6
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions paperbackup.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,28 @@ def finish_page(pdf, canv, pageno):
outlines.append("")
outlines.append("sha256sum of input file:")
outlines.append("%s"%checksum)
outlines.append("")
outlines.append("")
outlines.append("--")
outlines.append("Created with paperbackup.py")
outlines.append("See https://github.com/intra2net/paperbackup/ for instructions")
outlines += r"""
--
Created with paperbackup.py from https://github.com/intra2net/paperbackup/
To restore, either scan this document into a file or use a webcam
This shell script should restore the content inline
/usr/bin/zbarimg --raw -Sdisable -Sqrcode.enable "$SCANNEDFILE" \
| sed -e "s/\^/\x0/g" \
| sort -z -n \
| sed ':a;N;$!ba;s/\n\x0[0-9]* //g;s/\x0[0-9]* //g;s/\n\x0//g'
# replace 'zbarimg \"$SCANNEDFILE\"' with 'zbarcam' if you have a
# webcam instead of a scanned document
# algorithm:
# 1. zbarimg ends each scanned code with a newline
# 2. each barcode content begins with ^<number><space>
# 3. convert that to \0<number><space>, so sort can sort on that
# 4. then remove all \n\0<number><space> so we get the originial without \n
""".split("\n")

# use "enscript" to create postscript with the plaintext
p = subprocess.Popen(
Expand Down

0 comments on commit 5bee3d6

Please sign in to comment.