|
@@ -55,6 +55,9 @@ def getargs(): |
|
|
parser.add_argument("-l", "--language", help='Set the language', nargs='?')
|
|
|
parser.add_argument("-l", "--language", help='Set the language', nargs='?')
|
|
|
parser.add_argument("-y", "--year", help='Set the torrent year (YYYYMMDD or YYYY).', nargs='?')
|
|
|
parser.add_argument("-y", "--year", help='Set the torrent year (YYYYMMDD or YYYY).', nargs='?')
|
|
|
parser.add_argument("-f", "--freeleech", help="Enables freeleech.", action="store_true")
|
|
|
parser.add_argument("-f", "--freeleech", help="Enables freeleech.", action="store_true")
|
|
|
|
|
|
parser.add_argument("-eti", "--editiontitle", help='Set the edition title', nargs='?')
|
|
|
|
|
|
parser.add_argument("-ey", "--editionyear", help='Set the torrent edition year (YYYYMMDD or YYYY).', nargs='?')
|
|
|
|
|
|
parser.add_argument("-ss", "--screenshots", help='Set the torrent screen shots', nargs='?')
|
|
|
return parser.parse_args()
|
|
|
return parser.parse_args()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -97,9 +100,27 @@ def gatherdata(): |
|
|
if originaltitle:
|
|
|
if originaltitle:
|
|
|
releasedata['title_jp'] = originaltitle
|
|
|
releasedata['title_jp'] = originaltitle
|
|
|
else:
|
|
|
else:
|
|
|
input_title = input("\n" + "_" * 100 + "\nEnter the original TITLE. Press enter to skip.\n\n")
|
|
|
|
|
|
|
|
|
input_title = input("\n" + "_" * 100 + "\nEnter the original TITLE. Press enter to skip.\n")
|
|
|
releasedata['title_jp'] = input_title
|
|
|
releasedata['title_jp'] = input_title
|
|
|
|
|
|
|
|
|
|
|
|
if year:
|
|
|
|
|
|
releasedata["year"] = year
|
|
|
|
|
|
else:
|
|
|
|
|
|
input_year = input("\n" + "_" * 100 + "\nEnter the year as YYYYMMDD or YYYY.\n")
|
|
|
|
|
|
releasedata["year"] = input_year
|
|
|
|
|
|
|
|
|
|
|
|
if editiontitle:
|
|
|
|
|
|
releasedata['remastertitle'] = editiontitle
|
|
|
|
|
|
else:
|
|
|
|
|
|
input_editiontitle = input("\n" + "_" * 100 + "\nEnter the edition TITLE. Press enter to skip.\n")
|
|
|
|
|
|
if input_editiontitle != "":
|
|
|
|
|
|
if editionyear:
|
|
|
|
|
|
releasedata["remasteryear"] = editionyear
|
|
|
|
|
|
else:
|
|
|
|
|
|
input_editionyear = input("\n" + "_" * 100 + "\nEnter the edition year as YYYYMMDD or YYYY.\n")
|
|
|
|
|
|
releasedata["remasteryear"] = input_editionyear
|
|
|
|
|
|
releasedata['remastertitle'] = input_editiontitle
|
|
|
|
|
|
|
|
|
if sub:
|
|
|
if sub:
|
|
|
releasedata["sub"] = sub
|
|
|
releasedata["sub"] = sub
|
|
|
else:
|
|
|
else:
|
|
@@ -154,11 +175,7 @@ def gatherdata(): |
|
|
break
|
|
|
break
|
|
|
print("Invalid choice.")
|
|
|
print("Invalid choice.")
|
|
|
|
|
|
|
|
|
if year:
|
|
|
|
|
|
releasedata["year"] = year
|
|
|
|
|
|
else:
|
|
|
|
|
|
input_year = input("\n" + "_" * 100 + "\nEnter the year as YYYYMMDD or YYYY.\n")
|
|
|
|
|
|
releasedata["year"] = input_year
|
|
|
|
|
|
|
|
|
|
|
|
if tags:
|
|
|
if tags:
|
|
|
input_tags = tags
|
|
|
input_tags = tags
|
|
|
else:
|
|
|
else:
|
|
@@ -199,6 +216,16 @@ def gatherdata(): |
|
|
break
|
|
|
break
|
|
|
print("Invalid choice.")
|
|
|
print("Invalid choice.")
|
|
|
|
|
|
|
|
|
|
|
|
if screenshots:
|
|
|
|
|
|
input_screenshots = screenshots
|
|
|
|
|
|
else:
|
|
|
|
|
|
input_screenshots = input("\n" + "_" * 100 + "\nEnter the screenshot links. Separate multiple with \",\". Minimum 2 tags required.\n")
|
|
|
|
|
|
if input_screenshots != "":
|
|
|
|
|
|
input_screenshots = input_screenshots.replace(",","\n")
|
|
|
|
|
|
releasedata["screenshots"] = input_screenshots
|
|
|
|
|
|
|
|
|
|
|
|
#https://ptpimg.me/z4w6c0.png\nhttps://ptpimg.me/8txr8v.png
|
|
|
|
|
|
|
|
|
return releasedata
|
|
|
return releasedata
|
|
|
|
|
|
|
|
|
def add_mediainfo_to_releasedata(filename, releasedata):
|
|
|
def add_mediainfo_to_releasedata(filename, releasedata):
|
|
@@ -352,14 +379,14 @@ def uploadtorrent(torrent, imageURL, releasedata): |
|
|
# If dryrun argument has not ben passed we will POST the results to JPopSuki.
|
|
|
# If dryrun argument has not ben passed we will POST the results to JPopSuki.
|
|
|
if dryrun != True:
|
|
|
if dryrun != True:
|
|
|
SMres = sm.retrieveContent(uploadurl, "post", data, postDataFiles)
|
|
|
SMres = sm.retrieveContent(uploadurl, "post", data, postDataFiles)
|
|
|
print('\nUpload POSTED. It may take a moment for this upload to appear on SugoiMusic.')
|
|
|
|
|
|
SMerrorTorrent = re.findall('red; text-align: center;">(.*)</p>', SMres.text)
|
|
|
SMerrorTorrent = re.findall('red; text-align: center;">(.*)</p>', SMres.text)
|
|
|
SMerrorLogon = re.findall('<p>Invalid (.*)</p>', SMres.text)
|
|
|
|
|
|
if SMerrorTorrent == None:
|
|
|
|
|
|
print("Upload failed.")
|
|
|
|
|
|
|
|
|
# SMerrorLogon = re.findall('<p>Invalid (.*)</p>', SMres.text)
|
|
|
|
|
|
if len(SMerrorTorrent)!=0:
|
|
|
|
|
|
print("Upload failed. Torrent error")
|
|
|
print(SMerrorTorrent)
|
|
|
print(SMerrorTorrent)
|
|
|
if SMerrorLogon == None:
|
|
|
|
|
|
print(SMerrorLogon)
|
|
|
|
|
|
|
|
|
# if len(SMerrorTorrent)!=0:
|
|
|
|
|
|
# print("Upload failed. Logon error")
|
|
|
|
|
|
# print(SMerrorLogon)
|
|
|
|
|
|
|
|
|
## TODO Filter through JPSres.text and create error handling based on responses
|
|
|
## TODO Filter through JPSres.text and create error handling based on responses
|
|
|
#print(JPSres.text)
|
|
|
#print(JPSres.text)
|
|
@@ -375,7 +402,7 @@ if __name__ == "__main__": |
|
|
|
|
|
|
|
|
# TODO consider calling args[] directly, we will then not need this line
|
|
|
# TODO consider calling args[] directly, we will then not need this line
|
|
|
dryrun = debug = freeleech = imageURL = tags = inputfile = artists = contributingartists = title = None
|
|
|
dryrun = debug = freeleech = imageURL = tags = inputfile = artists = contributingartists = title = None
|
|
|
originalartist = originaltitle = description = sub = language = year = mediasource = releasetype = None
|
|
|
|
|
|
|
|
|
originalartist = originaltitle = description = editiontitle = editionyear = sub = language = year = mediasource = releasetype = screenshots = None
|
|
|
inputfile = args.input
|
|
|
inputfile = args.input
|
|
|
|
|
|
|
|
|
description = args.description
|
|
|
description = args.description
|
|
@@ -409,11 +436,17 @@ if __name__ == "__main__": |
|
|
if args.originaltitle:
|
|
|
if args.originaltitle:
|
|
|
originaltitle = args.originaltitle
|
|
|
originaltitle = args.originaltitle
|
|
|
|
|
|
|
|
|
|
|
|
if args.editiontitle:
|
|
|
|
|
|
editiontitle = args.editiontitle
|
|
|
|
|
|
|
|
|
if args.language:
|
|
|
if args.language:
|
|
|
language = args.language
|
|
|
language = args.language
|
|
|
|
|
|
|
|
|
if args.year:
|
|
|
if args.year:
|
|
|
year = args.year
|
|
|
year = args.year
|
|
|
|
|
|
|
|
|
|
|
|
if args.editionyear:
|
|
|
|
|
|
editionyear = args.editionyear
|
|
|
|
|
|
|
|
|
if args.sub:
|
|
|
if args.sub:
|
|
|
sub = args.sub
|
|
|
sub = args.sub
|
|
@@ -424,6 +457,9 @@ if __name__ == "__main__": |
|
|
if args.tags:
|
|
|
if args.tags:
|
|
|
tags = args.tags
|
|
|
tags = args.tags
|
|
|
|
|
|
|
|
|
|
|
|
if args.screenshots:
|
|
|
|
|
|
screenshots = args.screenshots
|
|
|
|
|
|
|
|
|
releasedata = gatherdata()
|
|
|
releasedata = gatherdata()
|
|
|
releasedata_and_mediainfo = add_mediainfo_to_releasedata(inputfile, releasedata)
|
|
|
releasedata_and_mediainfo = add_mediainfo_to_releasedata(inputfile, releasedata)
|
|
|
if debug:
|
|
|
if debug:
|
|
|