Show IP address
All checks were successful
docker-image / docker (push) Successful in 8m19s

This commit is contained in:
Stefan Bethke 2025-09-09 20:44:48 +02:00
commit d17a7770d6
3 changed files with 11 additions and 4 deletions

View file

@ -17,7 +17,7 @@ LOG = logging.getLogger(__name__)
def setup_animations(config, animator: BubaAnimator, webqueue: WebQueue): def setup_animations(config, animator: BubaAnimator, webqueue: WebQueue):
cs = BubaCharset(animator.buba) cs = BubaCharset(animator.buba)
bt = BubaTime(animator.buba) bt = BubaTime(animator.buba, config.ip)
snake = SnakeAnimation(animator.buba) snake = SnakeAnimation(animator.buba)
@ -46,7 +46,7 @@ def setup_animations(config, animator: BubaAnimator, webqueue: WebQueue):
# animator.add(cs) # animator.add(cs)
animator.add(bt) animator.add(bt)
# animator.add(snake) animator.add(snake)
animator.add(dbf_ahst) animator.add(dbf_ahst)
animator.add(dbf_ahs) animator.add(dbf_ahs)
animator.add(ccchh_events) animator.add(ccchh_events)

View file

@ -6,13 +6,14 @@ from buba.bubacmd import BubaCmd
class BubaTime(BubaAnimation): class BubaTime(BubaAnimation):
def __init__(self, buba: BubaCmd): def __init__(self, buba: BubaCmd, ip:str):
super().__init__(buba) super().__init__(buba)
self.ip = ip
def show(self): def show(self):
self.buba.text(page=0, row=0, col_start=0, col_end=119, text="Chaos Computer Club", align=BubaCmd.ALIGN_CENTER) self.buba.text(page=0, row=0, col_start=0, col_end=119, text="Chaos Computer Club", align=BubaCmd.ALIGN_CENTER)
self.buba.text(page=0, row=1, col_start=0, col_end=119, text="Hansestadt Hamburg", align=BubaCmd.ALIGN_CENTER) self.buba.text(page=0, row=1, col_start=0, col_end=119, text="Hansestadt Hamburg", align=BubaCmd.ALIGN_CENTER)
self.buba.text(page=0, row=2, col_start=0, col_end=119, text="", align=BubaCmd.ALIGN_CENTER) self.buba.text(page=0, row=2, col_start=0, col_end=119, text=f"{self.ip}", align=BubaCmd.ALIGN_CENTER)
self.buba.text(page=0, row=3, col_start=0, col_end=119, text=datetime.now().strftime("%Y-%m-%d %H:%M"), align=BubaCmd.ALIGN_CENTER) self.buba.text(page=0, row=3, col_start=0, col_end=119, text=datetime.now().strftime("%Y-%m-%d %H:%M"), align=BubaCmd.ALIGN_CENTER)
sleep(10) sleep(10)

View file

@ -22,3 +22,9 @@ class AppConfig:
self.debug = True self.debug = True
else: else:
self.debug = False self.debug = False
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(("8.8.8.8", 80))
self.ip = s.getsockname()[0]
s.close()