{murl}")
extra = f"**[{xx}]({url})**\n\n"
e = await e.eor(f"{extra}`Loading More...`", link_preview=False)
if hasattr(r.media, "document"):
file = r.media.document
mime_type = file.mime_type
filename = r.file.name
if not filename:
if "audio" in mime_type:
filename = "audio_" + dt.now().isoformat("_", "seconds") + ".ogg"
elif "video" in mime_type:
filename = "video_" + dt.now().isoformat("_", "seconds") + ".mp4"
dl = await downloader(
f"resources/downloads/{filename}",
file,
e,
taime,
f"{extra}`Loading More...`",
)
naam = dl.name
else:
naam = await r.download_media()
elif match and (
os.path.isfile(match)
or (match.startswith("https://") and (await is_url_ok(match)))
):
naam, xx = match, "file"
else:
return await e.eor(get_string("cvt_3"), time=5)
out, er = await bash(f"mediainfo '{naam}'")
if er:
LOGS.info(er)
out = extra or str(er)
return await e.edit(out, link_preview=False)
makehtml = ""
if naam.endswith((".jpg", ".png")):
if os.path.exists(naam):
med = upload_file(naam)
else:
med = match
makehtml += f"{line}
" try: urll = await make_html_telegraph("Mediainfo", makehtml) except Exception as er: LOGS.exception(er) return await e.eor(f"{extra}[{get_string('mdi_1')}]({urll})", link_preview=False) if not match: os.remove(naam) @ultroid_cmd(pattern="rotate( (.*)|$)") async def rotate_(ult): match = ult.pattern_match.group(1).strip() if not ult.is_reply: return await ult.eor("`Reply to a media...`") if match: try: match = int(match) except ValueError: match = None if not match: return await ult.eor("`Please provide a valid angle to rotate media..`") reply = await ult.get_reply_message() msg = await ult.eor(get_string("com_1")) photo = reply.game.photo if reply.game else None if reply.video: media = await reply.download_media() file = f"{media}.mp4" await bash( f'ffmpeg -i "{media}" -c copy -metadata:s:v:0 rotate={match} "{file}" -y' ) elif photo or reply.photo or reply.sticker: media = await ult.client.download_media(photo or reply) img = cv2.imread(media) new_ = rotate_image(img, match) file = "ult.png" cv2.imwrite(file, new_) else: return await msg.edit("`Unsupported Media..\nReply to Photo/Video`") if os.path.exists(file): await ult.client.send_file( ult.chat_id, file=file, video_note=bool(reply.video_note), reply_to=reply.id ) os.remove(media) await msg.try_delete()