mirror of
https://github.com/yasirarism/MissKatyPyro.git
synced 2026-01-06 20:04:51 +00:00
Fix
This commit is contained in:
parent
222c4889ea
commit
f7f1a0d38c
2 changed files with 23 additions and 24 deletions
|
|
@ -17,6 +17,7 @@ from requests_toolbelt import MultipartEncoder
|
||||||
|
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
from misskaty.core.message_utils import *
|
from misskaty.core.message_utils import *
|
||||||
|
from misskaty.core.decorator.ratelimiter import ratelimiter
|
||||||
from misskaty.helper import SUPPORTED_URL_REGEX, progress_for_pyrogram, get_random_string
|
from misskaty.helper import SUPPORTED_URL_REGEX, progress_for_pyrogram, get_random_string
|
||||||
from misskaty.vars import COMMAND_HANDLER
|
from misskaty.vars import COMMAND_HANDLER
|
||||||
|
|
||||||
|
|
@ -82,7 +83,7 @@ async def generate_ss_from_file(
|
||||||
await editPesan(replymsg, f"Generating **{frame_count}** screnshots from `{unquote(file_name)}`, please wait...")
|
await editPesan(replymsg, f"Generating **{frame_count}** screnshots from `{unquote(file_name)}`, please wait...")
|
||||||
|
|
||||||
rand_str = get_random_string(7)
|
rand_str = get_random_string(7)
|
||||||
os.mkdir()(f"screenshot_{rand_str}")
|
os.mkdir(f"screenshot_{rand_str}")
|
||||||
|
|
||||||
loop_count = frame_count
|
loop_count = frame_count
|
||||||
while loop_count != 0:
|
while loop_count != 0:
|
||||||
|
|
@ -190,32 +191,32 @@ async def telegram_screenshot(client, message, frame_count):
|
||||||
Generates Screenshots from Telegram Video Files.
|
Generates Screenshots from Telegram Video Files.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
message = message.reply_to_message
|
replymsg = message.reply_to_message
|
||||||
if message.text:
|
if replymsg.text:
|
||||||
return await message.reply_text("Reply to a proper video file to Generate Screenshots. **", quote=True)
|
return await kirimPesan(message, "Reply to a proper video file to Generate Screenshots. **", quote=True)
|
||||||
|
|
||||||
elif message.media.value == "video":
|
elif replymsg.media.value == "video":
|
||||||
media = message.video
|
media = replymsg.video
|
||||||
|
|
||||||
elif message.media.value == "document":
|
elif replymsg.media.value == "document":
|
||||||
media = message.document
|
media = replymsg.document
|
||||||
|
|
||||||
else:
|
else:
|
||||||
return await message.reply_text("can only generate screenshots from video file....", quote=True)
|
return await kirimPesan(message, "can only generate screenshots from video file....", quote=True)
|
||||||
|
|
||||||
file_name = str(media.file_name)
|
file_name = str(media.file_name)
|
||||||
mime = media.mime_type
|
mime = media.mime_type
|
||||||
size = media.file_size
|
size = media.file_size
|
||||||
|
|
||||||
if message.media.value == "document" and "video" not in mime:
|
if message.media.value == "document" and "video" not in mime:
|
||||||
return await message.reply_text("can only generate screenshots from video file....", quote=True)
|
return await kirimPesan(message, "Can only generate screenshots from video file....", quote=True)
|
||||||
|
|
||||||
# Downloading partial file.
|
# Downloading partial file.
|
||||||
replymsg = await message.reply_text(f"Downloading partial video file....", quote=True)
|
replymsg = await kirimPesan(message, f"Downloading partial video file....", quote=True)
|
||||||
|
|
||||||
if int(size) <= 200000000:
|
if int(size) <= 200000000:
|
||||||
c_time = time.time()
|
c_time = time.time()
|
||||||
await message.download(
|
await replymsg.download(
|
||||||
os.path.join(os.getcwd(), file_name),
|
os.path.join(os.getcwd(), file_name),
|
||||||
progress=progress_for_pyrogram,
|
progress=progress_for_pyrogram,
|
||||||
progress_args=("Trying to download..", replymsg, c_time)
|
progress_args=("Trying to download..", replymsg, c_time)
|
||||||
|
|
@ -224,7 +225,7 @@ async def telegram_screenshot(client, message, frame_count):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
limit = ((25 * size) / 100) / 1000000
|
limit = ((25 * size) / 100) / 1000000
|
||||||
async for chunk in client.stream_media(message, limit=int(limit)):
|
async for chunk in client.stream_media(replymsg, limit=int(limit)):
|
||||||
with open(file_name, "ab") as file:
|
with open(file_name, "ab") as file:
|
||||||
file.write(chunk)
|
file.write(chunk)
|
||||||
|
|
||||||
|
|
@ -250,6 +251,7 @@ async def telegram_screenshot(client, message, frame_count):
|
||||||
|
|
||||||
|
|
||||||
@app.on_message(filters.command("genss2", COMMAND_HANDLER))
|
@app.on_message(filters.command("genss2", COMMAND_HANDLER))
|
||||||
|
@ratelimiter
|
||||||
async def genscreenshotv2(client, message):
|
async def genscreenshotv2(client, message):
|
||||||
replied_message = message.reply_to_message
|
replied_message = message.reply_to_message
|
||||||
if replied_message:
|
if replied_message:
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,9 @@
|
||||||
from importlib.resources import contents
|
|
||||||
import json
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
|
|
||||||
import requests
|
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
|
|
||||||
from misskaty import app
|
from misskaty import app
|
||||||
|
|
@ -28,10 +25,10 @@ async def ddl_mediainfo(_, message, url):
|
||||||
output_ = await runcmd(f'mediainfo "{url}"')
|
output_ = await runcmd(f'mediainfo "{url}"')
|
||||||
out = output_[0] if len(output_) != 0 else None
|
out = output_[0] if len(output_) != 0 else None
|
||||||
content = f"""
|
content = f"""
|
||||||
MissKatyBot MediaInfo
|
<b>MissKatyBot MediaInfo</b>
|
||||||
|
|
||||||
DETAILS
|
<b>DETAILS</b>
|
||||||
{out or 'Not Supported'}
|
<pre>{out or 'Not Supported'}</pre>
|
||||||
"""
|
"""
|
||||||
output = await post_to_telegraph(False, "MissKaty MediaInfo", content)
|
output = await post_to_telegraph(False, "MissKaty MediaInfo", content)
|
||||||
|
|
||||||
|
|
@ -91,12 +88,12 @@ async def telegram_mediainfo(client, message):
|
||||||
out = output_[0] if len(output_) != 0 else None
|
out = output_[0] if len(output_) != 0 else None
|
||||||
file_info = get_file_id(replymsg)
|
file_info = get_file_id(replymsg)
|
||||||
content = f"""
|
content = f"""
|
||||||
MissKatyBot MediaInfo
|
<b>MissKatyBot MediaInfo</b>
|
||||||
JSON
|
<b>JSON</b>
|
||||||
{file_info}.type
|
<pre>{file_info}.type</pre>
|
||||||
|
|
||||||
DETAILS
|
<b>DETAILS</b>
|
||||||
{out or 'Not Supported'}
|
<pre>{out or 'Not Supported'}</pre>
|
||||||
"""
|
"""
|
||||||
output = await post_to_telegraph(False, "MissKaty MediaInfo", content)
|
output = await post_to_telegraph(False, "MissKaty MediaInfo", content)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue