Add audiolab and server-room
This commit is contained in:
parent
52c11f994e
commit
a30f85931e
1 changed files with 8 additions and 3 deletions
11
discourse.py
11
discourse.py
|
|
@ -9,7 +9,13 @@ from dotenv import load_dotenv
|
||||||
|
|
||||||
DISCOURSE_URL = "https://kb.hs3.pl" # Database is hosted here
|
DISCOURSE_URL = "https://kb.hs3.pl" # Database is hosted here
|
||||||
CATEGORY_ID = 9 # Database category ID
|
CATEGORY_ID = 9 # Database category ID
|
||||||
|
PLACES = [
|
||||||
|
"cow-work",
|
||||||
|
"garage",
|
||||||
|
"lab",
|
||||||
|
"audiolab",
|
||||||
|
"server-room"
|
||||||
|
]
|
||||||
class DiscourseDatabase():
|
class DiscourseDatabase():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
data = self.get_category_data()
|
data = self.get_category_data()
|
||||||
|
|
@ -69,8 +75,7 @@ class DiscourseDatabase():
|
||||||
|
|
||||||
def get_place(self, topic):
|
def get_place(self, topic):
|
||||||
"""Get place of a topic"""
|
"""Get place of a topic"""
|
||||||
places = ["cow-work", "garage", "lab"]
|
for place in PLACES:
|
||||||
for place in places:
|
|
||||||
if place in topic["tags"]:
|
if place in topic["tags"]:
|
||||||
return f'<a href="https://kb.hs3.pl/tag/{place}">{place}</a>'
|
return f'<a href="https://kb.hs3.pl/tag/{place}">{place}</a>'
|
||||||
return "unknown"
|
return "unknown"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue