Skip to content

Commit 0e4c9d6

Browse files
author
lsnnt
authored
Update __main__.py
1 parent b3998ae commit 0e4c9d6

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

__main__.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import os
77
import subprocess
88

9-
9+
path = "YOUR PATH HERE"
10+
token = "YOUR TOKEN HERE"
1011
headers3 = {
1112
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0',
1213
'Accept': 'application/json, text/plain, */*',
@@ -63,7 +64,7 @@ def upload(file_location):
6364
else:
6465
return "error uploading file contact admin"
6566

66-
bot = telebot.TeleBot('token')
67+
bot = telebot.TeleBot(token)
6768
should_stop = False
6869
@bot.message_handler(commands=['start'])
6970
def start_message(message):
@@ -76,20 +77,20 @@ def echo_all(message):
7677

7778
# try:
7879
magnet_link = message.text
79-
h = lt.add_magnet_uri(ses, magnet_link, {'save_path': '/home/nnt/torrents/'})
80+
h = lt.add_magnet_uri(ses, magnet_link, {'save_path': '/your/save/path/here'})
8081
s = h.status() # Initialize s before the while loop
81-
# file_directoryorfile = '/home/nnt/torrents/' + s.name
82+
# file_directoryorfile = '{path}' + s.name
8283
while not s.is_seeding:
8384
s = h.status()
8485
state_str = ['लािन मे है', 'जाचा जा राहा है', 'मेतादाता दोनलोद किया जा राहा है', 'दोनलोद', 'खतम', 'खतम', 'न']
8586
bot.send_message(message.chat.id, 'डाउनलाेड हाे रहा है: ' + str(s.progress * 100) + '% ' + state_str[s.state])
8687
time.sleep(6)
8788
bot.send_message(message.chat.id, 'डाउनलाेड समाप्त हाे गया है।')
8889
bot.send_message(message.chat.id, 'अपलाेड कर रहे है...')
89-
# torrent_directory = '/home/nnt/torrents/'
90+
# torrent_directory = '{path}'
9091
# get only the files in the torrent directory
9192
# run find {torrent_directory} command and get the output
92-
output = subprocess.check_output('find /home/nnt/torrents/', shell=True).decode('utf-8').split("\n")
93+
output = subprocess.check_output('find '+path, shell=True).decode('utf-8').split("\n")
9394
for a in range(0,len(output)):
9495
try:
9596
bot.send_message(message.chat.id, nnt.upload(output[a]))
@@ -98,8 +99,8 @@ def echo_all(message):
9899
bot.send_message(message.chat.id, str(a))
99100

100101
# finally:
101-
# os.system("rm -rf /home/nnt/torrents/*")
102-
os.system("rm -rf /home/nnt/torrents/*")
102+
# os.system("rm -rf {path}*")
103+
os.system(f"rm -rf {path}*")
103104
@bot.message_handler(commands=['stop'])
104105
def stop_Message(message):
105106
global should_stop

0 commit comments

Comments
 (0)