mirror of
https://gitlab.com/jeancf/twoot.git
synced 2024-11-23 20:11:11 +00:00
Added configuration option
This commit is contained in:
parent
870a1ee745
commit
6d90486c8b
|
@ -38,6 +38,11 @@ footer = ""
|
|||
# default is false
|
||||
remove_original_tweet_ref = false
|
||||
|
||||
# Check if profile avatar or banner pictures were changed and update
|
||||
# the Mastodon account if necessary
|
||||
# Default is false
|
||||
update_profile = false
|
||||
|
||||
# Maximum age of tweet to post (in days, decimal values accepted)
|
||||
# Default is 1
|
||||
tweet_max_age = 1
|
||||
|
|
8
twoot.py
8
twoot.py
|
@ -97,6 +97,7 @@ def build_config(args):
|
|||
'subst_twitter': [],
|
||||
'subst_youtube': [],
|
||||
'subst_reddit': [],
|
||||
'update_profile': False,
|
||||
'log_level': "WARNING",
|
||||
'log_days': 3,
|
||||
}
|
||||
|
@ -157,6 +158,8 @@ def build_config(args):
|
|||
TOML['options']['tweet_delay'] = float(args['d'])
|
||||
if args['c'] is not None:
|
||||
TOML['options']['toot_cap'] = int(args['c'])
|
||||
if args['p'] is True:
|
||||
TOML['options']['update_profile'] = args['p']
|
||||
|
||||
# Verify that we have a minimum config to run
|
||||
if 'twitter_account' not in TOML['config'].keys() or TOML['config']['twitter_account'] == "":
|
||||
|
@ -172,7 +175,9 @@ def build_config(args):
|
|||
|
||||
def update_profile(nitter_url, soup, sql, mast_password):
|
||||
"""
|
||||
Update the profile on Mastodon
|
||||
Update profile on Mastodon
|
||||
Check if avatar or banner pictures have changed since last run
|
||||
If they have, download them and upload them on the Mastodon account profile
|
||||
:param soup: BeautifulSoup object containing the page
|
||||
:param sql: database connection
|
||||
:param mast_password: <PASSWORD>
|
||||
|
@ -705,6 +710,7 @@ def main(argv):
|
|||
parser.add_argument('-u', action='store_true', help='Remove trackers from URLs')
|
||||
parser.add_argument('-v', action='store_true', help='Ingest twitter videos and upload to Mastodon instance')
|
||||
parser.add_argument('-o', action='store_true', help='Do not add reference to Original tweet')
|
||||
parser.add_argument('-p', action='store_true', help='update profile if changed')
|
||||
parser.add_argument('-a', metavar='<max age (in days)>', action='store', type=float)
|
||||
parser.add_argument('-d', metavar='<min delay (in mins)>', action='store', type=float)
|
||||
parser.add_argument('-c', metavar='<max # of toots to post>', action='store', type=int)
|
||||
|
|
Loading…
Reference in New Issue
Block a user