Skip to content

Commit

Permalink
fix:pylin:autopep8:flake:u black
Browse files Browse the repository at this point in the history
  • Loading branch information
kalanakt committed Jan 27, 2024
1 parent 565b8db commit be62d6f
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 16 deletions.
23 changes: 19 additions & 4 deletions Uploader/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,33 @@ async def youtube_dl_call_back(_bot, update):
if len(url_parts) == 2:
youtube_dl_url, custom_file_name = map(str.strip, url_parts)
elif len(url_parts) == 4:
youtube_dl_url, custom_file_name, youtube_dl_username, youtube_dl_password = map(str.strip, url_parts)
(
youtube_dl_url,
custom_file_name,
youtube_dl_username,
youtube_dl_password,
) = map(str.strip, url_parts)
else:
for entity in update.message.reply_to_message.entities:
if entity.type == "text_link":
youtube_dl_url = entity.url
elif entity.type == "url":
o = entity.offset
length = entity.length
youtube_dl_url = youtube_dl_url[o: o + length]
youtube_dl_url = youtube_dl_url[o : o + length]

# Cleaning up inputs
youtube_dl_url, custom_file_name, youtube_dl_username, youtube_dl_password = map(str.strip, [youtube_dl_url, custom_file_name, youtube_dl_username, youtube_dl_password])
youtube_dl_url, custom_file_name, youtube_dl_username, youtube_dl_password = (
map(
str.strip,
[
youtube_dl_url,
custom_file_name,
youtube_dl_username,
youtube_dl_password,
],
)
)

else:
for entity in update.message.reply_to_message.entities:
Expand All @@ -72,7 +87,7 @@ async def youtube_dl_call_back(_bot, update):
elif entity.type == "url":
o = entity.offset
length = entity.length
youtube_dl_url = youtube_dl_url[o: o + length]
youtube_dl_url = youtube_dl_url[o : o + length]

await update.message.edit_caption(
caption=Translation.DOWNLOAD_START.format(custom_file_name)
Expand Down
16 changes: 11 additions & 5 deletions Uploader/dl_button.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async def ddl_call_back(bot, update):
elif entity.type == "url":
o = entity.offset
length = entity.length
youtube_dl_url = youtube_dl_url[o: o + length]
youtube_dl_url = youtube_dl_url[o : o + length]
if youtube_dl_url is not None:
youtube_dl_url = youtube_dl_url.strip()
if custom_file_name is not None:
Expand All @@ -52,7 +52,7 @@ async def ddl_call_back(bot, update):
elif entity.type == "url":
o = entity.offset
length = entity.length
youtube_dl_url = youtube_dl_url[o: o + length]
youtube_dl_url = youtube_dl_url[o : o + length]

description = custom_file_name

Expand All @@ -70,7 +70,9 @@ async def ddl_call_back(bot, update):
message_id=update.message.id,
)

tmp_directory_for_each_user = f"{Config.DOWNLOAD_LOCATION}/{str(update.from_user.id)}"
tmp_directory_for_each_user = (
f"{Config.DOWNLOAD_LOCATION}/{str(update.from_user.id)}"
)

if not os.path.isdir(tmp_directory_for_each_user):
os.makedirs(tmp_directory_for_each_user)
Expand Down Expand Up @@ -99,7 +101,9 @@ async def ddl_call_back(bot, update):
return False

if os.path.exists(download_directory):
save_ytdl_json_path = f"{Config.DOWNLOAD_LOCATION}/{str(update.message.chat.id)}.json"
save_ytdl_json_path = (
f"{Config.DOWNLOAD_LOCATION}/{str(update.message.chat.id)}.json"
)
download_location = f"{Config.DOWNLOAD_LOCATION}/{update.from_user.id}.jpg"
thumb = download_location if os.path.isfile(download_location) else None

Expand Down Expand Up @@ -258,7 +262,9 @@ async def download_coroutine(bot, session, url, file_name, chat_id, message_id,
percentage = downloaded * 100 / total_length
speed = downloaded / diff
elapsed_time = round(diff) * 1000
time_to_completion = round((total_length - downloaded) / speed) * 1000
time_to_completion = (
round((total_length - downloaded) / speed) * 1000
)
estimated_total_time = elapsed_time + time_to_completion

try:
Expand Down
6 changes: 3 additions & 3 deletions Uploader/echo.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def echo(bot, update):
elif entity.type == "url":
o = entity.offset
length = entity.length
url = url[o: o + length]
url = url[o : o + length]
if url is not None:
url = url.strip()
if file_name is not None:
Expand All @@ -77,7 +77,7 @@ async def echo(bot, update):
elif entity.type == "url":
o = entity.offset
length = entity.length
url = url[o: o + length]
url = url[o : o + length]
if Config.HTTP_PROXY != "":
command_to_exec = [
"yt-dlp",
Expand Down Expand Up @@ -201,7 +201,7 @@ async def echo(bot, update):

cb_string_video = f"video |{format_id}|{format_ext}|{randem}"
cb_string_file = f"fille |{format_id}|{format_ext}|{randem}"

if format_string is not None and not ("audio only" in format_string):
ikeyboard = [
InlineKeyboardButton(
Expand Down
4 changes: 2 additions & 2 deletions Uploader/functions/help_Nekmo_ffmpeg.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,6 @@ async def generate_screen_shots(
ss_img, f"{output_directory}/{str(time.time())}.jpg", wf
)
images.append(ss_img)
return images
return images

return None
2 changes: 1 addition & 1 deletion Uploader/functions/ran_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ def random_char(y):
Returns:
str: Random string.
"""
return "".join(random.choice(string.ascii_letters) for _ in range(y))
return "".join(random.choice(string.ascii_letters) for _ in range(y))
2 changes: 1 addition & 1 deletion Uploader/script.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pyrogram.types import InlineKeyboardMarkup, InlineKeyboardButton


class Translation():
class Translation:
START_TEXT = """
Hi {}
Expand Down

1 comment on commit be62d6f

@vercel
Copy link

@vercel vercel bot commented on be62d6f Jan 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

all-url-uploader – ./

all-url-uploader-git-main-netronk.vercel.app
urluploader.vercel.app
all-url-uploader-netronk.vercel.app

Please sign in to comment.