|
|
@ -25,6 +25,13 @@ use/prefer public interfaces ? (export functions) |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
def try_deleting (files): |
|
|
|
for f in files: |
|
|
|
try: |
|
|
|
os.remove(f) |
|
|
|
except OSError as e: |
|
|
|
pass |
|
|
|
|
|
|
|
def main (args): |
|
|
|
p = ArgumentParser("Check for pads that have changed since last sync (according to .meta.json)") |
|
|
|
p.add_argument("padid", nargs="*", default=[]) |
|
|
@ -59,13 +66,6 @@ def main (args): |
|
|
|
# maxmsglen = 0 |
|
|
|
count = 0 |
|
|
|
for i, padid in enumerate(padids): |
|
|
|
# TODO... |
|
|
|
""" |
|
|
|
Self-contained documents / and/or document receipts |
|
|
|
storing enough information to reconstruct (or understand an error occurred) |
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
if args.skip != None and i<args.skip: |
|
|
|
continue |
|
|
|
progressbar(i, numpads, padid) |
|
|
@ -143,16 +143,20 @@ storing enough information to reconstruct (or understand an error occurred) |
|
|
|
|
|
|
|
if args.all or args.text: |
|
|
|
text = getjson(info['apiurl']+'getText?'+urlencode(data)) |
|
|
|
|
|
|
|
##ENFORCE NOPUBLISH MAGIC WORD |
|
|
|
if args.nopublish and args.nopublish in text: |
|
|
|
continue |
|
|
|
|
|
|
|
ver = {"type": "text"} |
|
|
|
versions.append(ver) |
|
|
|
ver["code"] = text["_code"] |
|
|
|
if text["_code"] == 200: |
|
|
|
text = text['data']['text'] |
|
|
|
|
|
|
|
########################################## |
|
|
|
## ENFORCE __NOPUBLISH__ MAGIC WORD |
|
|
|
########################################## |
|
|
|
if args.nopublish and args.nopublish in text: |
|
|
|
# NEED TO PURGE ANY EXISTING DOCS |
|
|
|
try_deleting((p+".raw.txt",p+".raw.html",p+".diff.html",p+".meta.json")) |
|
|
|
continue |
|
|
|
|
|
|
|
ver["path"] = p+".raw.txt" |
|
|
|
ver["url"] = quote(ver["path"]) |
|
|
|
with open(ver["path"], "w") as f: |
|
|
|