Skip to content

Commit

Permalink
Some fixes to ffmpeg cmds
Browse files Browse the repository at this point in the history
Signed-off-by: anasty17 <[email protected]>
  • Loading branch information
anasty17 committed Dec 2, 2024
1 parent 4f343c7 commit b2a4b0c
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 15 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,10 @@ quotes, even if it's `Int`, `Bool` or `List`.
**Notes**:
- Add `-del` to the list(s) which you want from the bot to delete the original files after command run complete!
- Seed will get disbaled while using this option
- It must be list of list(s) event of one list added like [["-i", "mltb.mkv", "-c", "copy", "-c:s", "srt", "mltb.mkv", "-del"]]
**Example**:
- Here I will explain how to use mltb.* which is reference to files you want to work on.
1. First cmd: the input is mltb.mkv so this cmd will work only on mkv videos and the output is mltb.mkv also so all outputs is mkv.
1. First cmd: the input is mltb.mkv so this cmd will work only on mkv videos and the output is mltb.mkv also so all outputs is mkv. `-del` will delete the original media after complete run of the cmd.
2. Second cmd: the input is mltb.video so this cmd will work on all videos and the output is only mltb so the extenstion is same as input files.
3. Third cmd: the input in mltb.m4a so this cmd will work only on m4a audios and the output is mltb.mp3 so the output extension is mp3.
4. Fourth cmd: the input is mltb.audio so this cmd will work on all audios and the output is mltb.mp3 so the output extension is mp3.
Expand Down
17 changes: 16 additions & 1 deletion bot/helper/ext_utils/help_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
8. \text\ will get replaced by text with sensitive case
"""

mixed_leech = """Mixed leech: -ml
mixed_leech = """<b>Mixed leech</b>: -ml
/cmd link -ml (leech by user and bot session with respect to size)"""

thumbnail_layout = """Thumbnail Layout: -tl
Expand All @@ -234,6 +234,19 @@
/cmd link -doc (Leech as document)
/cmd link -med (Leech as media)"""

ffmpeg_cmds = """<b>FFmpeg Commands</b>: -ff
list of lists of ffmpeg commands. You can set multiple ffmpeg commands for all files before upload. Don't write ffmpeg at beginning, start directly with the arguments.
Notes:
1. Add <code>-del</code> to the list(s) which you want from the bot to delete the original files after command run complete!
2. Seed will get disbaled while using this option
3. It must be list of list(s) event of one list added like [["-i", "mltb.mkv", "-c", "copy", "-c:s", "srt", "mltb.mkv", "-del"]]
Examples: [["-i", "mltb.mkv", "-c", "copy", "-c:s", "srt", "mltb.mkv", "-del"], ["-i", "mltb.video", "-c", "copy", "-c:s", "srt", "mltb"], ["-i", "mltb.m4a", "-c:a", "libmp3lame", "-q:a", "2", "mltb.mp3"], ["-i", "mltb.audio", "-c:a", "libmp3lame", "-q:a", "2", "mltb.mp3"]]
Here I will explain how to use mltb.* which is reference to files you want to work on.
1. First cmd: the input is mltb.mkv so this cmd will work only on mkv videos and the output is mltb.mkv also so all outputs is mkv. -del will delete the original media after complete run of the cmd.
2. Second cmd: the input is mltb.video so this cmd will work on all videos and the output is only mltb so the extenstion is same as input files.
3. Third cmd: the input in mltb.m4a so this cmd will work only on m4a audios and the output is mltb.mp3 so the output extension is mp3.
4. Fourth cmd: the input is mltb.audio so this cmd will work on all audios and the output is mltb.mp3 so the output extension is mp3."""

YT_HELP_DICT = {
"main": yt,
"New-Name": f"{new_name}\nNote: Don't add file extension",
Expand All @@ -255,6 +268,7 @@
"Mixed-Leech": mixed_leech,
"Thumbnail-Layout": thumbnail_layout,
"Leech-Type": leech_as,
"FFmpeg-Cmds": ffmpeg_cmds,
}

MIRROR_HELP_DICT = {
Expand Down Expand Up @@ -284,6 +298,7 @@
"Mixed-Leech": mixed_leech,
"Thumbnail-Layout": thumbnail_layout,
"Leech-Type": leech_as,
"FFmpeg-Cmds": ffmpeg_cmds,
}

