Working version

This commit is contained in:
2025-09-15 11:36:43 -04:00
parent 3d4afe7eab
commit 2003b9d115
10 changed files with 968 additions and 0 deletions

50
run.py Normal file
View File

@@ -0,0 +1,50 @@
# run.py
## Download EPG ##
import requests
from pathlib import Path
from datetime import datetime, timedelta
import os
xml_url = os.getenv("XML_URL")
import sys
DATA_DIR = Path("data")
DATA_DIR.mkdir(parents=True, exist_ok=True)
local_path = DATA_DIR / "epg.xml"
def download_epg():
try:
resp = requests.get(xml_url, timeout=30)
resp.raise_for_status()
local_path.write_bytes(resp.content)
print(f"EPG saved to {local_path}")
except Exception as e:
print(f"Failed to download EPG: {e}", file=sys.stderr)
# If EPG is required for later steps, you may want to sys.exit(1)
download_epg()
def run(mod):
print(mod.upper())
rc = os.system(f"python -m src.{mod}")
if rc != 0:
print(f"ERROR in {mod} (exit {rc})")
for mod in ["mlb", "epl", "ufc"]:
run(mod)
##################
##### SLEEPY #####
##################
print(datetime.now())
now = datetime.now()
manana0 = datetime.now()+timedelta(days=1)
manana = datetime(int(manana0.year),int(manana0.month),int(manana0.day),7,30)
print('sleeping until '+str(manana))
print(((manana-now).days*24*60*60)+((manana-now).seconds))
time.sleep(((manana-now).days*24*60*60)+((manana-now).seconds))
#del game_url
#del main_soup
print(datetime.now())