adds the option to only remove boosts

This commit is contained in:
wgahnagl 2020-09-18 19:24:23 -04:00
parent 45fd4a90af
commit 345621411c
1 changed files with 9 additions and 6 deletions

View File

@ -191,6 +191,7 @@ def init():
conf_url = compulsory_input(tags, "Base URL", "(e.g. example.social):")
conf_days = digit_input(tags, "Days to keep", "(default 365):")
conf_pinned = yes_no_input(tags, "Keep pinned toots?")
conf_boosts_only = yes_no_input(tags, "Only remove boosted toots?")
conf_keep_toots = optional_input(
tags, "Toots to keep", "(optional list of IDs separated by commas):"
)
@ -215,6 +216,7 @@ def init():
configfile.write("\n base_url: " + conf_url)
configfile.write("\n days_to_keep: " + conf_days)
configfile.write("\n keep_pinned: " + conf_pinned)
configfile.write("\n boosts_only: " + conf_boosts_only)
if len(conf_keep_toots) > 0:
keep_list = conf_keep_toots.split(",")
@ -399,6 +401,7 @@ def retry_on_error(options, mastodon, toot, attempts):
def process_toot(config, options, mastodon, deleted_count, toot):
keep_pinned = "keep_pinned" in config and config["keep_pinned"]
boosts_only = "boosts_only" in config and config["boosts_only"]
toots_to_keep = config["toots_to_keep"] if "toots_to_keep" in config else []
visibility_to_keep = (
config["visibility_to_keep"] if "visibility_to_keep" in config else []
@ -466,7 +469,7 @@ def process_toot(config, options, mastodon, deleted_count, toot):
mastodon.status_unreblog(toot.reblog)
else:
if not boosts_only:
console_print(
"❌ deleting toot " + str(toot.id) + " tooted " + tooted_date(toot),
options,
@ -587,11 +590,11 @@ def check_batch(config, options, mastodon, user_id, timeline, deleted_count=0):
except IndexError:
if not options.quiet or options.quiet <= 1:
print(
"No toots found for "
+ config["username"]
+ "@"
+ config["base_url"]
+ ".\n"
"No toots found for "
+ config["username"]
+ "@"
+ config["base_url"]
+ ".\n"
)