CLONE_HELP_DICT = {
Expand Down
11 changes: 8 additions & 3 deletions bot/helper/ext_utils/media_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,12 +713,17 @@ async def create_sample_video(listener, video_file, sample_duration, part_durati

async def run_ffmpeg_cmd(listener, ffmpeg, path):
base_name, ext = ospath.splitext(path)
dir, base_name = base_name.rsplit("/", 1)
output_file = ffmpeg[-1]
if output_file != "mltb" and output_file.startswith("mltb"):
ext = ospath.splitext(output_file)[-1]
oext = ospath.splitext(output_file)[-1]
if ext == oext:
base_name = f"ffmpeg.{base_name}"
else:
ext = oext
else:
base_name = f"ffmpeg - {base_name}"
output = f"{base_name}{ext}"
base_name = f"ffmpeg.{base_name}"
output = f"{dir}/{base_name}{ext}"
ffmpeg[-1] = output
if listener.is_cancelled:
return False
Expand Down
11 changes: 6 additions & 5 deletions bot/helper/listeners/task_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,6 @@ async def on_download_complete(self):
up_dir, self.name = up_path.rsplit("/", 1)
self.size = await get_path_size(up_dir)

if self.name_sub:
up_path = await self.substitute(up_path)
if self.is_cancelled:
return
self.name = up_path.rsplit("/", 1)[1]
if self.ffmpeg_cmds:
up_path = await self.proceed_ffmpeg(
up_path,
Expand All @@ -188,6 +183,12 @@ async def on_download_complete(self):
up_dir, self.name = up_path.rsplit("/", 1)
self.size = await get_path_size(up_dir)

if self.name_sub:
up_path = await self.substitute(up_path)
if self.is_cancelled:
return
self.name = up_path.rsplit("/", 1)[1]

if self.screen_shots:
up_path = await self.generate_screenshots(up_path)
if self.is_cancelled:
Expand Down
5 changes: 3 additions & 2 deletions bot/modules/users_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -665,9 +665,10 @@ async def edit_user_settings(client, query):
Notes:
1. Add <code>-del</code> to the list(s) which you want from the bot to delete the original files after command run complete!
2. Seed will get disbaled while using this option
Examples: [["-i", "mltb.mkv", "-c", "copy", "-c:s", "srt", "mltb.mkv"], ["-i", "mltb.video", "-c", "copy", "-c:s", "srt", "mltb"], ["-i", "mltb.m4a", "-c:a", "libmp3lame", "-q:a", "2", "mltb.mp3"], ["-i", "mltb.audio", "-c:a", "libmp3lame", "-q:a", "2", "mltb.mp3"]]
3. It must be list of list(s) event of one list added like [["-i", "mltb.mkv", "-c", "copy", "-c:s", "srt", "mltb.mkv", "-del"]]
Examples: [["-i", "mltb.mkv", "-c", "copy", "-c:s", "srt", "mltb.mkv", "-del"], ["-i", "mltb.video", "-c", "copy", "-c:s", "srt", "mltb"], ["-i", "mltb.m4a", "-c:a", "libmp3lame", "-q:a", "2", "mltb.mp3"], ["-i", "mltb.audio", "-c:a", "libmp3lame", "-q:a", "2", "mltb.mp3"]]
Here I will explain how to use mltb.* which is reference to files you want to work on.
1. First cmd: the input is mltb.mkv so this cmd will work only on mkv videos and the output is mltb.mkv also so all outputs is mkv.
1. First cmd: the input is mltb.mkv so this cmd will work only on mkv videos and the output is mltb.mkv also so all outputs is mkv. -del will delete the original media after complete run of the cmd.
2. Second cmd: the input is mltb.video so this cmd will work on all videos and the output is only mltb so the extenstion is same as input files.
3. Third cmd: the input in mltb.m4a so this cmd will work only on m4a audios and the output is mltb.mp3 so the output extension is mp3.
4. Fourth cmd: the input is mltb.audio so this cmd will work on all audios and the output is mltb.mp3 so the output extension is mp3."""
Expand Down
6 changes: 3 additions & 3 deletions web/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get_folders(path):

def make_tree(res, tool=False):
if tool == "qbit":
parent = TorNode("Torrent")
parent = TorNode("QBITTORRENT")
for i in res:
folders = qb_get_folders(i.name)
if len(folders) > 1:
Expand Down Expand Up @@ -85,7 +85,7 @@ def make_tree(res, tool=False):
progress=round(i.progress * 100, 5),
)
elif tool == "aria":
parent = TorNode("Torrent")
parent = TorNode("ARIA2")
for i in res:
folders = get_folders(i["path"])
priority = 1
Expand Down Expand Up @@ -129,7 +129,7 @@ def make_tree(res, tool=False):
)

else:
parent = TorNode("Torrent")
parent = TorNode("SABNZBD+")
priority = 1
for i in res["files"]:
TorNode(
Expand Down

0 comments on commit b2a4b0c

Please sign in to comment.