This commit is contained in:
ArabCoders 2024-03-28 22:55:24 +03:00
parent 46e7d28fc8
commit 5d57ae25ab
4 changed files with 8 additions and 9 deletions

View file

@ -4,7 +4,6 @@ from datetime import datetime, timezone
from email.utils import formatdate from email.utils import formatdate
import json import json
from sqlite3 import Connection from sqlite3 import Connection
from Utils import calcDownloadPath
from Config import Config from Config import Config
from Download import Download from Download import Download
from ItemDTO import ItemDTO from ItemDTO import ItemDTO

View file

@ -11,7 +11,6 @@ from Utils import ObjectSerializer, Notifier
from aiohttp import web, client from aiohttp import web, client
from aiohttp.web import Request, Response from aiohttp.web import Request, Response
from Webhooks import Webhooks from Webhooks import Webhooks
from Download import Download
from player.M3u8 import M3u8 from player.M3u8 import M3u8
from player.Segments import Segments from player.Segments import Segments
import socketio import socketio
@ -416,11 +415,16 @@ class Main:
if not file: if not file:
raise web.HTTPBadRequest(reason='file is required.') raise web.HTTPBadRequest(reason='file is required.')
return web.Response( try:
text=await M3u8(url=f"{self.config.url_host}{self.config.url_prefix}").make_stream( text = await M3u8(url=f"{self.config.url_host}{self.config.url_prefix}").make_stream(
download_path=self.config.download_path, download_path=self.config.download_path,
file=file file=file
), )
except Exception as e:
return web.HTTPNotFound(reason=str(e))
return web.Response(
text=text,
headers={ headers={
'Content-Type': 'application/x-mpegURL', 'Content-Type': 'application/x-mpegURL',
'Cache-Control': 'no-cache', 'Cache-Control': 'no-cache',

View file

@ -2,7 +2,6 @@ import asyncio
import hashlib import hashlib
import logging import logging
import os import os
import subprocess
import tempfile import tempfile
from Utils import calcDownloadPath from Utils import calcDownloadPath

View file

@ -4,11 +4,8 @@ Python wrapper for ffprobe command line tool. ffprobe must exist in the path.
import asyncio import asyncio
import functools import functools
import json import json
import logging
import operator import operator
import os import os
import pipes
import subprocess
class FFProbeError(Exception): class FFProbeError(Exception):