Interim commit before breaking things
This commit is contained in:
parent
60c733ca80
commit
168d9cece4
2 changed files with 5 additions and 5 deletions
|
|
@ -36,11 +36,11 @@ async def list_servers(client: DockerClient, all: bool = False) -> list[dict]:
|
||||||
(List[Dict[str, any]]) A list of results from __extract_info
|
(List[Dict[str, any]]) A list of results from __extract_info
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __container_filter(container: Container) -> bool:
|
def __filter(container: Container) -> bool:
|
||||||
image = container.attrs.get("Config", {}).get("Image", "")
|
image: str = container.attrs.get("Config", {}).get("Image", "")
|
||||||
return image == "itzg/minecraft-server" and "net.forgeserv.hidden" not in container.labels
|
return image.startswith("itzg/minecraft-server") and "net.forgeserv.hidden" not in container.labels
|
||||||
|
|
||||||
containers: list[Container] = list(filter(__container_filter, client.containers.list(all=all)))
|
containers: list[Container] = list(filter(__filter, client.containers.list(all=all)))
|
||||||
|
|
||||||
ret = await asyncio.gather(*(Server.from_container(c) for c in containers))
|
ret = await asyncio.gather(*(Server.from_container(c) for c in containers))
|
||||||
ret = await asyncio.gather(*(x.asdict() for x in ret))
|
ret = await asyncio.gather(*(x.asdict() for x in ret))
|
||||||
|
|
|
||||||
|
|
@ -246,7 +246,7 @@ class Server:
|
||||||
ret.icon = __get_from_exec("base64 -i server-icon.png")
|
ret.icon = __get_from_exec("base64 -i server-icon.png")
|
||||||
|
|
||||||
# The rest we'll get from labels if we can
|
# The rest we'll get from labels if we can
|
||||||
ret.display_name = __get_from_label(DerivedInfoLabelKeys.DISPLAY_NAME) or ret.motd
|
ret.display_name = __get_from_label(DerivedInfoLabelKeys.DISPLAY_NAME) or container.name or ""
|
||||||
ret.game_version = __get_from_label(DerivedInfoLabelKeys.GAME_VERSION) or Server.get_from_env(container, "VERSION")
|
ret.game_version = __get_from_label(DerivedInfoLabelKeys.GAME_VERSION) or Server.get_from_env(container, "VERSION")
|
||||||
ret.pack_version = __get_from_label(DerivedInfoLabelKeys.PACK_VERSION)
|
ret.pack_version = __get_from_label(DerivedInfoLabelKeys.PACK_VERSION)
|
||||||
ret.dynmap = __get_from_label(DerivedInfoLabelKeys.DYNMAP)
|
ret.dynmap = __get_from_label(DerivedInfoLabelKeys.DYNMAP)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue