예제 #1
0
async def anime_name(event):
    tracemoe = tracemoepy.tracemoe.TraceMoe()
    file_s = await convert_to_image(event, friday)
    c_time = time.time()
    await event.edit("`Searching For This Anime. Bruh.`")
    try:
        st = tracemoe.search(file_s, encode=True)
    except:
        await event.edit("`SomeThing is Sad, Failed.`")
        return
    video = tracemoe.natural_preview(st)
    with open('[email protected]', 'wb') as f:
        f.write(video)
    # Hmm Stolen From Userge
    # Anime Reverse Search Powered by tracemoepy.
    # TraceMoePy (GitHub: https://github.com/DragSama/tracemoepy)
    # (C) Author: Phyco-Ninja (https://github.com/Phyco-Ninja) (@PhycoNinja13b)
    ws = st['docs'][0]
    caption = (f"**Title**: **{ws['title_english']}**\n"
               f"   🇯🇵 (`{ws['title_romaji']} - {ws['title_native']}`)\n"
               f"\n**Anilist ID:** `{ws['anilist_id']}`"
               f"\n**Similarity**: `{ws['similarity']*100}`"
               f"\n**Episode**: `{ws['episode']}")
    starkfile = '[email protected]'
    warner = await upload_file(
        file_name=f"{st.docs[0].title}.mp4",
        client=borg,
        file=open(starkfile, 'rb'),
        progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
            progress(d, t, event, c_time, "Uploading Your Preview!", starkfile)
        ),
    )
    await event.delete()
    await friday.send_file(event.chat_id, warner, caption=caption)
예제 #2
0
async def fasty(event):
    if event.fwd_from:
        return
    await event.edit("Ah, Shit. Here it Starts.")
    if not event.reply_to_msg_id:
        await event.edit("Reply To Any Video.")
        return
    kk = await event.get_reply_message()
    if not kk.video or kk.video_note:
        await event.edit("`Oho, Reply To Video Only`")
        return
    hmm = await event.client.download_media(kk.media)
    c_time = time.time()
    cmd = f'ffmpeg -i {hmm} -vf  "setpts=4*PTS" [email protected]'
    await runcmd(cmd)
    filem = "[email protected]"
    if not os.path.exists(filem):
        await event.edit("**Process, Failed !**")
        return
    final_file = await uf(
        file_name=filem,
        client=bot,
        file=open(filem, 'rb'),
        progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
            progress(d, t, event, c_time, "Uploading Slow Motion Video..",
                     filem)),
    )
    await borg.send_file(event.chat_id,
                         final_file,
                         caption="**Slow Motion** - Powered By @FridayOT")
    await event.delete()
    for files in (filem, hmm):
        if files and os.path.exists(files):
            os.remove(files)
예제 #3
0
async def glitch(event):
    if event.fwd_from:
        return
    sed = await event.get_reply_message()
    okbruh = await event.edit("`Gli, Glitchiiingggg.....`")
    photolove = await convert_to_image(event, friday)
    pathsn = f"./starkgangz/@fridayot.gif"
    glitch_imgs = glitcher.glitch_image(photolove, 2, gif=True, color_offset=True)
    glitch_imgs[0].save(
        pathsn,
        format="GIF",
        append_images=glitch_imgs[1:],
        save_all=True,
        duration=DURATION,
        loop=LOOP,
    )
    c_time = time.time()
    optimize(pathsn)
    stark_m = await uf(
        	file_name="*****@*****.**",
            client=borg,
            file=open(pathsn, 'rb'),
            progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
                progress(
                    d, t, event, c_time, "Uploading..", pathsn
                )
            ),
        )
    await borg.send_file(event.chat_id,
                         stark_m,
                         caption="Powered By @FridayOT")
    await okbruh.delete()
    for starky in (pathsn, photolove):
        if starky and os.path.exists(starky):
            os.remove(starky)
예제 #4
0
async def audio_extract(event):
    if event.fwd_from:
        return
    if not event.reply_to_msg_id:
        await event.edit("Reply To Any Video.")
        return
    await event.edit("Ah, Shit. Here it Starts.")
    kk = await event.get_reply_message()
    if not kk.video or kk.video_note:
        await event.edit("`Oho, Reply To Video Only`")
        return
    hmm = await event.client.download_media(kk.media)
    try:
        thumb = await event.client.download_media(kk.media, thumb=-1)
    except:
        thumb = "./resources/IMG_20200929_103719_628.jpg"
    name_out = str(os.path.basename(hmm)).split(".")[0] + str(".mp3")
    c_time = time.time()
    cmd = f"ffmpeg -i {hmm} -map 0:a {name_out}"
    await runcmd(cmd)
    filem = name_out
    if not os.path.exists(filem):
        await event.edit("**Process, Failed !**")
        return
    final_file = await uf(
            file_name=filem,
            client=bot,
            file=open(filem, 'rb'),
            progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
                progress(
                    d, t, event, c_time, "Uploading Audio From The video..", filem
                )
            ),
        )
    await event.delete()
    await borg.send_file(
        event.chat_id,
        final_file,
        thumb=thumb,
        caption="**Audio Extarcted** - Powered By @FridayOT")
    for files in (filem, hmm):
        if files and os.path.exists(files):
            os.remove(files)
