Skip to content

Commit

Permalink
Merge pull request #21 from holll/dev
Browse files Browse the repository at this point in the history
优化
  • Loading branch information
holll authored May 25, 2024
2 parents e7d3c55 + 756699b commit 974739d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tools/down_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def download_file(client: TelegramClient, channel_title, channel_id, messa
formatted_time = datetime.strftime(message_time, '%Y_%m')

file_name = GetFileName(message)
file_path = f'{os.environ["save_path"]}/{channel_title}-{channel_id}/{file_name}'
file_path = os.path.join(os.environ["save_path"], f'{channel_title}-{channel_id}', file_name)
file_size = message.file.size
ret, file_path = fileExist(file_path, file_size)
if not ret:
Expand Down
6 changes: 3 additions & 3 deletions tools/tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ def GetFileName(message) -> str:
if message.file.name:
return message.file.name

file_ext = '.jpg' if message.file.ext in ['.jpe','jpeg'] else message.file.ext
if len(message.message) != 0:
sName = shorten_filename(demoji.replace(message.message, '[emoji]'))
return re.sub(r'[\\/:*?"<>|]', '_', sName) + message.file.ext

return GetFileId(message) + message.file.ext
return re.sub(r'[\\/:*?"<>|]', '_', sName) + file_ext
return GetFileId(message) + file_ext


async def print_group(client: TelegramClient, chat_id):
Expand Down

0 comments on commit 974739d

Please sign in to comment.