resolve #16 - keep toots based on visibility

This commit is contained in:
Hugh Rundle 2020-04-04 16:27:31 +11:00
parent 1497d96270
commit 23e907d595
2 changed files with 7 additions and 4 deletions

View File

@ -52,10 +52,12 @@ timeline = mastodon.account_statuses(user_id, limit=40)
def checkToots(timeline, deleted_count=0):
for toot in timeline:
try:
if config.save_pinned and hasattr(toot, "pinned") and toot.pinned:
if config.keep_pinned and hasattr(toot, "pinned") and toot.pinned:
print("📌 skipping pinned toot - " + str(toot.id))
elif toot.id in config.toots_to_save:
elif toot.id in config.toots_to_keep:
print("💾 skipping saved toot - " + str(toot.id))
elif toot.visibility in config.visibility_to_keep:
print("👀 skipping " + toot.visibility + " toot - " + str(toot.id))
elif cutoff_date > toot.created_at:
if hasattr(toot, "reblog") and toot.reblog:
print(
@ -122,7 +124,7 @@ def checkToots(timeline, deleted_count=0):
else:
if options.test:
print(
"Test run. This would have removed "
"Test run completed. This would have removed "
+ str(deleted_count)
+ " toots."
)

View File

@ -2,4 +2,5 @@ access_token = 'YOUR_ACCESS_TOKEN_HERE'
base_url = 'https://ausglam.space'
days_to_keep = 30
save_pinned = True
toots_to_save = []
toots_to_save = []
visibility_to_keep = [] # options are: 'public', 'unlisted', 'private', 'direct'