Spaces:
Sleeping
Sleeping
Captain Ezio
commited on
Commit
·
1c016d9
1
Parent(s):
7f19616
minor fixes
Browse files- Powers/plugins/clean_db.py +5 -4
- Powers/plugins/web_con.py +7 -1
- Powers/utils/web_helpers.py +6 -2
Powers/plugins/clean_db.py
CHANGED
@@ -22,8 +22,8 @@ from Powers.database.warns_db import Warns, WarnSettings
|
|
22 |
from Powers.utils.custom_filters import command
|
23 |
from Powers.vars import Config
|
24 |
|
25 |
-
scheduler = AsyncIOScheduler()
|
26 |
-
scheduler.timezone = TIME_ZONE
|
27 |
|
28 |
async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
29 |
to_clean = list()
|
@@ -82,6 +82,7 @@ async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
|
82 |
to_clean.clear()
|
83 |
if is_cmd:
|
84 |
txt += f"\nClean type: Forced\nInitiated by: {(await c.get_users(user_ids=id)).mention}"
|
|
|
85 |
await c.send_message(chat_id=MESSAGE_DUMP,text=txt)
|
86 |
return txt
|
87 |
else:
|
@@ -90,5 +91,5 @@ async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
|
90 |
return
|
91 |
|
92 |
|
93 |
-
scheduler.add_job(clean_my_db,'cron',[Gojo],hour=3,minute=0,second=0)
|
94 |
-
scheduler.start()
|
|
|
22 |
from Powers.utils.custom_filters import command
|
23 |
from Powers.vars import Config
|
24 |
|
25 |
+
# scheduler = AsyncIOScheduler()
|
26 |
+
# scheduler.timezone = TIME_ZONE
|
27 |
|
28 |
async def clean_my_db(c:Gojo,is_cmd=False, id=None):
|
29 |
to_clean = list()
|
|
|
82 |
to_clean.clear()
|
83 |
if is_cmd:
|
84 |
txt += f"\nClean type: Forced\nInitiated by: {(await c.get_users(user_ids=id)).mention}"
|
85 |
+
txt += f"\nClean type: Auto\n\tTook {time.time()-start-60} seconds to complete the process"
|
86 |
await c.send_message(chat_id=MESSAGE_DUMP,text=txt)
|
87 |
return txt
|
88 |
else:
|
|
|
91 |
return
|
92 |
|
93 |
|
94 |
+
# scheduler.add_job(clean_my_db,'cron',[Gojo],hour=3,minute=0,second=0)
|
95 |
+
# scheduler.start()
|
Powers/plugins/web_con.py
CHANGED
@@ -262,9 +262,12 @@ async def song_down_up(c: Gojo, m: Message):
|
|
262 |
query = splited
|
263 |
XnX = await m.reply_text("⏳")
|
264 |
try:
|
265 |
-
await youtube_downloader(c,m,query,is_direct,"a")
|
266 |
await XnX.delete()
|
267 |
return
|
|
|
|
|
|
|
268 |
except Exception as e:
|
269 |
await XnX.edit_text(f"Got an error\n{e}")
|
270 |
LOGGER.error(e)
|
@@ -289,6 +292,9 @@ async def video_down_up(c: Gojo, m: Message):
|
|
289 |
await youtube_downloader(c,m,query,is_direct,"v")
|
290 |
await XnX.delete()
|
291 |
return
|
|
|
|
|
|
|
292 |
except Exception as e:
|
293 |
await XnX.edit_text(f"Got an error\n{e}")
|
294 |
LOGGER.error(e)
|
|
|
262 |
query = splited
|
263 |
XnX = await m.reply_text("⏳")
|
264 |
try:
|
265 |
+
x = await youtube_downloader(c,m,query,is_direct,"a")
|
266 |
await XnX.delete()
|
267 |
return
|
268 |
+
except KeyError:
|
269 |
+
await XnX.edit_text(f"Failed to find any result")
|
270 |
+
return
|
271 |
except Exception as e:
|
272 |
await XnX.edit_text(f"Got an error\n{e}")
|
273 |
LOGGER.error(e)
|
|
|
292 |
await youtube_downloader(c,m,query,is_direct,"v")
|
293 |
await XnX.delete()
|
294 |
return
|
295 |
+
except KeyError:
|
296 |
+
await XnX.edit_text(f"Failed to find any result")
|
297 |
+
return
|
298 |
except Exception as e:
|
299 |
await XnX.edit_text(f"Got an error\n{e}")
|
300 |
LOGGER.error(e)
|
Powers/utils/web_helpers.py
CHANGED
@@ -232,7 +232,11 @@ async def youtube_downloader(c:Gojo,m:Message,query:str,is_direct:bool,type_:str
|
|
232 |
dicti = await song_search(query, 1)
|
233 |
if not dicti:
|
234 |
await m.reply_text("File with duration less than or equals to 5 minutes is allowed only")
|
235 |
-
|
|
|
|
|
|
|
|
|
236 |
FILE = ydl.extract_info(query,download=video)
|
237 |
if int(FILE['duration']) > 600:
|
238 |
await m.reply_text("File with duration less than or equals to 5 minutes is allowed only")
|
@@ -263,7 +267,7 @@ async def youtube_downloader(c:Gojo,m:Message,query:str,is_direct:bool,type_:str
|
|
263 |
)
|
264 |
if video:
|
265 |
await m.reply_video(f_path,caption=cap,reply_markup=kb,duration=int(FILE['duration']))
|
266 |
-
os.remove(
|
267 |
return
|
268 |
elif song:
|
269 |
await m.reply_audio(f_path,caption=cap,reply_markup=kb,duration=int(FILE['duration']),thumb=thumb,title=f_name)
|
|
|
232 |
dicti = await song_search(query, 1)
|
233 |
if not dicti:
|
234 |
await m.reply_text("File with duration less than or equals to 5 minutes is allowed only")
|
235 |
+
try:
|
236 |
+
query = dicti[1]['link']
|
237 |
+
except KeyError:
|
238 |
+
z = "KeyError"
|
239 |
+
return z
|
240 |
FILE = ydl.extract_info(query,download=video)
|
241 |
if int(FILE['duration']) > 600:
|
242 |
await m.reply_text("File with duration less than or equals to 5 minutes is allowed only")
|
|
|
267 |
)
|
268 |
if video:
|
269 |
await m.reply_video(f_path,caption=cap,reply_markup=kb,duration=int(FILE['duration']))
|
270 |
+
os.remove(f"./{FILE['id']}.mp4")
|
271 |
return
|
272 |
elif song:
|
273 |
await m.reply_audio(f_path,caption=cap,reply_markup=kb,duration=int(FILE['duration']),thumb=thumb,title=f_name)
|