From 94eb932b3fa0c1915bcf75f8d08e4ab706cd641d Mon Sep 17 00:00:00 2001 From: Liu Date: Mon, 21 Mar 2022 19:20:43 -0400 Subject: [PATCH 1/2] Display appended-date IA URL if appended --- uploader.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/uploader.py b/uploader.py index 96be41a4..2e216d63 100644 --- a/uploader.py +++ b/uploader.py @@ -73,8 +73,10 @@ def upload(wikis, config={}, uploadeddumps=[]): for dump in dumps: wikidate = dump.split('-')[1] item = get_item('wiki-' + wikiname) + appended = False if item.exists and config.append_date and not config.admin: item = get_item('wiki-' + wikiname + '-' + wikidate) + appended = True if dump in uploadeddumps: if config.prune_directories: rmline='rm -rf %s-%s-wikidump/' % (wikiname, wikidate) @@ -246,7 +248,10 @@ def upload(wikis, config={}, uploadeddumps=[]): try: item.upload(dumpdir + '/' + dump, metadata=md, access_key=accesskey, secret_key=secretkey, verbose=True, queue_derive=False) item.modify_metadata(md) # update - print 'You can find it in https://archive.org/details/wiki-%s' % (wikiname) + if appended: + print 'You can find it in https://archive.org/details/wiki-%s-%s' % (wikiname, wikidate) + else: + print 'You can find it in https://archive.org/details/wiki-%s' % (wikiname) uploadeddumps.append(dump) except Exception as e: print wiki, dump, 'Error when uploading?' From 3638e6992f2123d333ae125d7958349094da1a53 Mon Sep 17 00:00:00 2001 From: Liu Date: Mon, 21 Mar 2022 19:31:28 -0400 Subject: [PATCH 2/2] Simplify tracking item identifier --- uploader.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/uploader.py b/uploader.py index 2e216d63..64bcdc26 100644 --- a/uploader.py +++ b/uploader.py @@ -72,11 +72,11 @@ def upload(wikis, config={}, uploadeddumps=[]): c = 0 for dump in dumps: wikidate = dump.split('-')[1] - item = get_item('wiki-' + wikiname) - appended = False + identifier = 'wiki-' + wikiname + item = get_item(identifier) if item.exists and config.append_date and not config.admin: - item = get_item('wiki-' + wikiname + '-' + wikidate) - appended = True + identifier += '-' + wikidate + item = get_item(identifier) if dump in uploadeddumps: if config.prune_directories: rmline='rm -rf %s-%s-wikidump/' % (wikiname, wikidate) @@ -248,10 +248,7 @@ def upload(wikis, config={}, uploadeddumps=[]): try: item.upload(dumpdir + '/' + dump, metadata=md, access_key=accesskey, secret_key=secretkey, verbose=True, queue_derive=False) item.modify_metadata(md) # update - if appended: - print 'You can find it in https://archive.org/details/wiki-%s-%s' % (wikiname, wikidate) - else: - print 'You can find it in https://archive.org/details/wiki-%s' % (wikiname) + print 'You can find it in https://archive.org/details/%s' % (identifier) uploadeddumps.append(dump) except Exception as e: print wiki, dump, 'Error when uploading?'