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

Commit

Permalink
Bump to v1.1.5
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCaduceus authored Aug 3, 2023
1 parent 81193a6 commit d7dc626
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,12 @@ Go to [My Telegram](https://my.telegram.org/apps), create an app, and get its **

**2.Login in tg-upload:**

tg-upload supports logging in as a user (using a phone number or session string) or bot (using a bot token or session string). You must pass the value of your **API_ID** (`--api_id`) & **API_HASH** (`--api_hash`) and a unique name for your session (`--profile`). To log in as a user, you must pass your phone number (--phone), or to log in as a bot, pass the bot token (--bot).
tg-upload supports logging in as a user (using a phone number or session string) or bot (using a bot token or session string). You must pass the value of your **API_ID** (`--api_id`) & **API_HASH** (`--api_hash`) and a unique name for your session (`--profile`). To log in as a user, you must pass your phone number (`--phone`), or to log in as a bot, pass the bot token (`--bot`).

```
py tg-upload.py --profile VALUE --api_id VALUE --api_hash VALUE --phone VALUE --login_only
```
From now on, whenever you need to perform any task, you just need to pass the profile name (--profile) that you used to create your session. You will be logged in without any authentication flow until you terminate the session from the Telegram app.
From now on, whenever you need to perform any task, you just need to pass the profile name (`--profile`) that you used to create your session. You will be logged in without any authentication flow until you terminate the session from the Telegram app.

<a name="htu-3"></a>

Expand Down
12 changes: 6 additions & 6 deletions tg-upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import argparse
import hashlib

tg_upload = "1.1.4"
tg_upload = "1.1.5"
versions = f"tg-upload: {tg_upload} \
Python: {py_ver[0]}.{py_ver[1]}.{py_ver[2]} \
Pyrogram: {get_dist('pyrogram').version} \
Expand Down Expand Up @@ -641,7 +641,7 @@ def get_chatid(raw_id):

if not args.as_video and args.thumb == 'auto':
args.thumb = None
elif args.thumb and PurePath(args.thumb).suffix not in ['.jpg','jpeg'] and args.thumb != 'auto':
elif not args.as_video and args.thumb and PurePath(args.thumb).suffix not in ['.jpg','jpeg'] and args.thumb != 'auto':
thumbname = PurePath(args.thumb).stem
jpg_path = f"{thumbname}.jpg"
print(f"CONVERT: {PurePath(args.thumb).name} -> {jpg_path}")
Expand Down Expand Up @@ -751,19 +751,19 @@ def get_chatid(raw_id):
with VideoFileClip(str(_path)) as video:
Path(args.thumb_dir).mkdir(exist_ok=True)
if args.thumb == 'auto':
args.thumb = f"thumb/THUMB_{PurePath(_path).stem}.jpg"
video.save_frame(args.thumb, t=floor(video.duration / 2))
thumb_path = f"thumb/THUMB_{PurePath(_path).stem}.jpg"
video.save_frame(thumb_path, t=floor(video.duration / 2))
elif args.thumb != None and args.thumb.isdigit():
video.save_frame(f"thumb/THUMB_{PurePath(_path).stem}.jpg", t=int(args.thumb))
args.thumb = f"thumb/THUMB_{PurePath(_path).stem}.jpg"
thumb_path = f"thumb/THUMB_{PurePath(_path).stem}.jpg"
if not args.height:
args.height = video.h
if not args.width:
args.width = video.w
if args.duration == -1:
args.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=args.thumb, 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=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)
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 d7dc626

Please sign in to comment.