Upload button.py
Browse files- plugins/button.py +13 -2
plugins/button.py
CHANGED
@@ -4,6 +4,7 @@ import json
|
|
4 |
import time
|
5 |
import shutil
|
6 |
import asyncio
|
|
|
7 |
from datetime import datetime
|
8 |
from config import Config
|
9 |
from plugins.functions.display_progress import humanbytes, progress_for_pyrogram
|
@@ -167,6 +168,12 @@ async def youtube_dl_call_back(_bot, update):
|
|
167 |
|
168 |
logger.info(e_response)
|
169 |
logger.info(t_response)
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
|
171 |
if e_response and AD_STRING_TO_REPLACE in e_response:
|
172 |
error_message = e_response.replace(AD_STRING_TO_REPLACE, "")
|
@@ -207,6 +214,9 @@ async def youtube_dl_call_back(_bot, update):
|
|
207 |
start_time = time.time()
|
208 |
|
209 |
if tg_send_type == "video":
|
|
|
|
|
|
|
210 |
width, height, duration = await Mdata01(download_directory)
|
211 |
await update.message.reply_video(
|
212 |
video=download_directory,
|
@@ -252,8 +262,9 @@ async def youtube_dl_call_back(_bot, update):
|
|
252 |
),
|
253 |
)
|
254 |
else:
|
255 |
-
|
256 |
-
|
|
|
257 |
caption=description,
|
258 |
thumb=thumb,
|
259 |
progress=progress_for_pyrogram,
|
|
|
4 |
import time
|
5 |
import shutil
|
6 |
import asyncio
|
7 |
+
import re
|
8 |
from datetime import datetime
|
9 |
from config import Config
|
10 |
from plugins.functions.display_progress import humanbytes, progress_for_pyrogram
|
|
|
168 |
|
169 |
logger.info(e_response)
|
170 |
logger.info(t_response)
|
171 |
+
embed_pattern = re.compile(r'\[EmbedSubtitle\] Embedding subtitles in "(.*?)"')
|
172 |
+
final_file_match = embed_pattern.search(t_response) or embed_pattern.search(e_response)
|
173 |
+
if final_file_match:
|
174 |
+
final_file_path = final_file_match.group(1)
|
175 |
+
download_directory = final_file_path
|
176 |
+
logger.info("Final file with subtitles: %s", final_file_path)
|
177 |
|
178 |
if e_response and AD_STRING_TO_REPLACE in e_response:
|
179 |
error_message = e_response.replace(AD_STRING_TO_REPLACE, "")
|
|
|
214 |
start_time = time.time()
|
215 |
|
216 |
if tg_send_type == "video":
|
217 |
+
|
218 |
+
|
219 |
+
|
220 |
width, height, duration = await Mdata01(download_directory)
|
221 |
await update.message.reply_video(
|
222 |
video=download_directory,
|
|
|
262 |
),
|
263 |
)
|
264 |
else:
|
265 |
+
await update.message.reply_video(
|
266 |
+
# await update.message.reply_document(
|
267 |
+
video=download_directory,
|
268 |
caption=description,
|
269 |
thumb=thumb,
|
270 |
progress=progress_for_pyrogram,
|