예제 #5
0
async def convert_to_note(event):
    if event.fwd_from:
        return
    if not event.reply_to_msg_id:
        await event.edit("Reply To Any Video.")
        return
    await event.edit("Ah, Shit. Here it Starts.")
    kk = await event.get_reply_message()
    if not (kk.video or kk.video_note or kk.gif or kk.video_note):
        await event.edit("`Oho, Reply To Video Only.`")
        return
    hmm = await event.client.download_media(kk.media)
    try:
        thumb = await event.client.download_media(kk.media, thumb=-1)
    except:
        thumb = "./resources/IMG_20200929_103719_628.jpg"
    c_time = time.time()
    filem = "[email protected]"
    await crop_vid(hmm, filem)
    if not os.path.exists(filem):
        await event.edit("**Process, Failed !**")
        return
    final_file = await uf(
            file_name=filem,
            client=bot,
            file=open(filem, 'rb'),
            progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
                progress(
                    d, t, event, c_time, "Uploading Round / Video Note.", filem
                )
            ),
        )
    await event.delete()
    await borg.send_file(
        event.chat_id,
        final_file,
        thumb=thumb, 
        video_note=True)
    for files in (filem, hmm):
        if files and os.path.exists(files):
            os.remove(files)
예제 #6
0
async def ssvideo(framecap):
    if not framecap.reply_to_msg_id:
        return await framecap.edit("`reply to video!`")
    reply_message = await framecap.get_reply_message()
    if not reply_message.media:
        return await framecap.edit("`reply to a video!`")
    try:
        frame = int(framecap.pattern_match.group(1))
        if frame > 10:
            return await framecap.edit("`hey..dont put that much`")
    except BaseException:
        return await framecap.edit("`Please input number of frame!`")
    if (reply_message.photo
            or (DocumentAttributeFilename(file_name="AnimatedSticker.tgs")
                in reply_message.media.document.attributes)
            or (DocumentAttributeFilename(file_name="sticker.webp")
                in reply_message.media.document.attributes)):
        return await framecap.edit("`Unsupported files!`")
    c_time = time.time()
    await framecap.edit("`Downloading media...`")
    ss = await bot.download_media(
        reply_message,
        "anu.mp4",
        progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
            progress(d, t, framecap, c_time, "[DOWNLOAD]")),
    )
    try:
        await framecap.edit("`Proccessing...`")
        command = f"vcsi -g {frame}x{frame} {ss} -o ss.png "
        os.system(command)
        await framecap.client.send_file(
            framecap.chat_id,
            "ss.png",
            reply_to=framecap.reply_to_msg_id,
        )
        await framecap.delete()
    except BaseException as e:
        await framecap.edit(f"{e}")
    os.system("rm -rf *.png *.mp4")
예제 #7
0
async def _(event):
    if event.fwd_from:
        return
    urlissed = event.pattern_match.group(1)
    myself_stark = await edit_or_reply(
        event, f"`Getting {urlissed} From Youtube Servers. Please Wait.`"
    )
    search = SearchVideos(f"{urlissed}", offset=1, mode="dict", max_results=1)
    mi = search.result()
    mio = mi["search_result"]
    mo = mio[0]["link"]
    thum = mio[0]["title"]
    fridayz = mio[0]["id"]
    thums = mio[0]["channel"]
    kekme = f"https://img.youtube.com/vi/{fridayz}/hqdefault.jpg"
    await asyncio.sleep(0.6)
    if not os.path.isdir("./music/"):
        os.makedirs("./music/")
    path = Config.TMP_DOWNLOAD_DIRECTORY
    url = mo
    sedlyf = wget.download(kekme, out=path)
    opts = {
            "format": "bestaudio",
            "addmetadata": True,
            "key": "FFmpegMetadata",
            "writethumbnail": True,
            "prefer_ffmpeg": True,
            "geo_bypass": True,
            "nocheckcertificate": True,
            "postprocessors": [
                {
                    "key": "FFmpegExtractAudio",
                    "preferredcodec": "mp3",
                    "preferredquality": "480",
                }
            ],
            "outtmpl": "%(title)s.mp3",
            "quiet": True,
            "logtostderr": False,
        }
    try:
        with YoutubeDL(opts) as ytdl:
            ytdl_data = ytdl.extract_info(url)
    except Exception as e:
        await event.edit(f"**Failed To Download** \n**Error :** `{str(e)}`")
        return
    await asyncio.sleep(20)
    c_time = time.time()
    file_stark = f"{ytdl_data['title']}.mp3"
    lol_m = await upload_file(
            file_name=file_stark,
            client=borg,
            file=open(file_stark, 'rb'),
            progress_callback=lambda d, t: asyncio.get_event_loop().create_task(
                progress(
                    d, t, event, c_time, "Uploading Your Song!", file_stark
                )
            ),
        )
    capy = f"**Song Name ➠** `{thum}` \n**Requested For ➠** `{urlissed}` \n**Channel ➠** `{thums}` \n**Link ➠** `{mo}`"
    await event.delete()
    await borg.send_file(
        event.chat_id,
        lol_m,
        force_document=False,
        allow_cache=False,
        caption=capy,
        thumb=sedlyf,
        attributes=[
                DocumentAttributeAudio(
                    duration=int(ytdl_data["duration"]),
                    title=str(ytdl_data["title"]),
                    performer=str(ytdl_data["uploader"]),
                )
            ],
        supports_streaming=True,
    )
    for files in (sedlyf, file_stark):
        if files and os.path.exists(files):
            os.remove(files)