Upload WebStreamer/utils/render_template.py with huggingface_hub
Browse files
WebStreamer/utils/render_template.py
CHANGED
|
@@ -14,19 +14,19 @@ async def render_page(db_id):
|
|
| 14 |
src = urllib.parse.urljoin(Var.URL, f'dl/{file_data["_id"]}')
|
| 15 |
if str((file_data['mime_type']).split('/')[0].strip()) == 'video':
|
| 16 |
async with aiofiles.open('WebStreamer/template/req.html') as r:
|
| 17 |
-
heading = f
|
| 18 |
tag = (file_data['mime_type']).split('/')[0].strip()
|
| 19 |
html = (await r.read()).replace('tag', tag) % (heading, file_data['file_name'], src)
|
| 20 |
elif str((file_data['mime_type']).split('/')[0].strip()) == 'audio':
|
| 21 |
async with aiofiles.open('WebStreamer/template/req.html') as r:
|
| 22 |
-
heading = f
|
| 23 |
tag = (file_data['mime_type']).split('/')[0].strip()
|
| 24 |
html = (await r.read()).replace('tag', tag) % (heading, file_data['file_name'], src)
|
| 25 |
else:
|
| 26 |
async with aiofiles.open('WebStreamer/template/dl.html') as r:
|
| 27 |
async with aiohttp.ClientSession() as s:
|
| 28 |
async with s.get(src) as u:
|
| 29 |
-
heading = f
|
| 30 |
file_size = humanbytes(int(u.headers.get('Content-Length')))
|
| 31 |
html = (await r.read()) % (heading, file_data['file_name'], src, file_size)
|
| 32 |
return html
|
|
|
|
| 14 |
src = urllib.parse.urljoin(Var.URL, f'dl/{file_data["_id"]}')
|
| 15 |
if str((file_data['mime_type']).split('/')[0].strip()) == 'video':
|
| 16 |
async with aiofiles.open('WebStreamer/template/req.html') as r:
|
| 17 |
+
heading = f"Watch {file_data['file_name']}"
|
| 18 |
tag = (file_data['mime_type']).split('/')[0].strip()
|
| 19 |
html = (await r.read()).replace('tag', tag) % (heading, file_data['file_name'], src)
|
| 20 |
elif str((file_data['mime_type']).split('/')[0].strip()) == 'audio':
|
| 21 |
async with aiofiles.open('WebStreamer/template/req.html') as r:
|
| 22 |
+
heading = f"Listen {file_data['file_name']}"
|
| 23 |
tag = (file_data['mime_type']).split('/')[0].strip()
|
| 24 |
html = (await r.read()).replace('tag', tag) % (heading, file_data['file_name'], src)
|
| 25 |
else:
|
| 26 |
async with aiofiles.open('WebStreamer/template/dl.html') as r:
|
| 27 |
async with aiohttp.ClientSession() as s:
|
| 28 |
async with s.get(src) as u:
|
| 29 |
+
heading = f"Download {file_data['file_name']}"
|
| 30 |
file_size = humanbytes(int(u.headers.get('Content-Length')))
|
| 31 |
html = (await r.read()) % (heading, file_data['file_name'], src, file_size)
|
| 32 |
return html
|