Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

Commit

Permalink
Fix for duplicate values.
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCaduceus authored Aug 3, 2023
1 parent d7dc626 commit a43a170
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tg-upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -757,13 +757,13 @@ def get_chatid(raw_id):
video.save_frame(f"thumb/THUMB_{PurePath(_path).stem}.jpg", t=int(args.thumb))
thumb_path = f"thumb/THUMB_{PurePath(_path).stem}.jpg"
if not args.height:
args.height = video.h
media_height = video.h
if not args.width:
args.width = video.w
media_width = video.w
if args.duration == -1:
args.duration = floor(video.duration)
media_duration = floor(video.duration)
start_time = time()
client.send_video(chat_id, _path, progress=upload_progress, duration=args.duration, parse_mode=parse_mode, caption=caption.format(file_name = PurePath(filename).stem, file_format = PurePath(filename).suffix, file_size_b = file_size, file_size_kb = file_size / 1024, file_size_mb = file_size / (1024 * 1024), file_size_gb = file_size / (1024 * 1024 * 1024), file_sha256 = file_sha256, file_md5 = file_md5, creation_time = creation_time, modification_time = modification_time, width=args.width, height=args.height, duration=args.duration, path = PurePath(_path)), has_spoiler=args.spoiler, width=int(args.width), height=int(args.height), thumb=thumb_path, file_name=filename, supports_streaming=args.disable_stream, disable_notification=args.silent, ttl_seconds=args.self_destruct, protect_content=args.protect, reply_to_message_id=args.reply_to)
client.send_video(chat_id, _path, progress=upload_progress, duration=media_duration, parse_mode=parse_mode, caption=caption.format(file_name = PurePath(filename).stem, file_format = PurePath(filename).suffix, file_size_b = file_size, file_size_kb = file_size / 1024, file_size_mb = file_size / (1024 * 1024), file_size_gb = file_size / (1024 * 1024 * 1024), file_sha256 = file_sha256, file_md5 = file_md5, creation_time = creation_time, modification_time = modification_time, width=media_width, height=media_height, duration=media_duration, path = PurePath(_path)), has_spoiler=args.spoiler, width=int(media_width), height=int(media_height), thumb=thumb_path, file_name=filename, supports_streaming=args.disable_stream, disable_notification=args.silent, ttl_seconds=args.self_destruct, protect_content=args.protect, reply_to_message_id=args.reply_to)
Path(_path).unlink(missing_ok=True) if args.delete_on_done else None
except Exception as error_code:
print(f"\nAn error occured!\n{error_code}")
Expand Down Expand Up @@ -801,10 +801,10 @@ def get_chatid(raw_id):
filename = filename.replace(args.replace[0], args.replace[1])
if args.duration == -1:
with AudioFileClip(_path) as audio:
args.duration = floor(audio.duration)
media_duration = floor(audio.duration)
file_size, file_sha256, file_md5, creation_time, modification_time = file_info(_path, caption)
start_time = time()
client.send_audio(chat_id, _path, progress=upload_progress, duration=args.duration, parse_mode=parse_mode, caption=caption.format(file_name = PurePath(filename).stem, file_format = PurePath(filename).suffix, file_size_b = file_size, file_size_kb = file_size / 1024, file_size_mb = file_size / (1024 * 1024), file_size_gb = file_size / (1024 * 1024 * 1024), file_sha256 = file_sha256, file_md5 = file_md5, creation_time = creation_time, modification_time = modification_time, duration=args.duration, path = PurePath(_path)), performer=args.artist, title=args.title, thumb=args.thumb, file_name=filename, disable_notification=args.silent, protect_content=args.protect, reply_to_message_id=args.reply_to)
client.send_audio(chat_id, _path, progress=upload_progress, duration=media_duration, parse_mode=parse_mode, caption=caption.format(file_name = PurePath(filename).stem, file_format = PurePath(filename).suffix, file_size_b = file_size, file_size_kb = file_size / 1024, file_size_mb = file_size / (1024 * 1024), file_size_gb = file_size / (1024 * 1024 * 1024), file_sha256 = file_sha256, file_md5 = file_md5, creation_time = creation_time, modification_time = modification_time, duration=media_duration, path = PurePath(_path)), performer=args.artist, title=args.title, thumb=args.thumb, file_name=filename, disable_notification=args.silent, protect_content=args.protect, reply_to_message_id=args.reply_to)
Path(_path).unlink(missing_ok=True) if args.delete_on_done else None
except Exception as error_code:
print(f"\nAn error occured!\n{error_code}")
Expand Down

0 comments on commit a43a170

Please sign in to comment.