mirror of
https://github.com/hughrun/ephemetoot
synced 2025-03-03 10:47:40 +01:00
add --quiet mode
This new option suppresses most logging, except for very basic information (which account is being worked on, and how many toots were deleted). Exception messages are not suppressed.
This commit is contained in:
parent
f5016fe684
commit
62db64a73f
@ -54,6 +54,9 @@ parser.add_argument(
|
||||
parser.add_argument(
|
||||
"--pace", action="store_true", help="Slow deletion actions to match API rate limit to avoid pausing"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--quiet", action="store_true", help="Suppress most logging"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--schedule", action="store", metavar="filepath", nargs="?", const=".", help="Save and load plist file on MacOS"
|
||||
)
|
||||
@ -81,6 +84,7 @@ if __name__ == "__main__":
|
||||
elif options.schedule:
|
||||
ephemetoot.schedule(options)
|
||||
else:
|
||||
if not options.quiet:
|
||||
print('')
|
||||
print('============= EPHEMETOOT v' + vnum + ' ================')
|
||||
print('Running at ' + str( datetime.now(timezone.utc).strftime('%a %d %b %Y %H:%M:%S %z') ))
|
||||
|
@ -130,7 +130,7 @@ def checkToots(config, options, retry_count=0):
|
||||
toot_tags.add(tag.name)
|
||||
try:
|
||||
if keep_pinned and hasattr(toot, "pinned") and toot.pinned:
|
||||
if not options.hide_skipped:
|
||||
if not (options.hide_skipped or options.quiet):
|
||||
if options.datestamp:
|
||||
print(
|
||||
str(
|
||||
@ -143,7 +143,7 @@ def checkToots(config, options, retry_count=0):
|
||||
|
||||
print("📌 skipping pinned toot - " + str(toot.id))
|
||||
elif toot.id in toots_to_keep:
|
||||
if not options.hide_skipped:
|
||||
if not (options.hide_skipped or options.quiet):
|
||||
if options.datestamp:
|
||||
print(
|
||||
str(
|
||||
@ -156,7 +156,7 @@ def checkToots(config, options, retry_count=0):
|
||||
|
||||
print("💾 skipping saved toot - " + str(toot.id))
|
||||
elif toot.visibility in visibility_to_keep:
|
||||
if not options.hide_skipped:
|
||||
if not (options.hide_skipped or options.quiet):
|
||||
if options.datestamp:
|
||||
print(
|
||||
str(
|
||||
@ -174,7 +174,7 @@ def checkToots(config, options, retry_count=0):
|
||||
+ str(toot.id)
|
||||
)
|
||||
elif len(hashtags_to_keep.intersection(toot_tags)) > 0:
|
||||
if not options.hide_skipped:
|
||||
if not (options.hide_skipped or options.quiet):
|
||||
if options.datestamp:
|
||||
print(
|
||||
str(
|
||||
@ -188,6 +188,7 @@ def checkToots(config, options, retry_count=0):
|
||||
print("#️⃣ skipping toot with hashtag - " + str(toot.id))
|
||||
elif cutoff_date > toot.created_at:
|
||||
if hasattr(toot, "reblog") and toot.reblog:
|
||||
if not options.quiet:
|
||||
if options.datestamp:
|
||||
print(
|
||||
str(
|
||||
@ -208,6 +209,7 @@ def checkToots(config, options, retry_count=0):
|
||||
# unreblog the original toot (their toot), not the toot created by boosting (your toot)
|
||||
if not options.test:
|
||||
if mastodon.ratelimit_remaining == 0:
|
||||
if not options.quiet:
|
||||
print(
|
||||
"Rate limit reached. Waiting for a rate limit reset"
|
||||
)
|
||||
@ -219,6 +221,7 @@ def checkToots(config, options, retry_count=0):
|
||||
f.close()
|
||||
mastodon.status_unreblog(toot.reblog)
|
||||
else:
|
||||
if not options.quiet:
|
||||
if options.datestamp:
|
||||
print(
|
||||
str(
|
||||
@ -240,7 +243,7 @@ def checkToots(config, options, retry_count=0):
|
||||
2
|
||||
) # wait 2 secs between deletes to be a bit nicer to the server
|
||||
if not options.test:
|
||||
if mastodon.ratelimit_remaining == 0:
|
||||
if mastodon.ratelimit_remaining == 0 and not options.quiet:
|
||||
|
||||
now = time.time()
|
||||
diff = mastodon.ratelimit_reset - now
|
||||
@ -358,8 +361,8 @@ def checkToots(config, options, retry_count=0):
|
||||
|
||||
print("Removed " + str(deleted_count) + " toots.")
|
||||
|
||||
print("")
|
||||
print("---------------------------------------")
|
||||
if not options.quiet:
|
||||
print("\n---------------------------------------")
|
||||
print("🥳 ==> 🧼 ==> 😇 User cleanup complete!")
|
||||
print("---------------------------------------\n")
|
||||
|
||||
@ -386,6 +389,7 @@ def checkToots(config, options, retry_count=0):
|
||||
account = mastodon.account(user_id)
|
||||
timeline = mastodon.account_statuses(user_id, limit=40)
|
||||
|
||||
if not options.quiet:
|
||||
print("Checking " + str(account.statuses_count) + " toots")
|
||||
|
||||
checkBatch(timeline)
|
||||
|
Loading…
x
Reference in New Issue
Block a user