Browse Source

fixing bug: not checking soup posts if already posted; configpath errormessage was also misleading

master
Andreas Demmelbauer 6 years ago
parent
commit
abaefe3372
1 changed files with 5 additions and 5 deletions
  1. +5
    -5
      tootbot.py

+ 5
- 5
tootbot.py View File

@@ -24,8 +24,8 @@ try:
config = json.load(open(configpath)) config = json.load(open(configpath))


except: except:
print("didn't find config file: ", configpath)
print("ERROR: Config file not found!")
print("Problem reading config file: ", configpath)
print("ERROR: Config file not found or invalid!")
sys.exit(1) sys.exit(1)




@@ -192,13 +192,13 @@ for p in reversed(s.entries):
last = db.fetchone() last = db.fetchone()


print('Processing: %s' % p.id) print('Processing: %s' % p.id)

shouldpost = True

if last is not None: if last is not None:
shouldpost = False shouldpost = False
print("skip: already posted") print("skip: already posted")
# process only unprocessed tweets less than n days old # process only unprocessed tweets less than n days old

shouldpost = True

posttime = datetime(p.published_parsed.tm_year, p.published_parsed.tm_mon, p.published_parsed.tm_mday, p.published_parsed.tm_hour, p.published_parsed.tm_min, p.published_parsed.tm_sec) posttime = datetime(p.published_parsed.tm_year, p.published_parsed.tm_mon, p.published_parsed.tm_mday, p.published_parsed.tm_hour, p.published_parsed.tm_min, p.published_parsed.tm_sec)
age = datetime.now() - posttime age = datetime.now() - posttime
if age > timedelta(days=days): if age > timedelta(days=days):


Loading…
Cancel
Save