From 122ddf7f56d3bd61446931046c600028e475b74a Mon Sep 17 00:00:00 2001 From: Bram Kelchtermans Date: Wed, 16 Apr 2025 21:31:12 +0200 Subject: [PATCH] update --- Dockers/iptv-filter/Dockerfile | 3 +++ Dockers/iptv-filter/main.py | 8 ++++++-- Dockers/iptv-filter/requirements.txt | 7 ++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Dockers/iptv-filter/Dockerfile b/Dockers/iptv-filter/Dockerfile index befbf18..a91add2 100644 --- a/Dockers/iptv-filter/Dockerfile +++ b/Dockers/iptv-filter/Dockerfile @@ -5,6 +5,9 @@ WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt +# Create the m3u8 directory +RUN mkdir -p /m3u8 && chmod 777 /m3u8 + COPY main.py . COPY version . diff --git a/Dockers/iptv-filter/main.py b/Dockers/iptv-filter/main.py index ff783a9..039010a 100644 --- a/Dockers/iptv-filter/main.py +++ b/Dockers/iptv-filter/main.py @@ -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}") diff --git a/Dockers/iptv-filter/requirements.txt b/Dockers/iptv-filter/requirements.txt index 89e5967..25c7764 100644 --- a/Dockers/iptv-filter/requirements.txt +++ b/Dockers/iptv-filter/requirements.txt @@ -1,3 +1,4 @@ -flask==2.0.1 -requests==2.26.0 -schedule==1.1.0 \ No newline at end of file +flask==2.2.3 +requests==2.28.2 +schedule==1.1.0 +werkzeug==2.2.3 \ No newline at end of file