Tidying up

This commit is contained in:
Hafitz Setya 2021-08-01 06:45:09 +07:00 committed by GitHub
parent ec604b0cb3
commit d27e4ba062
Signed by untrusted user: GitHub
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 21 deletions

4
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "vendor/cmrudl.py"]
path = vendor/cmrudl.py
[submodule "vendor/cmrudl"]
path = vendor/cmrudl
url = https://github.com/JrMasterModelBuilder/cmrudl.py.git

View File

@ -293,7 +293,7 @@ python3 gen_sa_accounts.py --download-keys project_id
python3 add_to_team_drive.py -d SharedTeamDriveSrcID
```
# Youtube-dl authentication using .netrc file
# Youtube-dl authentication using [.netrc](https://github.com/breakdowns/slam-aria-mirror-bot/blob/master/.netrc) file
For using your premium accounts in Youtube-dl or for protected Index Links, edit the netrc file according to following format:
```
machine host login username password my_youtube_password
@ -314,5 +314,6 @@ Thanks to:
- [SVR666](https://github.com/SVR666) for some features & fixes
- [anasty17](https://github.com/anasty17) for some features & help
- [breakdowns](https://github.com/breakdowns) for slam-aria-mirror-bot
- [zevtyardt](https://github.com/zevtyardt) for some direct links
And many more people who aren't mentioned here, but may be found in [Contributors](https://github.com/breakdowns/slam-aria-mirror-bot/graphs/contributors).

View File

@ -17,7 +17,7 @@
"value": "ANYTHING"
},
"BOT_TOKEN": {
"description": "The telegram bot token that you get from @BotFather.",
"description": "The Telegram bot token that you get from @BotFather.",
"required": true
},
"GDRIVE_FOLDER_ID": {

View File

@ -227,7 +227,8 @@ def github(url: str) -> str:
def hxfile(url: str) -> str:
""" Hxfile direct link generator
Based on https://github.com/breakdowns/slam-aria-mirror-bot """
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_filesIm(url)
return dl_url
@ -235,7 +236,8 @@ def hxfile(url: str) -> str:
def anonfiles(url: str) -> str:
""" Anonfiles direct link generator
Based on https://github.com/breakdowns/slam-aria-mirror-bot """
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_anonfiles(url)
return dl_url
@ -243,7 +245,8 @@ def anonfiles(url: str) -> str:
def letsupload(url: str) -> str:
""" Letsupload direct link generator
Based on https://github.com/breakdowns/slam-aria-mirror-bot """
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
dl_url = ''
try:
link = re.findall(r'\bhttps?://.*letsupload\.io\S+', url)[0]
@ -256,7 +259,8 @@ def letsupload(url: str) -> str:
def fembed(link: str) -> str:
""" Fembed direct link generator
Based on https://github.com/breakdowns/slam-aria-mirror-bot """
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_fembed(link)
lst_link = []
@ -268,7 +272,8 @@ def fembed(link: str) -> str:
def sbembed(link: str) -> str:
""" Sbembed direct link generator
Based on https://github.com/breakdowns/slam-aria-mirror-bot """
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_sbembed(link)
lst_link = []
@ -308,7 +313,8 @@ def pixeldrain(url: str) -> str:
def antfiles(url: str) -> str:
""" Antfiles direct link generator
Based on https://github.com/breakdowns/slam-aria-mirror-bot """
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_antfiles(url)
return dl_url
@ -316,7 +322,8 @@ def antfiles(url: str) -> str:
def streamtape(url: str) -> str:
""" Streamtape direct link generator
Based on https://github.com/breakdowns/slam-aria-mirror-bot """
Based on https://github.com/zevtyardt/lk21
https://github.com/breakdowns/slam-aria-mirror-bot """
bypasser = lk21.Bypass()
dl_url=bypasser.bypass_streamtape(url)
return dl_url
@ -343,7 +350,7 @@ def racaty(url: str) -> str:
def fichier(link: str) -> str:
""" 1Fichier direct links generator
Based on https://github.com/Maujar/updateref-16-7-21
Based on https://github.com/Maujar
https://github.com/breakdowns/slam-aria-mirror-bot """
regex = r"^([http:\/\/|https:\/\/]+)?.*1fichier\.com\/\?.+"
gan = re.match(regex, link)
@ -401,6 +408,7 @@ def fichier(link: str) -> str:
else:
raise DirectDownloadLinkException("ERROR: Error trying to generate Direct Link from 1fichier!")
def solidfiles(url: str) -> str:
""" Solidfiles direct links generator
Based on https://github.com/Xonshiz/SolidFiles-Downloader

View File

@ -117,7 +117,7 @@ class GoogleDriveHelper:
resumable=False)
file_metadata = {
'name': file_name,
'description': 'Uploaded using Slam Mirror Bot',
'description': 'Uploaded using Slam Aria Mirror Bot',
'mimeType': mime_type,
}
if parent_id is not None:
@ -171,7 +171,7 @@ class GoogleDriveHelper:
# File body description
file_metadata = {
'name': file_name,
'description': 'Uploaded by Slam Mirror Bot',
'description': 'Uploaded by Slam Aria Mirror Bot',
'mimeType': mime_type,
}
try:
@ -274,7 +274,7 @@ class GoogleDriveHelper:
raise Exception('Upload has been manually cancelled!')
link = f"https://drive.google.com/folderview?id={dir_id}"
if self.is_cancelled:
LOGGER.info("Deleting uploaded data from drive...")
LOGGER.info("Deleting uploaded data from Drive...")
msg = self.deletefile(link)
LOGGER.info(f"{msg}")
return
@ -374,7 +374,7 @@ class GoogleDriveHelper:
self.cloneFolder(meta.get('name'), meta.get('name'), meta.get('id'), dir_id)
durl = self.__G_DRIVE_DIR_BASE_DOWNLOAD_URL.format(dir_id)
if self.is_cancelled:
LOGGER.info("Deleting cloned data from drive...")
LOGGER.info("Deleting cloned data from Drive...")
msg = self.deletefile(durl)
LOGGER.info(f"{msg}")
return "your clone has been stopped and cloned data has been deleted!", "cancelled"

View File

@ -1,5 +1,6 @@
# Implement By https://github.com/anasty17
# Implement By - @anasty17 (https://github.com/breakdowns/slam-aria-mirror-bot/pull/111)
# (c) https://github.com/breakdowns/slam-aria-mirror-bot
# All rights reserved
from telegram.ext import CommandHandler
from bot.helper.mirror_utils.upload_utils.gdriveTools import GoogleDriveHelper

View File

@ -82,7 +82,7 @@ class MirrorListener(listeners.MirrorListeners):
try:
path = fs_utils.get_base_name(m_path)
LOGGER.info(
f"Extracting : {name} "
f"Extracting: {name} "
)
with download_dict_lock:
download_dict[self.uid] = ExtractStatus(name, m_path, size)
@ -93,12 +93,12 @@ class MirrorListener(listeners.MirrorListeners):
archive_result = subprocess.run(["extract", m_path])
if archive_result.returncode == 0:
threading.Thread(target=os.remove, args=(m_path,)).start()
LOGGER.info(f"Deleting archive : {m_path}")
LOGGER.info(f"Deleting archive: {m_path}")
else:
LOGGER.warning('Unable to extract archive! Uploading anyway')
path = f'{DOWNLOAD_DIR}{self.uid}/{name}'
LOGGER.info(
f'got path : {path}'
f'got path: {path}'
)
except NotSupportedExtractionArchive:
@ -110,7 +110,7 @@ class MirrorListener(listeners.MirrorListeners):
up_path = f'{DOWNLOAD_DIR}{self.uid}/{up_name}'
if up_name == "None":
up_name = "".join(os.listdir(f'{DOWNLOAD_DIR}{self.uid}/'))
LOGGER.info(f"Upload Name : {up_name}")
LOGGER.info(f"Upload Name: {up_name}")
drive = gdriveTools.GoogleDriveHelper(up_name, self)
size = fs_utils.get_path_size(up_path)
upload_status = UploadStatus(drive, size, gid, self)