Refactor RSS stuff

This commit is contained in:
Joakim Hellsén 2026-01-08 23:52:29 +01:00
commit 4b4723c77c
No known key found for this signature in database
4 changed files with 305 additions and 113 deletions

View file

@ -157,6 +157,8 @@ class Game(models.Model):
@property
def twitch_directory_url(self) -> str:
"""Return Twitch directory URL with drops filter when slug exists."""
# TODO(TheLovinator): If no slug, get from Twitch API or IGDB? # noqa: TD003
if self.slug:
return f"https://www.twitch.tv/directory/category/{self.slug}?filter=drops"
return ""
@ -251,7 +253,7 @@ class Channel(models.Model):
)
display_name = models.TextField(
verbose_name="Display Name",
help_text=("The display name of the channel (with proper capitalization)."),
help_text="The display name of the channel (with proper capitalization).",
)
added_at = models.DateTimeField(
@ -437,6 +439,11 @@ class DropCampaign(models.Model):
)
return self.image_url or ""
@property
def is_subscription_only(self) -> bool:
"""Determine if the campaign is subscription only based on its benefits."""
return any(drop.required_subs > 0 for drop in self.time_based_drops.all()) # pyright: ignore[reportAttributeAccessIssue]
# MARK: DropBenefit
class DropBenefit(models.Model):