From 7dd36a8360a2108a0c9417760468916f1791610b Mon Sep 17 00:00:00 2001 From: sharky555 Date: Sun, 3 Oct 2021 17:31:38 -0600 Subject: [PATCH] added screenshot arg --- copycommand.txt | 2 +- upload.py | 62 +++++++++++++++++++++++++++++++++++++++++++++------------ 2 files changed, 50 insertions(+), 14 deletions(-) diff --git a/copycommand.txt b/copycommand.txt index 6e36e32..704ecc6 100644 --- a/copycommand.txt +++ b/copycommand.txt @@ -1 +1 @@ -python upload.py -i "C:\path to file" --artists "" --title "" --tags "" --mediasource "HDTV" --releasetype "PV" --sub "NoSubs" --language "Japanese" --year "" --description "a long description!!!!" +python upload.py -i "C:\path to file" --artists "" --title "" --tags "" --mediasource "HDTV" --releasetype "PV" --sub "NoSubs" --language "Japanese" --year "" --description "a long description!!!!" --screenshots "" diff --git a/upload.py b/upload.py index ddccec4..016a077 100644 --- a/upload.py +++ b/upload.py @@ -55,6 +55,9 @@ def getargs(): 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("-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() @@ -97,9 +100,27 @@ def gatherdata(): if originaltitle: releasedata['title_jp'] = originaltitle 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 + 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: releasedata["sub"] = sub else: @@ -154,11 +175,7 @@ def gatherdata(): break 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: input_tags = tags else: @@ -199,6 +216,16 @@ def gatherdata(): break 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 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 != True: 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;">(.*)

', SMres.text) - SMerrorLogon = re.findall('

Invalid (.*)

', SMres.text) - if SMerrorTorrent == None: - print("Upload failed.") + # SMerrorLogon = re.findall('

Invalid (.*)

', SMres.text) + if len(SMerrorTorrent)!=0: + print("Upload failed. Torrent error") 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 #print(JPSres.text) @@ -375,7 +402,7 @@ if __name__ == "__main__": # TODO consider calling args[] directly, we will then not need this line 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 description = args.description @@ -409,11 +436,17 @@ if __name__ == "__main__": if args.originaltitle: originaltitle = args.originaltitle + if args.editiontitle: + editiontitle = args.editiontitle + if args.language: language = args.language if args.year: year = args.year + + if args.editionyear: + editionyear = args.editionyear if args.sub: sub = args.sub @@ -424,6 +457,9 @@ if __name__ == "__main__": if args.tags: tags = args.tags + if args.screenshots: + screenshots = args.screenshots + releasedata = gatherdata() releasedata_and_mediainfo = add_mediainfo_to_releasedata(inputfile, releasedata) if debug: