From d39007b27faa46c4812a7a6dd097fd96d49fabe8 Mon Sep 17 00:00:00 2001 From: sharky555 Date: Thu, 24 Dec 2020 21:59:47 -0700 Subject: [PATCH] torrent is made successfully. Need to figure out how to make a successful POST. --- autoupload.py | 16 ++++++++++------ json_data/config.json.example | 3 ++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/autoupload.py b/autoupload.py index 143b103..2b003bf 100644 --- a/autoupload.py +++ b/autoupload.py @@ -55,6 +55,7 @@ def getauthkey(): soup = BeautifulSoup(smpage.text, 'html5lib') rel2 = str(soup.select('#content .thin .main_column .torrent_table tbody')) authkey = re.findall('authkey=(.*)&torrent_pass=', rel2) + print(authkey) return authkey @@ -544,7 +545,7 @@ def detectlanguage(string): return en -def uploadtorrent(torrent, cover, releasedata): +def uploadtorrent(torrent, releasedata): languages = ('Japanese', 'English', 'Korean', 'Chinese', 'Vietnamese') # POST url. @@ -560,8 +561,8 @@ def uploadtorrent(torrent, cover, releasedata): try: postDataFiles = { - 'file_input': open(torrent, 'rb'), - 'userfile': open(cover, 'rb') + 'file_input': open(torrent, 'rb') + #'userfile': open(cover, 'rb') } except FileNotFoundError: print("_" * 100) @@ -665,7 +666,9 @@ if __name__ == "__main__": loginUrl = "https://sugoimusic.me/login.php" loginTestUrl = "https://sugoimusic.me" successStr = "Enabled users" - + passkey = cfg['credentials']['passkey'] + annouceurl = "https://tracker.sugoimusic.me:24601/"+passkey+"/announce" + print(annouceurl) # j is an object which can be used to make requests with respect to the loginsession sm = smpy.MyLoginSession(loginUrl, loginData, loginTestUrl, successStr, debug=args.debug) # Acquire authkey @@ -679,10 +682,11 @@ if __name__ == "__main__": # cover_path = directory + "/" + cfg['local_prefs']['cover_name'] # Create torrent file. - torrentfile = createtorrent(authkey, directory, folder_name, releasedata) + #torrentfile = createtorrent(authkey, directory, folder_name, releasedata) + torrentfile = createtorrent(annouceurl, directory, folder_name, releasedata) # Upload torrent to JPopSuki - # uploadtorrent(torrentfile, cover_path, releasedata) + uploadtorrent(torrentfile, releasedata) # Setting variable for watch/download folders ftp_watch_folder = cfg['ftp_prefs']['ftp_watch_folder'] diff --git a/json_data/config.json.example b/json_data/config.json.example index 97c5851..f99a229 100644 --- a/json_data/config.json.example +++ b/json_data/config.json.example @@ -1,7 +1,8 @@ { "credentials": { "username": "username", - "password": "password" + "password": "password", + "passkey": "passkey" }, "local_prefs": { "log_directory": "D:/Bugs/BugsPy-master/logs",