Skip to content

Commit

Permalink
Simplify tracking item identifier
Browse files Browse the repository at this point in the history
  • Loading branch information
simonliu99 committed Mar 21, 2022
1 parent 94eb932 commit 3638e69
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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?'
Expand Down

0 comments on commit 3638e69

Please sign in to comment.