def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onDownloadStart: {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     if STOP_DUPLICATE_MIRROR:
         if dl.getListener().isTar == True:
             sname = sname + ".tar"
         if dl.getListener().extract == True:
             smsg = None
         else:
             gdrive = GoogleDriveHelper(None)
             smsg, button = gdrive.drive_list(sname)
         if smsg:
             dl.getListener().onDownloadError(
                 f'๐Ÿ˜’๐Ÿ˜†Tแป‡p ฤ‘รฃ cรณ sแบตn trong drive. Bแบกn nรชn tรฌm kiแบฟm trฦฐแป›c khi tแบฃi bแบฅt kแปณ tแป‡p nร o. Tแบฃi xuแป‘ng nร y ฤ‘รฃ bแป‹ dแปซng.\n\n'
             )
             sendMarkup(" ฤรขy lร  kแบฟt quแบฃ tรฌm kiแบฟm:๐Ÿ‘‡๐Ÿ‘‡",
                        dl.getListener().bot,
                        dl.getListener().update, button)
             aria2.remove([download])
         return
     update_all_messages()
 def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onDownloadStart: {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     if STOP_DUPLICATE_MIRROR:
         if dl.getListener().isTar == True:
             sname = sname + ".tar"
         if dl.getListener().extract == True:
             smsg = None
         else:
             gdrive = GoogleDriveHelper(None)
             smsg, button = gdrive.drive_list(sname)
         if smsg:
             dl.getListener().onDownloadError(
                 f'รฐลธหœยกรฐลธหœยกFile is already available in drive. You should have search before mirror any file. You might get ban if you do this again. This download has been stopped.\n\n'
             )
             sendMarkup(" Here are the search results:รฐลธโ€˜โ€กรฐลธโ€˜โ€ก",
                        dl.getListener().bot,
                        dl.getListener().update, button)
             aria2.remove([download])
         return
     update_all_messages()
Esempio n. 3
0
 def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onDownloadStart: {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     if STOP_DUPLICATE_MIRROR:
         if dl.getListener().isTar == True:
             sname = sname + ".tar"
         if dl.getListener().extract == True:
             smsg = None
         else:
             gdrive = GoogleDriveHelper(None)
             smsg, button = gdrive.drive_list(sname)
         if smsg:
             dl.getListener().onDownloadError(
                 f'โš ๏ธโš ๏ธ This download has been stopped. File is already there. Please Search: https://testing.bunny.workers.dev/0: \n\n'
             )
             sendMarkup(" Here are the search results:๐Ÿ‘‡๐Ÿ‘‡",
                        dl.getListener().bot,
                        dl.getListener().update, button)
             aria2.remove([download])
         return
     update_all_messages()
Esempio n. 4
0
    def __onDownloadStarted(self, api, gid):
        sleep(1)
        LOGGER.info(f"onDownloadStart: {gid}")
        dl = getDownloadByGid(gid)
        download = api.get_download(gid)
        self.name = download.name
        sname = download.name
        if STOP_DUPLICATE_MIRROR:
          if dl.getListener().isTar == True:
            sname = sname + ".tar"
          if dl.getListener().extract == True:
            smsg = None
          else:
            gdrive = GoogleDriveHelper(None)
            smsg, button = gdrive.drive_list(sname)
          if smsg:
              dl.getListener().onDownloadError(f'File is already available in drive Bitch.\nNext time Direct BAN.\n\n')
              sendMarkup("Here are the search results: รฐลธโ€˜โ€ก", dl.getListener().bot, dl.getListener().update, button)
              aria2.remove([download])
              return
 
        size = download.total_length
        if ENABLE_FILESIZE_LIMIT:
          if size / 1024 / 1024 / 1024 > MAX_TORRENT_SIZE:
              LOGGER.info(f"Download size Exceeded: {gid}")
              dl.getListener().onDownloadError(f'File size {get_readable_file_size(size)} larger than Maximum Allowed size {MAX_TORRENT_SIZE}GB')
              aria2.remove([download])
              return
        update_all_messages()
 def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onDownloadStart: {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     if STOP_DUPLICATE_MIRROR:
         if dl.getListener().isTar == True:
             sname = sname + ".tar"
         if dl.getListener().extract == True:
             smsg = None
         else:
             gdrive = GoogleDriveHelper(None)
             smsg, button = gdrive.drive_list(sname)
         if smsg:
             dl.getListener().onDownloadError(
                 f'\n\nโŒ Duplicate Mirror detected!! โŒ\n\nThis download has been stopped. File is already available in drive\n\n'
             )
             sendMarkup("  ๐Ÿ” Here is the search results๐Ÿ‘‡๐Ÿ‘‡",
                        dl.getListener().bot,
                        dl.getListener().update, button)
             aria2.remove([download])
         return
     update_all_messages()
Esempio n. 6
0
 def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onDownloadStart: {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     if STOP_DUPLICATE_MIRROR:
         if dl.getListener().isTar == True:
             sname = sname + ".tar"
         if dl.getListener().extract == True:
             smsg = None
         else:
             gdrive = GoogleDriveHelper(None)
             smsg, button = gdrive.drive_list(sname)
         if smsg:
             dl.getListener().onDownloadError(
                 f'\n\nั‚ะญะœ Duplicate Mirror detected!! ั‚ะญะœ\n\nั€ะถะฃั€ะทะฏั€ะทะ—ั€ะถะ—ั€ะถะฏ ั‚ะฌะ› ั€ะถะพั€ะถโ”ั€ะถโ–‘ั€ะถโ–‘ ั€ะถะฅั€ะถโ–‘ั€ะถโ•›ั€ะถโ–‘ ั€ะถะบั€ะทะ’ั€ะถโ–‘ั€ะทะั€ะถะผั€ะทะ— ั€ะถะ–ั€ะถะบั€ะถะธั€ะถโ•›ั€ะถโ–‘ ั€ะถโ••ั€ะถโ•›ั€ะถโ–‘ั€ะทะั€ะถะช ั€ะถะฅั€ะถโ–‘ั€ะถโ•› ั€ะถะ™ั€ะถะชั€ะถโ”ั€ะถะด ั€ะถะซั€ะถโ”ั€ะถโ–“ ะะฏะจะ  ั€ะถะ–ั€ะถะบั€ะถะธั€ะถโ” ั€ะถะฟั€ะทะ— ั€ะถะปั€ะถโ•›ั€ะถะ—ั€ะถโ–“ ั€ะถะฏั€ะถโ” ั€ะถะพั€ะถโ”ั€ะถโ–‘ั€ะถโ–‘ ั€ะถะฅั€ะถโ–‘ั€ะถะดั€ะทะ— ั€ะถะชั€ะถโ•›ั€ะถะชั€ะทะั€ะถะซั€ะทะ—ั€ะถะธ ั€ะถโ••ั€ะทะ—ั€ะถะ—ั€ะถะฏั€ะถโ•› ั€ะถะฑั€ะทะั€ะถโ–‘ั€ะถโ•›ั€ะถะ—ั€ะถะฝั€ะทะ— ั€ะถะ•ั€ะถโ–“ั€ะถโ–‘ั€ะทะ—ั€ะถะฑั€ะถโ” ั€ะถะ–ั€ะถะซั€ะทะ—ั€ะถะ— ะะฏะฉะ’\n\n'
             )
             sendMarkup(
                 "  ะะฏะคะ ั€ะถะŸั€ะถะ—ั€ะถะฟั€ะทะ— ั€ะถะถั€ะทะ—ั€ะถะฆั€ะทะ‘ั€ะถะธ ั€ะถโ••ั€ะถโ•›ั€ะถโ–‘ั€ะทะั€ะถะช ั€ะถโ–‘ั€ะทะ—ั€ะถะฌั€ะถโ•›ั€ะถโ–“ั€ะทะั€ะถะฏ ะะฏะกะ—ะะฏะกะ—",
                 dl.getListener().bot,
                 dl.getListener().update, button)
             aria2.remove([download])
         return
     update_all_messages()
Esempio n. 7
0
 def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onDownloadStart: {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     gdrive = GoogleDriveHelper(None)
     smsg, button = gdrive.drive_list(sname)
     if STOP_DUPLICATE_MIRROR:
         if smsg:
             dl.getListener().onDownloadError(
                 f'File is already available in drive.\n\n')
             print(dl.getListener())
             if button:
                 sendMarkup("Here are the search results:รฐลธโ€˜โ€ก\n",
                            dl.getListener().bot,
                            dl.getListener().update, button)
             else:
                 sendMessage("Here are the search results:รฐลธโ€˜โ€ก\n" + smsg,
                             dl.getListener().bot,
                             dl.getListener().update)
             aria2.remove([download])
         return
     update_all_messages()
Esempio n. 8
0
 def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onMulai download : {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     if STOP_DUPLICATE_MIRROR:
         if dl.getListener().isTar == True:
             sname = sname + ".tar"
         if dl.getListener().extract == True:
             smsg = None
         else:
             gdrive = GoogleDriveHelper(None)
             smsg, button = gdrive.drive_list(sname)
         if smsg:
             dl.getListener().onDownloadError(
                 f'รฐลธหœยกรฐลธหœยกFile nya udh ada di google drive ya, kamu bisa cari dengan mengetik /daftar (yg pengen kamu cari), kamu soam = ban\n\n'
             )
             sendMarkup(" Nih yang kamu cari:รฐลธโ€˜โ€กรฐลธโ€˜โ€ก",
                        dl.getListener().bot,
                        dl.getListener().update, button)
             aria2.remove([download])
         return
     update_all_messages()
Esempio n. 9
0
 def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onDownloadStart: {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     size = download.total_length
     if ENABLE_FILESIZE_LIMIT:
       if size / 1024 / 1024 / 1024 > MAX_TORRENT_SIZE:
           LOGGER.info(f" Download size Exceeded: {gid}")
           dl.getListener().onDownloadError(f'๐Ÿ’พ File size {get_readable_file_size(size)} \nโŒ larger than Maximum Allowed size {MAX_TORRENT_SIZE}GB')
           aria2.remove([download])
       return
     update_all_messages()
     if STOP_DUPLICATE_MIRROR:
       if dl.getListener().isTar == True:
         sname = sname + ".tar"
       if dl.getListener().extract == True:
         smsg = None
       else:
         gdrive = GoogleDriveHelper(None)
         smsg, button = gdrive.drive_list(sname)
       if smsg:
           dl.getListener().onDownloadError(f'๐Ÿ˜ก File is already available in drive. You should have search before mirror any file. You might get ban if you do this again. This download has been stopped.\n\n')
           sendMarkup(" Here are the search results:๐Ÿ‘‡", dl.getListener().bot, dl.getListener().update, button)
           aria2.remove([download])
       return
     update_all_messages()
Esempio n. 10
0
 def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onDownloadStart: {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     if STOP_DUPLICATE_MIRROR:
         if dl.getListener().isTar == True:
             sname = sname + ".tar"
         if dl.getListener().extract == True:
             smsg = None
         else:
             gdrive = GoogleDriveHelper(None)
             smsg, button = gdrive.drive_list(sname)
         if smsg:
             dl.getListener().onDownloadError(
                 f'โš ๏ธโš ๏ธ File sudah ada di database, harap /list dahulu sebelum menggunakan /mirror. This download has been stopped.\n\n'
             )
             sendMarkup(" Here are the search results:๐Ÿ‘‡๐Ÿ‘‡",
                        dl.getListener().bot,
                        dl.getListener().update, button)
             aria2.remove([download])
         return
     update_all_messages()
Esempio n. 11
0
 def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onDownloadStart: {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     if STOP_DUPLICATE_MIRROR:
         if dl.getListener().isTar == True:
             sname = sname + ".tar"
         if dl.getListener().extract == True:
             smsg = None
         else:
             gdrive = GoogleDriveHelper(None)
             smsg, button = gdrive.drive_list(sname)
         if smsg:
             dl.getListener().onDownloadError(
                 f'๐Ÿ˜ก ๐‘ญ๐’Š๐’๐’† ๐’Š๐’” ๐’‚๐’๐’“๐’†๐’‚๐’…๐’š ๐’‚๐’—๐’‚๐’Š๐’๐’‚๐’ƒ๐’๐’† ๐’Š๐’ ๐‘ซ๐’“๐’Š๐’—๐’†\n๐‘ญ๐’Š๐’”๐’“๐’• ๐’”๐’†๐’‚๐’“๐’„๐’‰ ๐‘ฉ๐’†๐’‡๐’๐’“๐’† ๐‘ด๐’Š๐’“๐’“๐’๐’“๐’Š๐’๐’ˆ ๐’‚๐’๐’š๐’•๐’‰๐’Š๐’๐’ˆ ๐Ÿ˜ก\n๐‘ฐ๐’‡ ๐’š๐’๐’– ๐’…๐’ ๐’•๐’‰๐’Š๐’” ๐’‚๐’ˆ๐’‚๐’Š๐’โ— ๐’€๐’๐’– ๐’˜๐’Š๐’๐’ ๐’ƒ๐’† ๐‘ฉ๐’‚๐’ ๐Ÿ˜.\n\n'
             )
             sendMarkup(" <b>Here are the search results:</b> ๐Ÿ‘‡๐Ÿ‘‡",
                        dl.getListener().bot,
                        dl.getListener().update, button)
             aria2.remove([download])
         return
     update_all_messages()
Esempio n. 12
0
 def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onDownloadStart: {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     if ENABLE_FILESIZE_LIMIT:
       if download.total_length / 1024 / 1024 / 1024 > MAX_TORRENT_SIZE:
           LOGGER.info(f" Download size Exceeded: {gid}")
           dl.getListener().onDownloadError(f'File size larger than Maximum Allowed size {MAX_TORRENT_SIZE}GB')
           aria2.remove([download])
       return
     update_all_messages()
     gdrive = GoogleDriveHelper(None)
     smsg, button = gdrive.drive_list(sname)
     if STOP_DUPLICATE_MIRROR:
         if smsg:
             dl.getListener().onDownloadError(f'รฐลธหœยก File is already available in drive. You should have search before mirror any file. You might get ban if you do this again. This download has been stopped.\n\n')
             print(dl.getListener())
             if button:
                 sendMarkup("Here are the search results:รฐลธโ€˜โ€ก\n", dl.getListener().bot, dl.getListener().update, button)
             else:
                 sendMessage("Here are the search results:รฐลธโ€˜โ€ก\n" + smsg, dl.getListener().bot, dl.getListener().update)
             aria2.remove([download])
         return
     update_all_messages()
Esempio n. 13
0
 def __onDownloadStarted(self, api, gid):
     if STOP_DUPLICATE or TORRENT_DIRECT_LIMIT is not None or TAR_UNZIP_LIMIT is not None:
         sleep(1)
         dl = getDownloadByGid(gid)
         download = aria2.get_download(gid)
     if STOP_DUPLICATE and dl is not None and not dl.getListener().isLeech:
         LOGGER.info('Checking File/Folder if already in Drive...')
         sname = aria2.get_download(gid).name
         if dl.getListener().isTar:
             sname = sname + ".zip" if dl.getListener().isZip else sname + ".tar"
         if dl.getListener().extract:
             smsg = None
         else:
             gdrive = GoogleDriveHelper()
             smsg, button = gdrive.drive_list(sname, True)
         if smsg:
             dl.getListener().onDownloadError('File/Folder already available in Drive.\n\n')
             aria2.remove([download], force=True)
             sendMarkup("Here are the search results:", dl.getListener().bot, dl.getListener().update, button)
             return
     if (TORRENT_DIRECT_LIMIT is not None or TAR_UNZIP_LIMIT is not None) and dl is not None:
         sleep(1)
         size = aria2.get_download(gid).total_length
         if dl.getListener().isTar or dl.getListener().extract:
             is_tar_ext = True
             mssg = f'Tar/Unzip limit is {TAR_UNZIP_LIMIT}'
         else:
             is_tar_ext = False
             mssg = f'Torrent/Direct limit is {TORRENT_DIRECT_LIMIT}'
         result = check_limit(size, TORRENT_DIRECT_LIMIT, TAR_UNZIP_LIMIT, is_tar_ext)
         if result:
             dl.getListener().onDownloadError(f'{mssg}.\nYour File/Folder size is {get_readable_file_size(size)}')
             aria2.remove([download], force=True)
             return
     update_all_messages()
Esempio n. 14
0
    def __onDownloadStarted(self, api, gid):
        sleep(1)
        LOGGER.info(f"onDownloadStart: {gid}")
        dl = getDownloadByGid(gid)
        download = api.get_download(gid)
        self.name = download.name
        sname = download.name
        if STOP_DUPLICATE_MIRROR:
            if dl.getListener().isTar == True:
                sname = sname + ".tar"
            if dl.getListener().extract == True:
                smsg = None
            else:
                gdrive = GoogleDriveHelper(None)
                smsg, button = gdrive.drive_list(sname)
            if smsg:
                dl.getListener().onDownloadError(
                    f'๐Ÿคฌ๐™ต๐š’๐š•๐šŽ ๐š’๐šœ ๐šŠ๐š•๐š›๐šŽ๐šŠ๐š๐šข ๐šŠ๐šŸ๐šŠ๐š’๐š•๐šŠ๐š‹๐š•๐šŽ ๐š’๐š— T๐šŽ๐šŠ๐š–๐™ณ๐š›๐š’๐šŸ๐šŽ๐Ÿคฌ.\n\n')
                sendMarkup("๐Ÿฅถ๐™ท๐šŽ๐š›๐šŽ ๐šŠ๐š›๐šŽ ๐š๐š‘๐šŽ ๐šœ๐šŽ๐šŠ๐š›๐šŒ๐š‘ ๐š›๐šŽ๐šœ๐šž๐š•๐š๐šœ:๐Ÿ‘‡",
                           dl.getListener().bot,
                           dl.getListener().update, button)
                aria2.remove([download])
                return

        size = download.total_length
        if ENABLE_FILESIZE_LIMIT:
            if size / 1024 / 1024 / 1024 > MAX_TORRENT_SIZE:
                LOGGER.info(f"Download size Exceeded: {gid}")
                dl.getListener().onDownloadError(
                    f'File size {get_readable_file_size(size)} larger than Maximum Allowed size {MAX_TORRENT_SIZE}GB'
                )
                aria2.remove([download])
                return
        update_all_messages()
Esempio n. 15
0
 def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onDownloadStart: {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     if STOP_DUPLICATE_MIRROR:
         if dl.getListener().isTar == True:
             sname = sname + ".tar"
         if dl.getListener().extract == True:
             smsg = None
         else:
             gdrive = GoogleDriveHelper(None)
             smsg, button = gdrive.drive_list(sname)
         if smsg:
             dl.getListener().onDownloadError(
                 f'รฐลธหœยกรฐลธหœยก File is Already Available in GDrive. This Download has been Stopped.\n\n'
             )
             sendMarkup(" Here is the File รฐลธโ€˜โ€กรฐลธโ€˜โ€ก",
                        dl.getListener().bot,
                        dl.getListener().update, button)
             aria2.remove([download])
         return
     update_all_messages()
 def __onDownloadStarted(self, api, gid):
     sleep(1)
     LOGGER.info(f"onDownloadStart: {gid}")
     dl = getDownloadByGid(gid)
     download = api.get_download(gid)
     self.name = download.name
     sname = download.name
     if STOP_DUPLICATE_MIRROR:
         if dl.getListener().isTar == True:
             sname = sname + ".tar"
         if dl.getListener().extract == True:
             smsg = None
         else:
             gdrive = GoogleDriveHelper(None)
             smsg, button = gdrive.drive_list(sname)
         if smsg:
             dl.getListener().onDownloadError(
                 f'<code>โžผ๐“๐ก๐ข๐ฌ ๐…๐ข๐ฅ๐ž ๐ˆ๐ฌ ๐€๐ฅ๐ซ๐ž๐š๐๐ฒ ๐€๐ฏ๐š๐ข๐ฅ๐š๐›๐ฅ๐ž ๐ˆ๐ง ๐†๐ซ๐จ๐ฎ๐ฉ ๐ƒ๐ซ๐ข๐ฏ๐ž. ๐˜๐จ๐ฎ ๐’๐ก๐จ๐ฎ๐ฅ๐ ๐‡๐š๐ฏ๐ž ๐Ÿ” ๐’๐ž๐š๐ซ๐œ๐ก ๐๐ฒ /list ๐‚๐จ๐ฆ๐ฆ๐š๐ง๐ ๐๐ž๐Ÿ๐จ๐ซ๐ž ๐Œ๐ข๐ซ๐ซ๐จ๐ซ๐ŸŒป ๐€๐ง๐ฒ ๐…๐ข๐ฅ๐ž. ๐๐ซ๐จ๐œ๐ž๐ฌ๐ฌ ๐‡๐š๐ฌ ๐๐ž๐ž๐ง ๐’๐ญ๐จ๐ฉ๐ฉ๐ž๐\n\n Hแด‡ส€แด‡ Aส€แด‡ Tสœแด‡ Rแด‡sแดœสŸแด›s Fแดส€ Yแดแดœส€ FษชสŸแด‡:๐Ÿ‘‡๐Ÿ‘‡. \n\n{smsg}'
             )
             sendMarkup(" Here are the search results:๐Ÿ‘‡๐Ÿ‘‡",
                        dl.getListener().bot,
                        dl.getListener().update, button)
             aria2.remove([download])
         return
     update_all_messages()
Esempio n. 17
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        gd = GoogleDriveHelper()
        if CLONE_LIMIT is not None or STOP_DUPLICATE_CLONE:
            msg1 = sendMessage(f"Checking Your Link...", context.bot, update)
            res, clonesize, name = gd.clonehelper(link)
            if res != "":
                deleteMessage(context.bot, msg1)
                sendMessage(res, context.bot, update)
                return
            if STOP_DUPLICATE_CLONE:
                LOGGER.info(f"Checking File/Folder if already in Drive...")
                smsg, button = gd.drive_list(name)
                if smsg:
                    deleteMessage(context.bot, msg1)
                    msg3 = "File/Folder is already available in Drive.\nHere are the search results:"
                    sendMarkup(msg3, context.bot, update, button)
                    return
                else:
                    if CLONE_LIMIT is None:
                        deleteMessage(context.bot, msg1)
            if CLONE_LIMIT is not None:
                LOGGER.info(f"Checking File/Folder Size...")
                limit = CLONE_LIMIT
                limit = limit.split(' ', maxsplit=1)
                limitint = int(limit[0])
                msg2 = f'Failed, Clone limit is {CLONE_LIMIT}.\nYour File/Folder size is {get_readable_file_size(clonesize)}.'
                if 'GB' in limit or 'gb' in limit:
                    if clonesize > limitint * 1024**3:
                        deleteMessage(context.bot, msg1)
                        sendMessage(msg2, context.bot, update)
                        return
                    else:
                        deleteMessage(context.bot, msg1)
                elif 'TB' in limit or 'tb' in limit:
                    if clonesize > limitint * 1024**4:
                        deleteMessage(context.bot, msg1)
                        sendMessage(msg2, context.bot, update)
                        return
                    else:
                        deleteMessage(context.bot, msg1)
        msg = sendMessage(f"Cloning: <code>{link}</code>", context.bot, update)
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            if update.message.from_user.username:
                uname = f'@{update.message.from_user.username}'
            else:
                uname = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}</a>'
            if uname is not None:
                cc = f'\n\ncc: {uname}'
            sendMarkup(result + cc, context.bot, update, button)
    else:
        sendMessage('Provide G-Drive Shareable Link to Clone.', context.bot,
                    update)
Esempio n. 18
0
 def add_download(mega_link: str, path: str, listener):
     if MEGA_API_KEY is None:
         raise MegaDownloaderException('Mega API KEY not provided! Cannot mirror Mega links')
     executor = AsyncExecutor()
     api = MegaApi(MEGA_API_KEY, None, None, 'telegram-mirror-bot')
     global listeners
     mega_listener = MegaAppListener(executor.continue_event, listener)
     listeners.append(mega_listener)
     api.addListener(mega_listener)
     if MEGA_EMAIL_ID is not None and MEGA_PASSWORD is not None:
         executor.do(api.login, (MEGA_EMAIL_ID, MEGA_PASSWORD))
     link_type = get_mega_link_type(mega_link)
     if link_type == "file":
         LOGGER.info("File. If your download didn't start, then check your link if it's available to download")
         executor.do(api.getPublicNode, (mega_link,))
         node = mega_listener.public_node
     else:
         LOGGER.info("Folder. If your download didn't start, then check your link if it's available to download")
         folder_api = MegaApi(MEGA_API_KEY,None,None,'TgBot')
         folder_api.addListener(mega_listener)
         executor.do(folder_api.loginToFolder, (mega_link,))
         node = folder_api.authorizeNode(mega_listener.node)
     if mega_listener.error is not None:
         return sendMessage(str(mega_listener.error), listener.bot, listener.update)
     if STOP_DUPLICATE:
         LOGGER.info('Checking File/Folder if already in Drive')
         mname = node.getName()
         if listener.isTar:
             mname = mname + ".tar"
         if listener.extract:
             smsg = None
         else:
             gd = GoogleDriveHelper()
             smsg, button = gd.drive_list(mname)
         if smsg:
             msg1 = "File/Folder is already available in Drive.\nHere are the search results:"
             sendMarkup(msg1, listener.bot, listener.update, button)
             executor.continue_event.set()
             return
     if MEGA_LIMIT is not None or TAR_UNZIP_LIMIT is not None:
         size = api.getSize(node)
         if listener.isTar or listener.extract:
             is_tar_ext = True
             msg3 = f'Failed, Tar/Unzip limit is {TAR_UNZIP_LIMIT}.\nYour File/Folder size is {get_readable_file_size(api.getSize(node))}.'
         else:
             is_tar_ext = False
             msg3 = f'Failed, Mega limit is {MEGA_LIMIT}.\nYour File/Folder size is {get_readable_file_size(api.getSize(node))}.'
         result = check_limit(size, MEGA_LIMIT, TAR_UNZIP_LIMIT, is_tar_ext)
         if result:
             sendMessage(msg3, listener.bot, listener.update)
             executor.continue_event.set()
             return
     with download_dict_lock:
         download_dict[listener.uid] = MegaDownloadStatus(mega_listener, listener)
     os.makedirs(path)
     gid = ''.join(random.SystemRandom().choices(string.ascii_letters + string.digits, k=8))
     mega_listener.setValues(node.getName(), api.getSize(node), gid)
     sendStatusMessage(listener.update, listener.bot)
     executor.do(api.startDownload,(node,path))
Esempio n. 19
0
    def __onDownloadStarted(self, api, gid):
        if STOP_DUPLICATE_MIRROR or TORRENT_DIRECT_LIMIT is not None or TAR_UNZIP_LIMIT is not None:
            sleep(0.5)
            dl = getDownloadByGid(gid)
            download = api.get_download(gid)

            if STOP_DUPLICATE_MIRROR:
                LOGGER.info(f"Checking File/Folder if already in Drive...")
                self.name = download.name
                sname = download.name
                if self.listener.isTar:
                    sname = sname + ".tar"
                if self.listener.extract:
                    smsg = None
                else:
                    gdrive = GoogleDriveHelper(None)
                    smsg, button = gdrive.drive_list(sname)
                if smsg:
                    aria2.remove([download])
                    dl.getListener().onDownloadError(
                        f'File/Folder is already available in Drive.\n\n')
                    sendMarkup("Here are the search results:",
                               dl.getListener().bot,
                               dl.getListener().update, button)
                    return

            if TORRENT_DIRECT_LIMIT is not None or TAR_UNZIP_LIMIT is not None:
                limit = None
                if TAR_UNZIP_LIMIT is not None and (self.listener.isTar
                                                    or self.listener.extract):
                    LOGGER.info(f"Checking File/Folder Size...")
                    limit = TAR_UNZIP_LIMIT
                    mssg = f'Tar/Unzip limit is {TAR_UNZIP_LIMIT}'
                elif TORRENT_DIRECT_LIMIT is not None and limit is None:
                    LOGGER.info(f"Checking File/Folder Size...")
                    limit = TORRENT_DIRECT_LIMIT
                    mssg = f'Torrent/Direct limit is {TORRENT_DIRECT_LIMIT}'
                if limit is not None:
                    sleep(1.5)
                    size = aria2.get_download(gid).total_length
                    limit = limit.split(' ', maxsplit=1)
                    limitint = int(limit[0])
                    if 'G' in limit[1] or 'g' in limit[1]:
                        if size > limitint * 1024**3:
                            aria2.remove([download])
                            dl.getListener().onDownloadError(
                                f'{mssg}.\nYour File/Folder size is {get_readable_file_size(size)}'
                            )
                            return
                    elif 'T' in limit[1] or 't' in limit[1]:
                        if size > limitint * 1024**4:
                            aria2.remove([download])
                            dl.getListener().onDownloadError(
                                f'{mssg}.\nYour File/Folder size is {get_readable_file_size(size)}'
                            )
                            return
        update_all_messages()
Esempio n. 20
0
def _list_drive(key, bmsg, list_method, item_type):
    LOGGER.info(f"listing: {key}")
    list_method = list_method == "recu"
    gdrive = GoogleDriveHelper()
    msg, button = gdrive.drive_list(key, isRecursive=list_method, itemType=item_type)
    if button:
        editMessage(msg, bmsg, button)
    else:
        editMessage(f'No result found for <i>{key}</i>', bmsg)
Esempio n. 21
0
def list_drive(bot,update):
    message = update.message.text
    search = message.split(' ',maxsplit=1)[1]
    LOGGER.info(f"Searching: {search}")
    gdrive = GoogleDriveHelper(None)
    msg = gdrive.drive_list(search)
    if msg:
        reply_message = sendMessage(msg, bot, update)
    else:
        reply_message = sendMessage('No result found', bot, update)

    threading.Thread(target=auto_delete_message, args=(bot, update.message, reply_message)).start()
Esempio n. 22
0
def list_drive(update,context):
    try:
        search = update.message.text.split(' ',maxsplit=1)[1]
        LOGGER.info(f"๐—ฆ๐—ฒ๐—ฎ๐—ฟ๐—ฐ๐—ต๐—ถ๐—ป๐—ด: {search}")
        reply = sendMessage('๐—ฆ๐—ฒ๐—ฎ๐—ฟ๐—ฐ๐—ต๐—ถ๐—ป๐—ด....๐—›๐—ผ๐—น๐—ฑ ๐—ข๐—ป!', context.bot, update)
        gdrive = GoogleDriveHelper(None)
        msg, button = gdrive.drive_list(search)
 
        if button:
            editMessage(msg, reply, button)
        else:
            editMessage('๐—ก๐—ผ ๐—ฟ๐—ฒ๐˜€๐˜‚๐—น๐˜ ๐—ณ๐—ผ๐˜‚๐—ป๐—ฑ', reply, button)
 
    except IndexError:
        sendMessage('๐˜€๐—ฒ๐—ป๐—ฑ ๐—ฎ ๐˜€๐—ฒ๐—ฎ๐—ฟ๐—ฐ๐—ต ๐—ธ๐—ฒ๐˜† ๐—ฎ๐—น๐—ผ๐—ป๐—ด ๐˜„๐—ถ๐˜๐—ต ๐—ฐ๐—ผ๐—บ๐—บ๐—ฎ๐—ป๐—ฑ', context.bot, update)
Esempio n. 23
0
def list_drive(update,context):
    try:
        search = update.message.text.split(' ',maxsplit=1)[1]
        LOGGER.info(f"Searching: {search}")
        reply = sendMessage('Searching..... Please wait!', context.bot, update)
        gdrive = GoogleDriveHelper(None)
        msg, button = gdrive.drive_list(search)
 
        if button:
            editMessage(msg, reply, button)
        else:
            editMessage('No result found', reply, button)
 
    except IndexError:
        sendMessage('send a search key along with command', context.bot, update)
Esempio n. 24
0
def list_drive(update, context):
    message = update.message.text
    search = message.split(' ', maxsplit=1)[1]
    LOGGER.info(f"Searching: {search}")
    gdrive = GoogleDriveHelper(None)
    msg = gdrive.drive_list(search)
    if msg:
        reply_message = sendMessage(msg, context.bot, update)
    else:
        reply_message = sendMessage('Khรดng cรณ kแบฟt quแบฃ nร o', context.bot,
                                    update)

    threading.Thread(target=auto_delete_message,
                     args=(context.bot, update.message,
                           reply_message)).start()
Esempio n. 25
0
def list_drive(update,context):
    try:
        search = update.message.text.split(' ',maxsplit=1)[1]
        LOGGER.info(f"Searching: {search}")
        reply = sendMessage('Searching..... Please wait!', context.bot, update)
        gdrive = GoogleDriveHelper(None)
        msg, button = gdrive.drive_list(search)
 
        if button:
            editMessage(msg, reply, button)
        else:
            editMessage('tidak ditemukan. contoh mencari Avengers Infinity War cukup tulis /list avengers saja', reply, button)
 
    except IndexError:
        sendMessage('ketik /list lalu nama film, contoh mencari Avengers Infinity War cukup tulis /list avengers', context.bot, update)
Esempio n. 26
0
def cloneNode(update, context):
    args = update.message.text.split(" ", maxsplit=1)
    if len(args) > 1:
        link = args[1]
        gd = GoogleDriveHelper()
        if CLONE_LIMIT is not None or STOP_DUPLICATE_CLONE:
            res, clonesize, name = gd.clonehelper(link)
            if res != "":
                sendMessage(res, context.bot, update)
                return
            if STOP_DUPLICATE_CLONE:
                LOGGER.info(f"๐Ÿ”Ž Checking File/Folder if already in Drive...")
                smsg, button = gd.drive_list(name)
                if smsg:
                    msg3 = "File/Folder is already available in Drive.\nHere are the search results:"
                    sendMarkup(msg3, context.bot, update, button)
                    return
            if CLONE_LIMIT is not None:
                LOGGER.info(f"Checking File/Folder Size...")
                limit = CLONE_LIMIT
                limit = limit.split(' ', maxsplit=1)
                limitint = int(limit[0])
                msg2 = f'Failed, Clone limit is {CLONE_LIMIT}.\nYour File/Folder size is {get_readable_file_size(clonesize)}.'
                if 'G' in limit[1] or 'g' in limit[1]:
                    if clonesize > limitint * 1024**3:
                        sendMessage(msg2, context.bot, update)
                        return
                elif 'T' in limit[1] or 't' in limit[1]:
                    if clonesize > limitint * 1024**4:
                        sendMessage(msg2, context.bot, update)
                        return
        msg = sendMessage(f"๐Ÿ“š Cloning : <code>{link}</code>", context.bot,
                          update)
        result, button = gd.clone(link)
        deleteMessage(context.bot, msg)
        if button == "":
            sendMessage(result, context.bot, update)
        else:
            if update.message.from_user.username:
                uname = f'@{update.message.from_user.username}'
            else:
                uname = f'<a href="tg://user?id={update.message.from_user.id}">{update.message.from_user.first_name}</a>'
            if uname is not None:
                cc = f'\n\n๐Ÿ‘ค ๐—–๐—น๐—ผ๐—ป๐—ฒ๐—ฟ : {uname}\n\n๐Ÿ”ฅ ๐—ฃ๐—ฟ๐—ถ๐—ถ๐—ถ๐—ถ๐˜†๐—ผ ๐— ๐—ถ๐—ฟ๐—ฟ๐—ผ๐—ฟ ๐—ญ๐—ผ๐—ป๐—˜\n\n๐Ÿ”ฅ ๐—š๐—ฟ๐—ผ๐˜‚๐—ฝ : @PriiiiyoMirror\n\nโ–ซ๏ธ#Uploaded To Team Drive โœ“ \n\n๐Ÿšซ ๐——๐—ผ ๐—ก๐—ผ๐˜ ๐—ฆ๐—ต๐—ฎ๐—ฟ๐—ฒ ๐—œ๐—ป๐—ฑ๐—ฒ๐˜… ๐—Ÿ๐—ถ๐—ป๐—ธ \n\nโœ… ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ๐—ฒ๐—ฑ ๐—•๐˜† : @PriiiiyoBOTs'
            sendMarkup(result + cc, context.bot, update, button)
    else:
        sendMessage('Provide G-Drive Shareable Link to Clone.', context.bot,
                    update)
Esempio n. 27
0
def list_drive(update, context):
    try:
        search = update.message.text.split(' ', maxsplit=1)[1]
        LOGGER.info(f"Searching: {search}")
        reply = sendMessage('Mencari..... Mohon tunggu sambil minum kopi!',
                            context.bot, update)
        gdrive = GoogleDriveHelper(None)
        msg, button = gdrive.drive_list(search)

        if button:
            editMessage(msg, reply, button)
        else:
            editMessage('Hasil tidak ditemukan', reply, button)

    except IndexError:
        sendMessage('Berikan kata kunci setelah command', context.bot, update)
Esempio n. 28
0
File: list.py Progetto: Rizky61/mgtg
def list_drive(update, context):
    try:
        search = update.message.text.split(' ', maxsplit=1)[1]
    except IndexError:
        sendMessage('send a search key along with command', context.bot,
                    update)
        return

    reply = sendMessage('Searching...', context.bot, update)

    LOGGER.info(f"Searching: {search}")

    gdrive = GoogleDriveHelper(None)
    msg, button = gdrive.drive_list(search)

    editMessage(msg, reply, button)
Esempio n. 29
0
def list_drive(update, context):
    if update.message.text == f'/{BotCommands.ListCommand}':
        sendMessage(f'Send a search key along with {BotCommands.ListCommand} command', context.bot, update)
    else:
        search = update.message.text.split(' ', maxsplit=1)[1]
        LOGGER.info(f"Searching: '{search}'...")
        reply = sendMessage('Searching..... Please Wait!', context.bot, update)
        gdrive = GoogleDriveHelper(None)
        msg, button = gdrive.drive_list(search)
        if msg:
            if button:
                editMessage(msg, reply, button)
            else:
                editMessage(msg, reply)
        else:
            editMessage('No results found', reply)
Esempio n. 30
0
def list_drive(update, context):
    try:
        search = update.message.text.split(' ', maxsplit=1)[1]
        LOGGER.info(f"๐’๐ž๐š๐ซ๐œ๐ก๐ข๐ง๐ : {search}")
        reply = sendMessage('๐Ÿ”๐’๐ž๐š๐ซ๐œ๐ก๐ข๐ง๐ ... ๐๐ฅ๐ž๐š๐ฌ๐ž ๐–๐š๐ข๐ญ!', context.bot, update)
        gdrive = GoogleDriveHelper(None)
        msg, button = gdrive.drive_list(search)

        if button:
            editMessage(msg, reply, button)
        else:
            editMessage('๐Ÿ”๐๐จ ๐‘๐ž๐ฌ๐ฎ๐ฅ๐ญ๐ฌ ๐…๐จ๐ฎ๐ง๐โŒ', reply, button)

    except IndexError:
        sendMessage('๐’๐ž๐ง๐ ๐š ๐’๐ž๐š๐ซ๐œ๐ก๐Ÿ” ๐Š๐ž๐ฒ๐ฐ๐จ๐ซ๐ ๐€๐ฅ๐จ๐ง๐  ๐ฐ๐ข๐ญ๐ก ๐๐จ๐ญ ๐‚๐จ๐ฆ๐ฆ๐š๐ง๐',
                    context.bot, update)