mirror of
https://gitlab.com/jeancf/twoot.git
synced 2025-02-19 14:52:08 +00:00
Replaced mast_account
This commit is contained in:
parent
7c307e1003
commit
99a63463d3
11
twoot.py
11
twoot.py
|
@ -398,7 +398,6 @@ def main(argv):
|
|||
print('Missing Mastodon user')
|
||||
exit(-1)
|
||||
|
||||
# mast_account = args['m']
|
||||
# mast_password = args['p']
|
||||
# suppress_retweets = args['s']
|
||||
# get_vids = args['v']
|
||||
|
@ -549,7 +548,7 @@ def main(argv):
|
|||
# Check in database if tweet has already been posted
|
||||
db.execute(
|
||||
"SELECT * FROM toots WHERE twitter_account=? AND mastodon_instance=? AND mastodon_account=? AND tweet_id=?",
|
||||
(toml['config']['twitter_account'], toml['config']['mastodon_instance'], mast_account, tweet_id))
|
||||
(toml['config']['twitter_account'], toml['config']['mastodon_instance'], toml['config']['mastodon_user'], tweet_id))
|
||||
tweet_in_db = db.fetchone()
|
||||
|
||||
if tweet_in_db is not None:
|
||||
|
@ -673,7 +672,7 @@ def main(argv):
|
|||
# Login to account on maston instance
|
||||
mastodon = None
|
||||
if len(tweets) != 0:
|
||||
mastodon = login(toml['config']['mastodon_instance'], mast_account, mast_password)
|
||||
mastodon = login(toml['config']['mastodon_instance'], toml['config']['mastodon_user'], mast_password)
|
||||
|
||||
# **********************************************************
|
||||
# Iterate tweets in list.
|
||||
|
@ -727,7 +726,7 @@ def main(argv):
|
|||
toot = {}
|
||||
try:
|
||||
mastodon = Mastodon(
|
||||
access_token=mast_account + '.secret',
|
||||
access_token=toml['config']['mastodon_user'] + '.secret',
|
||||
api_base_url='https://' + toml['config']['mastodon_instance']
|
||||
)
|
||||
|
||||
|
@ -742,12 +741,12 @@ def main(argv):
|
|||
|
||||
else:
|
||||
posted_cnt += 1
|
||||
logging.debug('Tweet %s posted on %s', tweet['tweet_id'], mast_account)
|
||||
logging.debug('Tweet %s posted on %s', tweet['tweet_id'], toml['config']['mastodon_user'])
|
||||
|
||||
# Insert toot id into database
|
||||
if 'id' in toot:
|
||||
db.execute("INSERT INTO toots VALUES ( ? , ? , ? , ? , ? )",
|
||||
(toml['config']['twitter_account'], toml['config']['mastodon_instance'], mast_account, tweet['tweet_id'], toot['id']))
|
||||
(toml['config']['twitter_account'], toml['config']['mastodon_instance'], toml['config']['mastodon_user'], tweet['tweet_id'], toot['id']))
|
||||
sql.commit()
|
||||
|
||||
logging.info(str(posted_cnt) + ' tweets posted to Mastodon')
|
||||
|
|
Loading…
Reference in New Issue
Block a user