Ver código fonte

torrent is made successfully. Need to figure out how to make a successful POST.

master
sharky555 4 anos atrás
pai
commit
d39007b27f
2 arquivos alterados com 12 adições e 7 exclusões
  1. +10
    -6
      autoupload.py
  2. +2
    -1
      json_data/config.json.example

+ 10
- 6
autoupload.py Ver arquivo

@@ -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']


+ 2
- 1
json_data/config.json.example Ver arquivo

@@ -1,7 +1,8 @@
{
"credentials": {
"username": "username",
"password": "password"
"password": "password",
"passkey": "passkey"
},
"local_prefs": {
"log_directory": "D:/Bugs/BugsPy-master/logs",


Carregando…
Cancelar
Salvar