mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Moved db lookup to the right section
This commit is contained in:
parent
e62e5634e0
commit
8bd8aeec29
21
twoot.py
21
twoot.py
|
@ -1113,15 +1113,6 @@ def main(argv):
|
|||
# Extract posix path of first video file in list
|
||||
video_file = video_file_list[0].absolute().as_posix()
|
||||
|
||||
# Find in database toot id of replied_to_tweet
|
||||
replied_to_toot = None
|
||||
if replied_to_tweet is not None:
|
||||
db.execute("SELECT twoot_id FROM toots WHERE tweet_id=?", replied_to_tweet)
|
||||
replied_to_toot = db.fetchone()
|
||||
|
||||
if replied_to_toot is None:
|
||||
logging.warning('Replied-to tweet %s not found in database', replied_to_tweet)
|
||||
|
||||
# Add dictionary with content of tweet to list
|
||||
tweet = {
|
||||
"author": author,
|
||||
|
@ -1131,7 +1122,7 @@ def main(argv):
|
|||
"tweet_text": tweet_text,
|
||||
"video": video_file,
|
||||
"photos": photos,
|
||||
"replied-to-tweet": replied_to_toot,
|
||||
"replied_to_tweet": replied_to_tweet,
|
||||
}
|
||||
tweets.append(tweet)
|
||||
|
||||
|
@ -1199,6 +1190,16 @@ def main(argv):
|
|||
TypeError): # Media cannot be uploaded (invalid format, dead link, etc.)
|
||||
pass
|
||||
|
||||
# Find in database toot id of replied_to_tweet
|
||||
replied_to_toot = None
|
||||
if tweet['replied_to_tweet'] is not None:
|
||||
logging.debug("Seazrching db for replied-to-tweet " + tweet['replied_to_tweet'])
|
||||
db.execute("SELECT toot_id FROM toots WHERE tweet_id=?", tweet['replied_to_tweet'])
|
||||
replied_to_toot = db.fetchone()
|
||||
|
||||
if replied_to_toot is None:
|
||||
logging.warning('Replied-to tweet %s not found in database', replied_to_tweet)
|
||||
|
||||
# Post toot
|
||||
toot = {}
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user