Merge pull request #605 from mampfes/remove_default_trash_can

dont overwrite default icon in icon mapping
This commit is contained in:
Steffen Zimmermann
2023-01-12 08:20:06 +01:00
committed by GitHub
19 changed files with 19 additions and 19 deletions

View File

@@ -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

View File

@@ -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}")

View File

@@ -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:

View File

@@ -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),
)
)

View File

@@ -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"]),
)
)

View File

@@ -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)
)
)

View File

@@ -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),
)
)

View File

@@ -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

View File

@@ -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),
)
)

View File

@@ -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(

View File

@@ -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'],

View File

@@ -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(

View File

@@ -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(

View File

@@ -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())
)
)

View File

@@ -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),
)
)

View File

@@ -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],

View File

@@ -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(

View File

@@ -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"])
)

View File

@@ -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"