diff --git a/inventory.py b/inventory.py index 4f25b06..1727353 100644 --- a/inventory.py +++ b/inventory.py @@ -455,10 +455,12 @@ class DropsCampaign: channel is None or ( # channel isn't specified, # or there's no ACL, or the channel is in the ACL (not self.allowed_channels or channel in self.allowed_channels) - # and the channel is live and playing the campaign's game + # and the channel is live and playing the campaign's game, + # or this campaign can be earned anywhere (special game) and ( ignore_channel_status or channel.game is not None and channel.game == self.game + or self.game.is_special_events() ) ) ) diff --git a/twitch.py b/twitch.py index 54c842e..97ee9da 100644 --- a/twitch.py +++ b/twitch.py @@ -981,16 +981,21 @@ class Twitch: """ Determines if the given channel qualifies as a watching candidate. """ - if not self.wanted_games: - return False - # exit early if stream is offline or drops aren't enabled - if not channel.online or not channel.drops_enabled: - return False - # check if we can progress any campaign for the played game - if channel.game is None or channel.game not in self.wanted_games: + # exit early if stream is offline + if not channel.online: return False for campaign in self.inventory: - if campaign.can_earn(channel): + if ( + campaign.can_earn(channel) # let the campaign do the "special games" check + and ( + # limit watching to the games the user wants + channel.game is not None + and channel.drops_enabled + and channel.game in self.wanted_games + # let the campaign ignore all channel-related checks + or campaign.game.is_special_events() + ) + ): return True return False diff --git a/utils.py b/utils.py index 02c3f2b..5fc9440 100644 --- a/utils.py +++ b/utils.py @@ -402,6 +402,8 @@ class AwaitableValue(Generic[_T]): class Game: + SPECIAL_EVENTS_GAME_ID: int = 509663 + def __init__(self, data: JsonType): self.id: int = int(data["id"]) self.name: str = data.get("displayName") or data["name"] @@ -434,3 +436,6 @@ class Game: # strip and collapse dashes slug_text = re.sub(r'-{2,}', '-', slug_text.strip('-')) return slug_text + + def is_special_events(self) -> bool: + return self.id == self.SPECIAL_EVENTS_GAME_ID