Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark latest subscription with star #163

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions src/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ async def get_owned_games(self):
return [g.in_galaxy_format() for g in self._owned_games.values()]

@staticmethod
def _normalize_subscription_name(machine_name: str):
def _normalize_subscription_name(machine_name: str, is_active: bool):
month_map = {
'january': '01',
'february': '02',
Expand All @@ -182,7 +182,7 @@ def _normalize_subscription_name(machine_name: str):
'december': '12'
}
month, year, type_ = machine_name.split('_')
return f'Humble {type_.title()} {year}-{month_map[month]}'
return f'Humble {type_.title()}{"★" if is_active else ""} {year}-{month_map[month]}'

@staticmethod
def _choice_name_to_slug(subscription_name: str):
Expand All @@ -204,13 +204,14 @@ async def get_subscriptions(self):
if 'contentChoiceData' not in product:
break # all Humble Choice months already yielded

subscriptions.append(Subscription(
self._normalize_subscription_name(product['productMachineName']),
owned='gamekey' in product
))
if product.get('isActiveContent'): # assuming there is only one "active" month at a time
is_active = True
active_content_unlocked = True

subscriptions.append(Subscription(
self._normalize_subscription_name(product['productMachineName'], is_active),
owned='gamekey' in product))

if not active_content_unlocked:
'''
- for not subscribers as potential discovery of current choice games
Expand All @@ -222,7 +223,7 @@ async def get_subscriptions(self):
if historical_subscriber else None

subscriptions.append(Subscription(
self._normalize_subscription_name(active_month.machine_name),
self._normalize_subscription_name(active_month.machine_name, is_active=True),
owned=current_plan is not None and current_plan.tier != Tier.LITE,
end_time=None # #117: get_last_friday.timestamp() if user_plan not in [None, Lite] else None
))
Expand Down