update
Build and Push Docker Images / build-and-push (push) Successful in 33s

This commit is contained in:
2025-04-16 21:31:12 +02:00
parent 6d8b4c000a
commit 122ddf7f56
3 changed files with 13 additions and 5 deletions
+6 -2
View File
@@ -9,20 +9,24 @@ from threading import Thread
# Configuration
SOURCE_URL = os.environ.get('SOURCE_URL', 'http://example.com/source.m3u8')
PORT = int(os.environ.get('PORT', 8000))
LOCAL_FILE_PATH = 'playlist.m3u8'
M3U8_DIR = '/m3u8'
LOCAL_FILE_PATH = os.path.join(M3U8_DIR, 'playlist.m3u8')
app = Flask(__name__)
def download_m3u8():
"""Download the M3U8 file from the source URL"""
try:
# Ensure the directory exists
os.makedirs(M3U8_DIR, exist_ok=True)
print(f"{datetime.now()} - Downloading M3U8 from {SOURCE_URL}")
response = requests.get(SOURCE_URL, timeout=30)
if response.status_code == 200:
with open(LOCAL_FILE_PATH, 'wb') as f:
f.write(response.content)
print(f"{datetime.now()} - M3U8 file downloaded successfully")
print(f"{datetime.now()} - M3U8 file downloaded successfully to {LOCAL_FILE_PATH}")
return True
else:
print(f"{datetime.now()} - Failed to download M3U8. Status code: {response.status_code}")