fix: don't pull the same post twice but for real #22

Merged
knoflook merged 2 commits from knoflook/lumbunglib:master into master 2022-01-28 14:50:47 +00:00
Showing only changes of commit 7e45112280 - Show all commits

View File

@ -124,15 +124,13 @@ def main():
for post_metadata in timeline:
post_dir = os.path.join(hashtag_dir, str(post_metadata["id"]))
# if there is a post in the feed we dont already have locally, make it
if str(post_metadata["id"]) not in all_existing_posts:
if not post_metadata[
"local_only"
]: # if you get an error here then you are using vanilla Mastodon, this is a Hometown or Glitch only feature
create_post(post_dir, post_metadata)
all_existing_posts.append(post_metadata["id"])
all_existing_posts.append(str(post_metadata["id"]))
else:
print("not pulling post %s (post is local only)" % (post_metadata["id"]))
@ -142,6 +140,8 @@ def main():
existing_posts.remove(
str(post_metadata["id"])
) # create list of posts which have not been returned in the feed
elif str(post_metadata["id"]) in all_existing_posts:
print("skipping post %s as it was already pulled with a different hashtag." % (str(post_metadata["id"])))
for post in existing_posts:
print(