add item specification (details), if available
This commit is contained in:
parent
a31e490dcb
commit
de8af89d71
1 changed files with 7 additions and 1 deletions
8
main.py
8
main.py
|
|
@ -55,10 +55,16 @@ class BringPlugin:
|
||||||
async def grab_items(self, bring_list):
|
async def grab_items(self, bring_list):
|
||||||
"""Grabs the items of the list using the list's uuid"""
|
"""Grabs the items of the list using the list's uuid"""
|
||||||
item_objs = (await self.bring.get_list(bring_list.uuid)).items.purchase
|
item_objs = (await self.bring.get_list(bring_list.uuid)).items.purchase
|
||||||
bring_list.items = [item.itemId for item in item_objs]
|
bring_list.items = [self.transform_item(item) for item in item_objs]
|
||||||
print(f"Successfully fetched items at {datetime.datetime.now().isoformat()}")
|
print(f"Successfully fetched items at {datetime.datetime.now().isoformat()}")
|
||||||
print(f"Items = {bring_list.items}")
|
print(f"Items = {bring_list.items}")
|
||||||
|
|
||||||
|
def transform_item(self, api_item):
|
||||||
|
if api_item.specification:
|
||||||
|
return f"{api_item.itemId} ({api_item.specification})"
|
||||||
|
else:
|
||||||
|
return api_item.itemId
|
||||||
|
|
||||||
async def send_list_to_trmnl(self, session, bring_list):
|
async def send_list_to_trmnl(self, session, bring_list):
|
||||||
"""Sends the list to TRMNL if it has changed"""
|
"""Sends the list to TRMNL if it has changed"""
|
||||||
if self.existing_list == bring_list:
|
if self.existing_list == bring_list:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue