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
+3
View File
@@ -5,6 +5,9 @@ WORKDIR /app
COPY requirements.txt . COPY requirements.txt .
RUN pip install --no-cache-dir -r 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 main.py .
COPY version . COPY version .
+6 -2
View File
@@ -9,20 +9,24 @@ from threading import Thread
# Configuration # Configuration
SOURCE_URL = os.environ.get('SOURCE_URL', 'http://example.com/source.m3u8') SOURCE_URL = os.environ.get('SOURCE_URL', 'http://example.com/source.m3u8')
PORT = int(os.environ.get('PORT', 8000)) 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__) app = Flask(__name__)
def download_m3u8(): def download_m3u8():
"""Download the M3U8 file from the source URL""" """Download the M3U8 file from the source URL"""
try: try:
# Ensure the directory exists
os.makedirs(M3U8_DIR, exist_ok=True)
print(f"{datetime.now()} - Downloading M3U8 from {SOURCE_URL}") print(f"{datetime.now()} - Downloading M3U8 from {SOURCE_URL}")
response = requests.get(SOURCE_URL, timeout=30) response = requests.get(SOURCE_URL, timeout=30)
if response.status_code == 200: if response.status_code == 200:
with open(LOCAL_FILE_PATH, 'wb') as f: with open(LOCAL_FILE_PATH, 'wb') as f:
f.write(response.content) 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 return True
else: else:
print(f"{datetime.now()} - Failed to download M3U8. Status code: {response.status_code}") print(f"{datetime.now()} - Failed to download M3U8. Status code: {response.status_code}")
+4 -3
View File
@@ -1,3 +1,4 @@
flask==2.0.1 flask==2.2.3
requests==2.26.0 requests==2.28.2
schedule==1.1.0 schedule==1.1.0
werkzeug==2.2.3