Some fixes to ffmpeg cmds

Signed-off-by: anasty17 <e.anastayyar@gmail.com>
This commit is contained in:
anasty17 2024-12-02 18:45:36 +02:00
parent 4f343c7544
commit b2a4b0c4de
No known key found for this signature in database
GPG Key ID: EAAC8A2DF2861DE4
6 changed files with 38 additions and 15 deletions

View File

@ -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.

View File

@ -224,7 +224,7 @@ NOTE: You must add \ before any character, those are the characters: \^$.|?*+()[
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
@ -234,6 +234,19 @@ leech_as = """<b>Leech as</b>: -doc -med
/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",
@ -255,6 +268,7 @@ YT_HELP_DICT = {
"Mixed-Leech": mixed_leech,
"Thumbnail-Layout": thumbnail_layout,
"Leech-Type": leech_as,
"FFmpeg-Cmds": ffmpeg_cmds,
}
MIRROR_HELP_DICT = {
@ -284,6 +298,7 @@ MIRROR_HELP_DICT = {
"Mixed-Leech": mixed_leech,
"Thumbnail-Layout": thumbnail_layout,
"Leech-Type": leech_as,
"FFmpeg-Cmds": ffmpeg_cmds,
}
CLONE_HELP_DICT = {

View File

@ -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

View File

@ -173,11 +173,6 @@ class TaskListener(TaskConfig):
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,
@ -188,6 +183,12 @@ class TaskListener(TaskConfig):
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:

View File

@ -665,9 +665,10 @@ Check all yt-dlp api options from this <a href='https://github.com/yt-dlp/yt-dlp
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."""

View File

@ -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:
@ -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
@ -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(