minor fix

This commit is contained in:
Lynne 2019-01-11 23:05:45 +10:00
parent 2e0bf28c8e
commit 0141b513a9
No known key found for this signature in database
GPG Key ID: FB7B970303ACE499
1 changed files with 3 additions and 5 deletions

View File

@ -18,7 +18,7 @@ cfg = json.load(open('config.json', 'r'))
if 'site' not in cfg: if 'site' not in cfg:
cfg['website'] = "https://botsin.space" cfg['website'] = "https://botsin.space"
if 'cw' not in cfg: if 'cw' not in cfg:
cfg['cw'] = "" cfg['cw'] = None
#if the user is using a (very!) old version that still uses the .secret files, migrate to the new method #if the user is using a (very!) old version that still uses the .secret files, migrate to the new method
if os.path.exists("clientcred.secret"): if os.path.exists("clientcred.secret"):
@ -154,8 +154,8 @@ for f in following:
done = True done = True
break break
pid = re.search(r"[^\/]+$", oi['object']['id']).group(0) pid = re.search(r"[^\/]+$", oi['object']['id']).group(0)
c.execute("REPLACE INTO toots (id, userid, uri, content) VALUES (?, ?, ?, ?)", c.execute("REPLACE INTO toots (id, userid, uri, content) VALUES (?, ?, ?, ?)", (
(pid, pid,
f.id, f.id,
oi['object']['id'], oi['object']['id'],
toot toot
@ -164,7 +164,6 @@ for f in following:
pass pass
except: except:
pass #ignore any toots that don't successfully go into the DB pass #ignore any toots that don't successfully go into the DB
# sys.exit(0)
if not pleroma: if not pleroma:
r = requests.get(j['prev'], timeout=15) r = requests.get(j['prev'], timeout=15)
else: else:
@ -176,7 +175,6 @@ for f in following:
except: except:
print("Encountered an error! Saving toots to database and moving to next followed account.") print("Encountered an error! Saving toots to database and moving to next followed account.")
db.commit() db.commit()
# db.close()
print("Done!") print("Done!")