Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit ff9805f
Author: Dawn India <[email protected]>
Date:   Tue Aug 27 15:25:25 2024 +0530

    Minor fixes

commit f52180a
Author: Dawn India <[email protected]>
Date:   Mon Aug 26 17:06:26 2024 +0530

    Add METADATA_ATTACHMENT

commit 59d5786
Author: Dawn India <[email protected]>
Date:   Mon Aug 26 01:58:52 2024 +0530

    pr/71 merged into pr/70

commit f450e02
Merge: 151ca40 dfef6fe
Author: Dawn India <[email protected]>
Date:   Mon Aug 26 01:20:40 2024 +0530

    Merge branch 'pr/71' into pr/70

commit 151ca40
Author: Dawn India <[email protected]>
Date:   Mon Aug 26 00:57:10 2024 +0530

    Metadata

    Improvement

commit dfef6fe
Author: SonGoku1972 <[email protected]>
Date:   Sun Aug 25 22:34:52 2024 +0530

    Update metadata.py

commit 3886413
Author: SonGoku1972 <[email protected]>
Date:   Sun Aug 25 22:34:32 2024 +0530

    Update users_settings.py

commit bfc6ba7
Author: SonGoku1972 <[email protected]>
Date:   Sun Aug 25 22:27:35 2024 +0530

    Update users_settings.py

commit b5896eb
Author: Dawn India <[email protected]>
Date:   Sun Aug 25 16:04:33 2024 +0530

    Metadata

    Added ststus.

commit c8ab97c
Author: Dawn India <[email protected]>
Date:   Sun Aug 25 14:49:02 2024 +0530

    metadata improvements.

commit cdcba69
Author: SonGoku1972 <[email protected]>
Date:   Sat Aug 24 22:45:13 2024 +0530

    Update users_settings.py

commit 61a298c
Author: SonGoku1972 <[email protected]>
Date:   Sat Aug 24 22:11:33 2024 +0530

    Update telegram_uploader.py

commit 0a87895
Author: SonGoku1972 <[email protected]>
Date:   Sat Aug 24 22:08:58 2024 +0530

    Update users_settings.py

commit e94386b
Author: SonGoku1972 <[email protected]>
Date:   Sat Aug 24 22:02:53 2024 +0530

    Update metadata.py

commit f31d0a6
Author: SonGoku1972 <[email protected]>
Date:   Sat Aug 24 22:02:01 2024 +0530

    Update metadata.py

commit 50baad3
Author: SonGoku1972 <[email protected]>
Date:   Sat Aug 24 22:00:35 2024 +0530

    Update metadata.py

commit c5c8127
Author: SonGoku1972 <[email protected]>
Date:   Sat Aug 24 19:39:30 2024 +0530

    Create metadata.py

commit 066d64f
Author: SonGoku1972 <[email protected]>
Date:   Sat Aug 24 19:37:50 2024 +0530

    Update users_settings.py

commit d3222c2
Author: SonGoku1972 <[email protected]>
Date:   Sat Aug 24 19:33:12 2024 +0530

    Update telegram_uploader.py

Signed-off-by: Dawn India <[email protected]>
  • Loading branch information
Dawn-India committed Aug 27, 2024
1 parent 4003c97 commit bdbbb94
Show file tree
Hide file tree
Showing 13 changed files with 598 additions and 24 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,8 @@ programming in Python.
- `(text)` will get removed
- `[test]` will get replaced by test
- `\text\` will get replaced by text with sensitive case
- `METADATA_TXT`: Edit metadata of the video. `Str`
- `META_ATTACHMENT`: Add attachment to the metadata. `Str`

**12. Super Group Features**

Expand Down
16 changes: 16 additions & 0 deletions bot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,20 @@
if len(LEECH_CAPTION_FONT) == 0:
LEECH_CAPTION_FONT = ""

METADATA_TXT = environ.get(
"METADATA_TXT",
""
)
if len(METADATA_TXT) == 0:
METADATA_TXT = ""

META_ATTACHMENT = environ.get(
"META_ATTACHMENT",
""
)
if len(META_ATTACHMENT) == 0:
META_ATTACHMENT = ""

SEARCH_PLUGINS = environ.get(
"SEARCH_PLUGINS",
""
Expand Down Expand Up @@ -1098,6 +1112,8 @@
"MIXED_LEECH": MIXED_LEECH,
"MEGA_LIMIT": MEGA_LIMIT,
"MINIMUM_DURATOIN": MINIMUM_DURATOIN,
"METADATA_TXT": METADATA_TXT,
"META_ATTACHMENT": META_ATTACHMENT,
"NAME_SUBSTITUTE": NAME_SUBSTITUTE,
"NZB_LIMIT": NZB_LIMIT,
"PLAYLIST_LIMIT": PLAYLIST_LIMIT,
Expand Down
53 changes: 52 additions & 1 deletion bot/helper/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@
is_telegram_link,
)
from bot.helper.ext_utils.media_utils import (
add_attachment,
createThumb,
createSampleVideo,
edit_video_metadata,
take_ss,
)
from bot.helper.ext_utils.media_utils import (
Expand All @@ -79,6 +81,7 @@
from bot.helper.task_utils.status_utils.media_convert_status import (
MediaConvertStatus,
)
from bot.helper.task_utils.status_utils.meta_status import MetaStatus
from bot.helper.task_utils.status_utils.split_status import SplitStatus
from bot.helper.task_utils.status_utils.zip_status import ZipStatus
from bot.helper.telegram_helper.bot_commands import BotCommands
Expand Down Expand Up @@ -120,6 +123,8 @@ def __init__(self):
self.mode = ""
self.time = ""
self.chatId = ""
self.metaData = None
self.metaAttachment = None
self.getChat = None
self.splitSize = 0
self.maxSplitSize = 0
Expand Down Expand Up @@ -392,6 +397,16 @@ async def beforeStart(self):
"!qB"
]
)
self.metaData = self.metaData or self.userDict.get("metatxt") or (
config_dict["METADATA_TXT"]
if "metatxt" not in self.userDict
else False
)
self.metaAttachment = self.metaAttachment or self.userDict.get("attachmenturl") or (
config_dict["META_ATTACHMENT"]
if "attachmenturl" not in self.userDict
else False
)
if self.link not in [
"rcl",
"gdl"
Expand Down Expand Up @@ -1170,7 +1185,11 @@ async def proceedCompress(self, dl_path, gid, o_files, ft_delete):

async def proceedSplit(self, up_dir, m_size, o_files, gid):
checked = False
for dirpath, _, files in await sync_to_async(
for (
dirpath,
_,
files
) in await sync_to_async(
walk,
up_dir,
topdown=False
Expand Down Expand Up @@ -1702,3 +1721,35 @@ async def substitute(self, dl_path):
)
)
return dl_path

async def proceedMetadata(self, up_path, gid):
(
is_video,
_,
_
) = await get_document_type(up_path)
if is_video:
async with task_dict_lock:
task_dict[self.mid] = MetaStatus(
self,
gid
)
LOGGER.info(f"Editing Metadata: {self.metaData} into {up_path}")
await edit_video_metadata(
self,
up_path
)
return up_path

async def proceedAttachment(self, up_path, gid):
async with task_dict_lock:
task_dict[self.mid] = MetaStatus(
self,
gid
)
LOGGER.info(f"Adding Attachment: {self.metaAttachment} into {up_path}")
await add_attachment(
self,
up_path
)
return up_path
Loading

0 comments on commit bdbbb94

Please sign in to comment.