Skip to content

Commit bf0e674

Browse files
committed
Improved : Compatiblity for generating both the 'new_heading' && 'lect_caption', to cover file-Names having whitespaces in name instead of underscores. & More...
1. new_heading : Moded the code to work with file-Names having whitespaces in name instead of underscores (the earlier case) 2. lect_caption : Also, improved to check the last-Dot from the last/end side so the file-Names can now have multiple dots(.) as part of it. Ref for THE Prev.Commit:: alik0211/mtproto-core#279 gram-js/gramjs#522
1 parent 9092905 commit bf0e674

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

upload.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ async def main():
6767
while True:
6868
if not file_num < n:
6969
break
70-
new_heading = sys.argv[file_num].split("/")[-1].rsplit("_", 2)[0]
70+
new_heading = sys.argv[file_num].split("/")[-1].rsplit(" ", 2)[0]
7171
if not old_heading == new_heading:
7272
print("Subject/Series changed... so Changing/Sending the new HEADING before uploading this new series...")
7373
send_heading = new_heading.replace("_", " ") + " ✅ ✅"
7474
await client.send_message(chat, send_heading)
7575
old_heading = new_heading
7676
count_called = 0
77-
lect_caption = sys.argv[file_num].split("/")[-1].split(".")[0]
77+
lect_caption = sys.argv[file_num].split("/")[-1].rsplit(".", 1)[0]
7878
file_path = sys.argv[file_num]
7979
start_time = datetime.now()
8080
print("Now uploading file", file_path)

0 commit comments

Comments
 (0)