Skip to content

Commit

Permalink
Merge pull request yashoswalyo#51 from yashoswalyo/beta
Browse files Browse the repository at this point in the history
Current file indicator
  • Loading branch information
yashoswalyo authored Nov 7, 2022
2 parents 7f456b5 + 7d0752f commit 50438d8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
11 changes: 7 additions & 4 deletions plugins/mergeVideo.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,19 @@ async def mergeNow(c: Client, cb: CallbackQuery, new_file_name: str):
list_subtitle_ids = queueDB.get(cb.from_user.id)["subtitles"]
# list_subtitle_ids.sort()
LOGGER.info(Config.IS_PREMIUM)
LOGGER.info(list_message_ids, list_subtitle_ids)
LOGGER.info(f"Videos: {list_message_ids}")
LOGGER.info(f"Subs: {list_subtitle_ids}")
if list_message_ids is None:
await cb.answer("Queue Empty", show_alert=True)
await cb.message.delete(True)
return
if not os.path.exists(f"downloads/{str(cb.from_user.id)}/"):
os.makedirs(f"downloads/{str(cb.from_user.id)}/")
input_ = f"downloads/{str(cb.from_user.id)}/input.txt"
all = len(list_message_ids)
n=1
for i in await c.get_messages(
chat_id=cb.from_user.id, message_ids=list_message_ids
):
chat_id=cb.from_user.id, message_ids=list_message_ids ):
media = i.video or i.document
await cb.message.edit(f"📥 Starting Download of ... `{media.file_name}`")
LOGGER.info(f"📥 Starting Download of ... {media.file_name}")
Expand All @@ -56,8 +58,9 @@ async def mergeNow(c: Client, cb: CallbackQuery, new_file_name: str):
message=media,
file_name=f"downloads/{str(cb.from_user.id)}/{str(i.id)}/vid.mkv", # fix for filename with single quote(') in name
progress=prog.progress_for_pyrogram,
progress_args=(f"🚀 Downloading: `{media.file_name}`", c_time),
progress_args=(f"🚀 Downloading: `{media.file_name}`", c_time, f"\n**Downloading: {n}/{all}**"),
)
n+=1
if gDict[cb.message.chat.id] and cb.message.id in gDict[cb.message.chat.id]:
return
await cb.message.edit(f"Downloaded Sucessfully ... `{media.file_name}`")
Expand Down
5 changes: 4 additions & 1 deletion plugins/mergeVideoAudio.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ async def mergeAudio(c: Client, cb: CallbackQuery, new_file_name: str):
return
if not os.path.exists(f"downloads/{str(cb.from_user.id)}/"):
os.makedirs(f"downloads/{str(cb.from_user.id)}/")
all = len(list_message_ids)
n=1
msgs: list[Message] = await c.get_messages(
chat_id=cb.from_user.id, message_ids=list_message_ids
)
Expand All @@ -54,8 +56,9 @@ async def mergeAudio(c: Client, cb: CallbackQuery, new_file_name: str):
message=media,
file_name=f"downloads/{str(cb.from_user.id)}/{str(i.id)}/{tmpFileName}",
progress=prog.progress_for_pyrogram,
progress_args=(f"🚀 Downloading: `{media.file_name}`", c_time),
progress_args=(f"🚀 Downloading: `{media.file_name}`", c_time, f"\n**Downloading: {n}/{all}**"),
)
n+=1
if gDict[cb.message.chat.id] and cb.message.id in gDict[cb.message.chat.id]:
return
await cb.message.edit(f"Downloaded Sucessfully ... `{media.file_name}`")
Expand Down
5 changes: 4 additions & 1 deletion plugins/mergeVideoSub.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ async def mergeSub(c: Client, cb: CallbackQuery, new_file_name: str):
msgs: list[Message] = await c.get_messages(
chat_id=cb.from_user.id, message_ids=list_message_ids
)
all = len(msgs)
n=1
for i in msgs:
media = i.video or i.document
await cb.message.edit(f"📥 Starting Download of ... `{media.file_name}`")
Expand All @@ -65,8 +67,9 @@ async def mergeSub(c: Client, cb: CallbackQuery, new_file_name: str):
message=media,
file_name=f"downloads/{str(cb.from_user.id)}/{str(i.id)}/{tmpFileName}",
progress=prog.progress_for_pyrogram,
progress_args=(f"🚀 Downloading: `{media.file_name}`", c_time),
progress_args=(f"🚀 Downloading: `{media.file_name}`", c_time,f"\n**Downloading: {n}/{all}**"),
)
n+=1
if gDict[cb.message.chat.id] and cb.message.id in gDict[cb.message.chat.id]:
return
await cb.message.edit(f"Downloaded Sucessfully ... `{media.file_name}`")
Expand Down

0 comments on commit 50438d8

Please sign in to comment.