From 345621411c2e947d40c6d3d6737ea5af1e61ab89 Mon Sep 17 00:00:00 2001 From: wgahnagl Date: Fri, 18 Sep 2020 19:24:23 -0400 Subject: [PATCH 1/2] adds the option to only remove boosts --- ephemetoot/ephemetoot.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/ephemetoot/ephemetoot.py b/ephemetoot/ephemetoot.py index 1426182..3de42b3 100644 --- a/ephemetoot/ephemetoot.py +++ b/ephemetoot/ephemetoot.py @@ -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" ) From 0fe4f75df6bb94c30966f74608344ba4b140ef62 Mon Sep 17 00:00:00 2001 From: Hugh Rundle Date: Sun, 18 Jun 2023 14:56:28 +1000 Subject: [PATCH 2/2] fix "not boosts only" check --- ephemetoot/ephemetoot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ephemetoot/ephemetoot.py b/ephemetoot/ephemetoot.py index 3de42b3..a5159f5 100644 --- a/ephemetoot/ephemetoot.py +++ b/ephemetoot/ephemetoot.py @@ -469,7 +469,7 @@ def process_toot(config, options, mastodon, deleted_count, toot): mastodon.status_unreblog(toot.reblog) - if not boosts_only: + elif not boosts_only: console_print( "❌ deleting toot " + str(toot.id) + " tooted " + tooted_date(toot), options,