Add more reasoning
This commit is contained in:
parent
28706e9c93
commit
cdd255c5bb
@ -215,6 +215,7 @@ async def handle_pad(args, padid, data, info, session):
|
||||
revisions = response["data"]["revisions"]
|
||||
if meta["revisions"] == revisions and not args.force:
|
||||
skip = True
|
||||
reason = "No new revisions, we already have the latest local copy"
|
||||
break
|
||||
|
||||
meta["padid"] = padid
|
||||
@ -234,6 +235,7 @@ async def handle_pad(args, padid, data, info, session):
|
||||
|
||||
if (meta["revisions"] == 0) and (not args.zerorevs):
|
||||
skip = True
|
||||
reason = "0 revisions, this pad was never edited"
|
||||
break
|
||||
|
||||
# todo: load more metadata!
|
||||
@ -261,6 +263,7 @@ async def handle_pad(args, padid, data, info, session):
|
||||
file=sys.stderr,
|
||||
)
|
||||
skip = True
|
||||
reason = "PANIC, couldn't download the pad contents"
|
||||
break
|
||||
else:
|
||||
await trio.sleep(1)
|
||||
@ -272,10 +275,11 @@ async def handle_pad(args, padid, data, info, session):
|
||||
file=sys.stderr,
|
||||
)
|
||||
skip = True
|
||||
reason = "PANIC, couldn't download the pad contents"
|
||||
break
|
||||
|
||||
if skip:
|
||||
print("[ ] {} (skipped)".format(padid))
|
||||
print("[ ] {} (skipped, reason: {})".format(padid, reason))
|
||||
return
|
||||
|
||||
if args.output:
|
||||
@ -286,7 +290,7 @@ async def handle_pad(args, padid, data, info, session):
|
||||
path = trio.Path(os.path.split(metapath)[0])
|
||||
await path.mkdir()
|
||||
except OSError:
|
||||
pass
|
||||
print("PANIC: unable to create {}".format(str(path)))
|
||||
|
||||
if args.all or args.text:
|
||||
url = info["localapiurl"] + "getText?" + urlencode(data)
|
||||
@ -310,7 +314,11 @@ async def handle_pad(args, padid, data, info, session):
|
||||
p + ".meta.json",
|
||||
)
|
||||
)
|
||||
print("[ ] {} (no publish)".format(padid))
|
||||
print(
|
||||
"[ ] {} (deleted, reason: explicit __NOPUBLISH__)".format(
|
||||
padid
|
||||
)
|
||||
)
|
||||
return
|
||||
|
||||
##########################################
|
||||
@ -325,7 +333,7 @@ async def handle_pad(args, padid, data, info, session):
|
||||
p + ".meta.json",
|
||||
)
|
||||
)
|
||||
print("[ ] {} (publish opt out)".format(padid))
|
||||
print("[ ] {} (deleted, reason: publish opt-out)".format(padid))
|
||||
return
|
||||
|
||||
ver["path"] = p + raw_ext
|
||||
@ -443,7 +451,7 @@ async def handle_pad(args, padid, data, info, session):
|
||||
async with await trio.open_file(metapath, "w") as f:
|
||||
await f.write(json.dumps(meta))
|
||||
|
||||
print("[x] {}".format(padid))
|
||||
print("[x] {} (saved)".format(padid))
|
||||
|
||||
|
||||
async def handle_pads(args):
|
||||
|
Loading…
Reference in New Issue
Block a user