uudon wrote:Hasta wrote:Won't bother to make clogs, inevitably step on a splinter and perish of the infected wound.
I wish they would add this back into the game, thorn in the foot was quite possibly the funniest way to die.
Not death by midges?
uudon wrote:Hasta wrote:Won't bother to make clogs, inevitably step on a splinter and perish of the infected wound.
I wish they would add this back into the game, thorn in the foot was quite possibly the funniest way to die.
landreaum wrote:Not death by midges?
loftar wrote:Oh my, I'm terribly sorry for the delay. Apparently my alarm didn't work for whatever reason, and of course it crashed like the actual second I went to sleep. Trying to debug now.
import requests
from bs4 import BeautifulSoup
import time
import pygame
# Initialize pygame
pygame.mixer.init()
# Main loop to check the webpage and play the sound
while True:
try:
response = requests.get('https://www.havenandhearth.com/portal/')
soup = BeautifulSoup(response.text, 'html.parser')
status_div = soup.find('div', {'id': 'status'})
if status_div and status_div.find('h2') and 'The server is up' in status_div.find('h2').text:
print("Alarm: The server is up.")
pygame.mixer.music.load(r'$path')
pygame.mixer.music.play()
else:
print("The server might not be up or the status couldn't be found.")
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
time.sleep(60) # Sleep for 60 seconds (1 minute) before the next request
TheServant wrote:You need a better alarm
#!/usr/bin/python3
import sys, os, urllib.request, time
url = "http://www.havenandhearth.com/mt/srv-mon"
spath = os.path.join(os.getenv("HOME"), "audio/sounds/takeya.wav")
while True:
try:
with urllib.request.urlopen(url) as s:
while ln := s.readline():
words = ln.decode("ascii").split()
if len(words) == 0:
sys.stderr.write("haven-alarm: connected\n")
continue
if words[0] == "state" and words[1] == "crashed":
os.system("play -q " + spath)
except urllib.error.URLError as exc:
sys.stderr.write("haven-alarm: warning: could not connect: %s\n" % exc)
time.sleep(60)
sys.stderr.write("haven-alarm: reconnecting\n")
continue
Users browsing this forum: Amazon [Bot], BLEX [Bot], Claude [Bot] and 8 guests