Improve image tags to also work with eveonline objects, use new tags in group managenet, optimer, timerboard

This commit is contained in:
Erik Kalkoken
2020-02-05 04:31:13 +00:00
committed by colcrunch
parent 337c4d9ce5
commit fcb66a11a3
18 changed files with 1227 additions and 151 deletions

View File

@@ -0,0 +1,52 @@
# this module generates profile URLs for dotlan
from urllib.parse import urljoin, quote
from . import *
BASE_URL = 'http://evemaps.dotlan.net'
def _build_url(category: str, name: str) -> str:
"""return url to profile page for an eve entity"""
if category == ESI_CATEGORY_ALLIANCE:
partial = 'alliance'
elif category == ESI_CATEGORY_CORPORATION:
partial = 'corp'
elif category == ESI_CATEGORY_REGION:
partial = 'map'
elif category == ESI_CATEGORY_SOLARSYSTEM:
partial = 'system'
else:
raise NotImplementedError(
"Not implemented yet for category:" + category
)
url = urljoin(
BASE_URL,
'{}/{}'.format(partial, quote(str(name).replace(" ", "_")))
)
return url
def alliance_url(name: str) -> str:
"""url for page about given alliance on dotlan"""
return _build_url(ESI_CATEGORY_ALLIANCE, name)
def corporation_url(name: str) -> str:
"""url for page about given corporation on dotlan"""
return _build_url(ESI_CATEGORY_CORPORATION, name)
def region_url(name: str) -> str:
"""url for page about given region on dotlan"""
return _build_url(ESI_CATEGORY_REGION, name)
def solar_system_url(name: str) -> str:
"""url for page about given solar system on dotlan"""
return _build_url(ESI_CATEGORY_SOLARSYSTEM, name)