Skip to content

Commit

Permalink
update temp
Browse files Browse the repository at this point in the history
  • Loading branch information
5hojib committed Dec 23, 2024
1 parent ce83e0b commit 15e8008
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 65 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM 5hojib/aeon:latest
FROM 5hojib/aeon:dev

WORKDIR /usr/src/app
RUN chmod 777 /usr/src/app
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,8 @@ This project is licensed under the MIT License. Refer to the [LICENSE](LICENSE)
## Acknowledgements

- Special thanks to the original developers of the [Mirror-Leech-Telegram-Bot](https://github.com/anasty17/mirror-leech-telegram-bot).
- Gratitude to contributors from various repositories whose features have been integrated into Aeon.
- Gratitude to contributors from various repositories whose features have been integrated into Aeon.


## Recent activity [![Time period](https://images.repography.com/58464391/AeonOrg/Aeon-MLTB/recent-activity/MUUzwqnoU_5n6kL3Jc8TTWcA3UxPyCHC2emNNSTGJh8/4gYNvj3-wi0i5zQVemeNAbqB7TrkUx_7BxZxhReSIVg_badge.svg)](https://repography.com)
[![Timeline graph](https://images.repography.com/58464391/AeonOrg/Aeon-MLTB/recent-activity/MUUzwqnoU_5n6kL3Jc8TTWcA3UxPyCHC2emNNSTGJh8/4gYNvj3-wi0i5zQVemeNAbqB7TrkUx_7BxZxhReSIVg_timeline.svg)](https://github.com/AeonOrg/Aeon-MLTB/commits)
4 changes: 0 additions & 4 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,6 @@ def format(self, record: LogRecord) -> str:
AS_DOCUMENT = environ.get("AS_DOCUMENT", "")
AS_DOCUMENT = AS_DOCUMENT.lower() == "true"

EQUAL_SPLITS = environ.get("EQUAL_SPLITS", "")
EQUAL_SPLITS = EQUAL_SPLITS.lower() == "true"

USER_TRANSMISSION = environ.get("USER_TRANSMISSION", "")
USER_TRANSMISSION = USER_TRANSMISSION.lower() == "true" and IS_PREMIUM_USER

Expand Down Expand Up @@ -388,7 +385,6 @@ def format(self, record: LogRecord) -> str:
"CMD_SUFFIX": CMD_SUFFIX,
"DATABASE_URL": DATABASE_URL,
"DEFAULT_UPLOAD": DEFAULT_UPLOAD,
"EQUAL_SPLITS": EQUAL_SPLITS,
"EXTENSION_FILTER": EXTENSION_FILTER,
"FFMPEG_CMDS": FFMPEG_CMDS,
"FILELION_API": FILELION_API,
Expand Down
10 changes: 1 addition & 9 deletions bot/helper/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def __init__(self):
self.is_qbit = False
self.is_clone = False
self.is_ytdlp = False
self.equal_splits = False
self.user_transmission = False
self.mixed_leech = False
self.extract = False
Expand Down Expand Up @@ -376,9 +375,6 @@ async def before_start(self):
or self.user_dict.get("split_size")
or config_dict["LEECH_SPLIT_SIZE"]
)
self.equal_splits = self.user_dict.get("equal_splits") or (
config_dict["EQUAL_SPLITS"] and "equal_splits" not in self.user_dict
)
self.max_split_size = (
MAX_SPLIT_SIZE if self.user_transmission else 2097152000
)
Expand Down Expand Up @@ -731,11 +727,7 @@ async def proceed_compress(self, dl_path, gid, o_files, ft_delete):
async with task_dict_lock:
task_dict[self.mid] = SevenZStatus(self, gid, "Zip")
size = await get_path_size(dl_path)
if self.equal_splits:
parts = -(-size // self.split_size)
split_size = (size // parts) + (size % parts)
else:
split_size = self.split_size
split_size = self.split_size
cmd = [
"7z",
f"-v{split_size}b",
Expand Down
6 changes: 3 additions & 3 deletions bot/helper/ext_utils/media_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ async def convert_video(listener, video_file, ext, retry=False):
output,
]
if ext == "mp4":
cmd[7:7] = ["-c:s", "mov_text"]
cmd[10:10] = ["-c:s", "mov_text"]
elif ext == "mkv":
cmd[7:7] = ["-c:s", "ass"]
cmd[10:10] = ["-c:s", "ass"]
else:
cmd[7:7] = ["-c:s", "copy"]
cmd[10:10] = ["-c:s", "copy"]
else:
cmd = [
"xtra",
Expand Down
11 changes: 5 additions & 6 deletions bot/helper/listeners/qbit_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def _on_download_error(err, tor, button=None):
ext_hash = tor.hash
if task := await get_task_by_gid(ext_hash[:12]):
await task.listener.on_download_error(err, button)
await sync_to_async(xnox_client.torrents_pause, torrent_hashes=ext_hash)
await sync_to_async(xnox_client.torrents_stop, torrent_hashes=ext_hash)
await sleep(0.3)
await _remove_torrent(ext_hash, tor.tags)

Expand All @@ -58,8 +58,7 @@ async def _on_seed_finish(tor):

@new_task
async def _stop_duplicate(tor):
if task := await get_task_by_gid(tor.hash[:12]):
if task.listener.stop_duplicate:
if (task := await get_task_by_gid(tor.hash[:12])) and task.listener.stop_duplicate:
task.listener.name = tor.content_path.rsplit("/", 1)[-1].rsplit(
".!qB",
1,
Expand All @@ -75,7 +74,7 @@ async def _on_download_complete(tor):
tag = tor.tags
if task := await get_task_by_gid(ext_hash[:12]):
if not task.listener.seed:
await sync_to_async(xnox_client.torrents_pause, torrent_hashes=ext_hash)
await sync_to_async(xnox_client.torrents_stop, torrent_hashes=ext_hash)
if task.listener.select:
await clean_unwanted(task.listener.dir)
path = tor.content_path.rsplit("/", 1)[0]
Expand Down Expand Up @@ -185,15 +184,15 @@ async def _qb_listener():
tor_info,
)
elif (
tor_info.completion_on != 0
tor_info.completion_on != -1
and not qb_torrents[tag]["uploaded"]
and state
not in ["checkingUP", "checkingDL", "checkingResumeData"]
):
qb_torrents[tag]["uploaded"] = True
await _on_download_complete(tor_info)
elif (
state in ["pausedUP", "pausedDL"]
state in ["stoppedUP", "stoppedDL"]]
and qb_torrents[tag]["seeding"]
):
qb_torrents[tag]["seeding"] = False
Expand Down
6 changes: 3 additions & 3 deletions bot/helper/mirror_leech_utils/download_utils/qbit_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ async def add_qb_torrent(listener, path, ratio, seed_time):
if tor_info.state not in [
"metaDL",
"checkingResumeData",
"pausedDL",
"stoppedDL",
]:
await delete_message(meta)
break
Expand All @@ -126,7 +126,7 @@ async def add_qb_torrent(listener, path, ratio, seed_time):
ext_hash = tor_info.hash
if not add_to_queue:
await sync_to_async(
xnox_client.torrents_pause,
xnox_client.torrents_stop,
torrent_hashes=ext_hash,
)
SBUTTONS = bt_selection_buttons(ext_hash)
Expand All @@ -145,7 +145,7 @@ async def add_qb_torrent(listener, path, ratio, seed_time):
LOGGER.info(
f"Start Queued Download from Qbittorrent: {tor_info.name} - Hash: {ext_hash}",
)
await sync_to_async(xnox_client.torrents_resume, torrent_hashes=ext_hash)
await sync_to_async(xnox_client.torrents_start, torrent_hashes=ext_hash)

except Exception as e:
await listener.on_download_error(f"{e}")
Expand Down
4 changes: 2 additions & 2 deletions bot/helper/mirror_leech_utils/status_utils/qbit_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def status(self):
return MirrorStatus.STATUS_QUEUEDL
if state == "queuedUP":
return MirrorStatus.STATUS_QUEUEUP
if state in ["pausedDL", "pausedUP"]:
if state in ["stoppedDL", "stoppedUP"]:
return MirrorStatus.STATUS_PAUSED
if state in ["checkingUP", "checkingDL"]:
return MirrorStatus.STATUS_CHECK
Expand Down Expand Up @@ -94,7 +94,7 @@ async def cancel_task(self):
self.listener.is_cancelled = True
await sync_to_async(self.update)
await sync_to_async(
xnox_client.torrents_pause,
xnox_client.torrents_stop,
torrent_hashes=self._info.hash,
)
if not self.seeding:
Expand Down
4 changes: 2 additions & 2 deletions bot/modules/file_selector.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async def select(_, message):
if not task.queued:
await sync_to_async(task.update)
id_ = task.hash()
await sync_to_async(xnox_client.torrents_pause, torrent_hashes=id_)
await sync_to_async(xnox_client.torrents_stop, torrent_hashes=id_)
elif not task.queued:
await sync_to_async(task.update)
try:
Expand Down Expand Up @@ -139,7 +139,7 @@ async def get_confirm(_, query):
await remove(f_path)
if not task.queued:
await sync_to_async(
xnox_client.torrents_resume,
xnox_client.torrents_start,
torrent_hashes=id_,
)
else:
Expand Down
24 changes: 0 additions & 24 deletions bot/modules/users_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,6 @@ async def get_user_settings(from_user):
else:
split_size = config_dict["LEECH_SPLIT_SIZE"]

if user_dict.get("equal_splits", False) or (
"equal_splits" not in user_dict and config_dict["EQUAL_SPLITS"]
):
equal_splits = "Enabled"
else:
equal_splits = "Disabled"

if user_dict.get("lprefix", False):
lprefix = user_dict["lprefix"]
elif "lprefix" not in user_dict and config_dict["LEECH_FILENAME_PREFIX"]:
Expand Down Expand Up @@ -184,7 +177,6 @@ async def get_user_settings(from_user):
Leech Type is <b>{ltype}</b>
Custom Thumbnail <b>{thumbmsg}</b>
Leech Split Size is <b>{split_size}</b>
Equal Splits is <b>{equal_splits}</b>
Leech Prefix is <code>{escape(lprefix)}</code>
Leech Destination is <code>{leech_dest}</code>
Leech by <b>{leech_method}</b> session
Expand Down Expand Up @@ -372,7 +364,6 @@ async def edit_user_settings(client, query):
await query.answer("Not Yours!", show_alert=True)
elif data[2] in [
"as_doc",
"equal_splits",
"user_transmission",
"stop_duplicate",
"mixed_leech",
Expand Down Expand Up @@ -453,20 +444,6 @@ async def edit_user_settings(client, query):
else:
ltype = "MEDIA"
buttons.data_button("Send As Document", f"userset {user_id} as_doc true")
if user_dict.get("equal_splits", False) or (
"equal_splits" not in user_dict and config_dict["EQUAL_SPLITS"]
):
buttons.data_button(
"Disable Equal Splits",
f"userset {user_id} equal_splits false",
)
equal_splits = "Enabled"
else:
buttons.data_button(
"Enable Equal Splits",
f"userset {user_id} equal_splits true",
)
equal_splits = "Disabled"
if (IS_PREMIUM_USER and user_dict.get("user_transmission", False)) or (
"user_transmission" not in user_dict and config_dict["USER_TRANSMISSION"]
):
Expand Down Expand Up @@ -515,7 +492,6 @@ async def edit_user_settings(client, query):
Leech Type is <b>{ltype}</b>
Custom Thumbnail <b>{thumbmsg}</b>
Leech Split Size is <b>{split_size}</b>
Equal Splits is <b>{equal_splits}</b>
Leech Prefix is <code>{escape(lprefix)}</code>
Leech Destination is <code>{leech_dest}</code>
Leech by <b>{leech_method}</b> session
Expand Down
24 changes: 14 additions & 10 deletions web/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,30 +110,34 @@ def make_tree(res, tool=False):
folder_id += 1
else:
previous_node = current_node
try:
progress = round((int(i["completedLength"]) / int(i["length"])) * 100, 5)
except:
progress = 0
TorNode(
folders[-1],
is_file=True,
parent=previous_node,
size=float(i["length"]),
size=int(i["length"]),
priority=priority,
file_id=i["index"],
progress=round(
(int(i["completedLength"]) / int(i["length"])) * 100,
5,
),
progress=progress,
)
else:
try:
progress = round(
(int(i["completedLength"]) / int(i["length"])) * 100, 5
)
except:
progress = 0
TorNode(
folders[-1],
is_file=True,
parent=parent,
size=float(i["length"]),
size=int(i["length"]),
priority=priority,
file_id=i["index"],
progress=round(
(int(i["completedLength"]) / int(i["length"])) * 100,
5,
),
progress=progress,
)

result = create_list(parent)
Expand Down

0 comments on commit 15e8008

Please sign in to comment.