Skip to content

Commit

Permalink
Fix friday tags (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
i-be-snek authored Dec 20, 2023
1 parent 6c48d83 commit fea741d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class RedditThread(Enum):
body: str = "body"
image: str = "image"
reddit_gallery: str = "reddit_gallery"
rule_1: str = "rule_1"


@unique
Expand Down Expand Up @@ -66,7 +67,8 @@ class Config:
"FILESTACK_APP_SECRET",
"FILESTACK_HANDLE_REFRESH",
"FILESTACK_HANDLE_BACKUP",
"FILESTACK_HANDLE_MOD_MESSAGE" "REDDIT_MIRROR_SCHEDULE_TYPE",
"FILESTACK_HANDLE_MOD_MESSAGE",
"REDDIT_MIRROR_SCHEDULE_TYPE",
)

configs_with_defaults: tuple = (
Expand Down
11 changes: 11 additions & 0 deletions src/mirror.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
)


def _rule_1_check_funday_friday_flair(flair: str) -> Union[bool, None]:
# if "Fun" in the flair and the day is not Friday
from datetime import datetime

if flair:
if flair.find("Fun") == 1 and datetime.now().strftime("%A") != "Friday":
# ...then ignore
return True


def _extract_threads_to_mirror(
listing: ListingGenerator,
DB: TinyDB,
Expand Down Expand Up @@ -95,6 +105,7 @@ def _extract_threads_to_mirror(
RedditThread.body: only_has_body,
RedditThread.image: True if image else None,
RedditThread.reddit_gallery: reddit_gallery,
RedditThread.rule_1: _rule_1_check_funday_friday_flair(flair),
}

for t in ignore_thread_types:
Expand Down

0 comments on commit fea741d

Please sign in to comment.