mirror of
https://github.com/sascha-hemi/hacs_waste_collection_schedule.git
synced 2026-03-21 06:05:57 +01:00
Merge pull request #605 from mampfes/remove_default_trash_can
dont overwrite default icon in icon mapping
This commit is contained in:
@@ -96,6 +96,6 @@ class Source:
|
||||
waste_type = d[1]
|
||||
next_pickup_date = d[0]
|
||||
|
||||
entries.append(Collection(date=next_pickup_date, t=waste_type, icon=ICON_MAP.get(waste_type,"mdi:trash-can")))
|
||||
entries.append(Collection(date=next_pickup_date, t=waste_type, icon=ICON_MAP.get(waste_type)))
|
||||
|
||||
return entries
|
||||
|
||||
@@ -126,7 +126,7 @@ class Source:
|
||||
waste_date = datetime.strptime(waste_date_match[1], '%d/%m/%Y').date()
|
||||
|
||||
# Base icon on type
|
||||
waste_icon = ICON_MAP.get(waste_type.lower(), 'mdi:trash-can')
|
||||
waste_icon = ICON_MAP.get(waste_type.lower())
|
||||
|
||||
pickup_entries.append(Collection(waste_date, waste_type, waste_icon))
|
||||
_LOGGER.info(f"Collection for {waste_type} (icon: {waste_icon}) on {waste_date}")
|
||||
|
||||
@@ -86,7 +86,7 @@ class Source:
|
||||
collection_waste_object["date"], "%Y-%m-%dT%H:%M:%S"
|
||||
).date(),
|
||||
t=collection["descriptionFmt"].title(),
|
||||
icon=ICON_MAP.get(type, "mdi:trash-can"),
|
||||
icon=ICON_MAP.get(type),
|
||||
)
|
||||
)
|
||||
except ValueError:
|
||||
|
||||
@@ -101,7 +101,7 @@ class Source:
|
||||
Collection(
|
||||
date = date,
|
||||
t=waste_type, # api returns Recycling, Rubbish
|
||||
icon=ICON_MAP.get(waste_type, "mdi:trash-can"),
|
||||
icon=ICON_MAP.get(waste_type),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ class Source:
|
||||
Collection(
|
||||
date=datetime.strptime(item["ophaaldatum"], "%Y-%m-%d").date(),
|
||||
t=waste_details[0]["title"],
|
||||
icon=ICON_MAP.get(waste_details[0]["icon"], "mdi:trash-can"),
|
||||
icon=ICON_MAP.get(waste_details[0]["icon"]),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -91,7 +91,7 @@ class IpswichGovAuParser(HTMLParser):
|
||||
|
||||
self._entries.append(
|
||||
Collection(
|
||||
self._loaded_date, data, icon=ICON_MAP.get(data, "mdi:trash-can")
|
||||
self._loaded_date, data, icon=ICON_MAP.get(data)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ class Source:
|
||||
date = date,
|
||||
# t=waste_type, # api returns GeneralWaste, Recycling, GreenWaste
|
||||
t = ROUNDS.get(waste_type), # returns user-friendly General Waste, Recycling, Green Waste
|
||||
icon=ICON_MAP.get(waste_type, "mdi:trash-can"),
|
||||
icon=ICON_MAP.get(waste_type),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ class Source:
|
||||
entries = []
|
||||
for d in dates:
|
||||
date, waste_type = d
|
||||
icon = ICON_MAP.get(waste_type, "mdi:trash-can-outline")
|
||||
icon = ICON_MAP.get(waste_type)
|
||||
entries.append(Collection(date=date, t=waste_type, icon=icon))
|
||||
|
||||
return entries
|
||||
|
||||
@@ -126,7 +126,7 @@ class Source:
|
||||
Collection(
|
||||
date=next_pickup_date,
|
||||
t=waste_type,
|
||||
icon=ICON_MAP.get(waste_type, "mdi:trash-can"),
|
||||
icon=ICON_MAP.get(waste_type),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ class Source:
|
||||
entries = []
|
||||
for article in soup.find_all("article"):
|
||||
waste_type = article.h3.string
|
||||
icon = ICON_MAP.get(waste_type, "mdi:trash-can")
|
||||
icon = ICON_MAP.get(waste_type)
|
||||
next_pickup = article.find(class_="next-service").string.strip()
|
||||
if re.match(r"[^\s]* \d{1,2}\/\d{1,2}\/\d{4}", next_pickup):
|
||||
next_pickup_date = datetime.strptime(
|
||||
|
||||
@@ -73,7 +73,7 @@ class Source:
|
||||
for f in json.loads(r.content):
|
||||
# pprint(f)
|
||||
icon_name = re.sub(r"^.*?/(\w+)\.\w{3,4}$", "\\1", f['Ikon'])
|
||||
icon = ICON_MAP.get(icon_name, "mdi:trash-can")
|
||||
icon = ICON_MAP.get(icon_name)
|
||||
type[f['Id']] = {
|
||||
'name': f['Navn'],
|
||||
'image': f['Ikon'],
|
||||
|
||||
@@ -69,7 +69,7 @@ class Source:
|
||||
entries = []
|
||||
for article in soup.find_all("article"):
|
||||
waste_type = article.h3.string
|
||||
icon = ICON_MAP.get(waste_type, "mdi:trash-can")
|
||||
icon = ICON_MAP.get(waste_type)
|
||||
next_pickup = article.find(class_="next-service").string.strip()
|
||||
if re.match(r"[^\s]* \d{1,2}\/\d{1,2}\/\d{4}", next_pickup):
|
||||
next_pickup_date = datetime.strptime(
|
||||
|
||||
@@ -66,7 +66,7 @@ class Source:
|
||||
entries = []
|
||||
for article in soup.find_all("article"):
|
||||
waste_type = article.h3.string
|
||||
icon = ICON_MAP.get(waste_type, "mdi:trash-can")
|
||||
icon = ICON_MAP.get(waste_type)
|
||||
next_pickup = article.find(class_="next-service").string.strip()
|
||||
if re.match(r"[^\s]* \d{1,2}\/\d{1,2}\/\d{4}", next_pickup):
|
||||
next_pickup_date = datetime.strptime(
|
||||
|
||||
@@ -70,7 +70,7 @@ class Source:
|
||||
tjeneste['TommeDato'], "%d.%m.%Y"
|
||||
).date(),
|
||||
t = tekst,
|
||||
icon = ICON_MAP.get(tekst.lower(), "mdi:trash-can")
|
||||
icon = ICON_MAP.get(tekst.lower())
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class Source:
|
||||
Collection(
|
||||
date=next_pickup_date,
|
||||
t=waste_type,
|
||||
icon=ICON_MAP.get(waste_type, "mdi:trash-can"),
|
||||
icon=ICON_MAP.get(waste_type),
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class Source:
|
||||
|
||||
entries = []
|
||||
for d in dates:
|
||||
icon = ICON_MAP.get(d[1], "mdi:trash-can")
|
||||
icon = ICON_MAP.get(d[1])
|
||||
entries.append(Collection(
|
||||
date=d[0],
|
||||
t=d[1],
|
||||
|
||||
@@ -69,7 +69,7 @@ class Source:
|
||||
entries = []
|
||||
for article in soup.find_all("article"):
|
||||
waste_type = article.h3.string
|
||||
icon = ICON_MAP.get(waste_type, "mdi:trash-can")
|
||||
icon = ICON_MAP.get(waste_type)
|
||||
next_pickup = article.find(class_="next-service").string.strip()
|
||||
if re.match(r"[^\s]* \d{1,2}\/\d{1,2}\/\d{4}", next_pickup):
|
||||
next_pickup_date = datetime.strptime(
|
||||
|
||||
@@ -79,7 +79,7 @@ class Source:
|
||||
|
||||
entries = []
|
||||
for d in dates:
|
||||
info = ICON_MAP.get(d[1], {"icon": "mdi:trash-can", "image": ""})
|
||||
info = ICON_MAP.get(d[1], {"icon": None, "image": None})
|
||||
entries.append(
|
||||
Collection(d[0], d[1], picture=info["image"], icon=info["icon"])
|
||||
)
|
||||
|
||||
@@ -78,7 +78,7 @@ class Source:
|
||||
.replace(" Collection", "")
|
||||
)
|
||||
_LOGGER.debug("Waste Type: %s", waste_type)
|
||||
icon = ICON_MAP.get(waste_type, "mdi:trash-can")
|
||||
icon = ICON_MAP.get(waste_type)
|
||||
_LOGGER.debug("Icon: %s", icon)
|
||||
next_pickup_date = datetime.strptime(
|
||||
article.get_text().split(":")[1].strip(), "%A, %d %B %Y"
|
||||
|
||||
Reference in New Issue
Block a user