diff --git a/README.md b/README.md index 6b83f8f..27bfae1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ -Rewriting for use for uploading video torrents to sugoimusic ## Overview -**SM-AU-TV** is a tool for automating the uploading process on sugoimusic.me. +**SM-AU-TV** is a tool for automating the uploading process of videos on sugoimusic.me. This tool automatically generates the MediaInfo for the upload. Other information must be manually filled in as arguments. **Installation:** - Install requirements @@ -20,33 +19,32 @@ Command | Description -i [INPUT], --input [INPUT] | Initiate upload on input file. This must be added as an argument. -d, --debug | Enable debug mode. -dry, --dryrun | Dryrun will carry out all actions other than the actual upload to SM. +-rt [RELEASETYPE], --releasetype [RELEASETYPE] | Set the release type. -a [ARTISTS], --artists [ARTISTS] | Set the artists. (Romaji\English). Split multiple with "," -oa [ORIGINALARTIST], --originalartist [ORIGINALARTIST] | Set the artist. (Original Language) -ca [CONTRIBUTINGARTISTS], --contributingartists [CONTRIBUTINGARTISTS] | Set the contributing artists. (Romaji\English). Split multiple with "," -ti [TITLE], --title [TITLE] | Set the title. (Romaji\English) -oti [ORIGINALTITLE], --originaltitle [ORIGINALTITLE] | Set the title. (Original Language) --des [DESCRIPTION], --description [DESCRIPTION] | Add a torrent description. This must be added as an argument. -t [TAGS], --tags [TAGS] | Add additional tags to the upload. At least 2 tags are required --im [IMAGEURL], --imageURL [IMAGEURL] | Set the torrent cover URL. +-y [YEAR], --year [YEAR] | Set the torrent year (YYYYMMDD or YYYY). +-eti [EDITIONTITLE], --editiontitle [EDITIONTITLE] | Set the edition title. -ms [MEDIASOURCE], --mediasource [MEDIASOURCE] | Set the media source. --rt [RELEASETYPE], --releasetype [RELEASETYPE] | Set the release type. -s [SUB], --sub [SUB] | Set the subtitle type. -l [LANGUAGE], --language [LANGUAGE] | Set the language --y [YEAR], --year [YEAR] | Set the torrent year (YYYYMMDD or YYYY). --eti [EDITIONTITLE], --editiontitle [EDITIONTITLE] | Set the edition title. -ey [EDITIONYEAR], --year [EDITIONYEAR] | Set the edition year (YYYYMMDD or YYYY). +-im [IMAGEURL], --imageURL [IMAGEURL] | Set the torrent cover URL. -ss [SCREENSHOTURLS], --screenshots [SCREENSHOTURLS] | Set the screenshot URLs. Split multiple with "," --f, --freeleech | Enables freeleech. +-tdes [TORRENTDESCRIPTION], --description [TORRENTDESCRIPTION] | Add a torrent description. Only available as an argument. +-tgdes [TORRENTGROUPDESCRIPTION], --description [TORRENTGROUPDESCRIPTION] | Add a torrent group description. This must be added as an argument. -## Config.json -- It's not recommended to use both local watch/download folders and ftp watch/download folders at the same time as it will result in seeding from 2 locations. +## Config.json **credentials:** Config | Description | Example ------------- | ------------- | ------------- -Username | SugoiMusic Username | Slyy +Username | SugoiMusic Username | Username Password | SugoiMusic Password | Password Passkey | SugoiMusic Passkey | Passkey @@ -54,27 +52,7 @@ Passkey | SugoiMusic Passkey | Passkey Config | Description | Example ------------- | ------------- | ------------- -log_directory | directory containing BugsPy log files | `Z:/Bugs/Logs` -generate_tracklist | enable tracklist generation | `true/false` -save_tracklist | write tracklist to .log and save in log folder | `true/false` -enable_release_description | post comments tag to release description | `true/false` -cover_name | name of cover with extension | `cover.jpg` add_to_watch_folder | moves .torrent file to local watch folder | `true/false` -add_to_downloads_folder | moves torrent data to local downloads folder | `true/false` -local_watch_folder | directory of local watch folder | `Z:/watch/Transmission` -local_downloads_folder | directory of local downloads folder | `Z:/downloads` - +local_watch_folder | directory of local watch folder | `Z:/watch/Transmission` -**ftp_prefs:** - -Config | Description | Example -------------- | ------------- | ------------- -enable_ftp | enable ftp mode, if enabled suggested to disable local watch and downloads folders | `true/false` -add_to_watch_folder | transfer .torrent file to watch folder on FTP server | `true/false` -add_to_downloads_folder | transfer torrent data to downloads folder on FTP server | `true/false` -ftp_server | url of ftp server | bestboxever.seedhost.eu -ftp_username | username of ftp account | slyy -ftp_password | password of ftp account | password -ftp_watch_folder | directory of ftp watch folder | `/downloads/watch/transmission` -ftp_downloads_folder | directory of ftp downloads folder | `/downloads` diff --git a/copycommand.txt b/copycommand.txt index 704ecc6..433b691 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!!!!" --screenshots "" +python upload.py -i "C:\path to file" --releasetype "PV" --artists "" --title "" --tags "" --year "" --mediasource "HDTV" --sub "NoSubs" --language "Japanese" --imageurl "" --torrentgroupdescription "a long description!!!!" diff --git a/json_data/config.json.example b/json_data/config.json.example index 9ee932f..9d5458d 100644 --- a/json_data/config.json.example +++ b/json_data/config.json.example @@ -5,23 +5,7 @@ "passkey": "passkey" }, "local_prefs": { - "log_directory": "D:/Bugs/BugsPy-master/logs", - "generate_tracklist": true, - "save_tracklist": false, - "enable_release_description": false, - "cover_name": "cover.jpg", "add_to_watch_folder": false, - "add_to_downloads_folder": false, - "local_watch_folder": "C:/watch", - "local_downloads_folder": "C:/downloads" - }, - "ftp_prefs": { - "enable_ftp": false, - "add_to_watch_folder": true, - "add_to_downloads_folder": true, - "ftp_server": "server url", - "ftp_username": "username", - "ftp_password": "password", - "ftp_watch_folder": "/downloads/watch/transmission", - "ftp_downloads_folder": "/downloads" + "local_watch_folder": "C:/watch" } +} diff --git a/upload.py b/upload.py index 3aef7e5..04caf80 100644 --- a/upload.py +++ b/upload.py @@ -41,24 +41,25 @@ def getargs(): parser.add_argument('-i', '--input', help='Initiate upload on input file', nargs='?', required=True) parser.add_argument('-d', '--debug', help='Enable debug mode.', action='store_true') parser.add_argument("-dry", "--dryrun", help="Dryrun will carry out all actions other than the actual upload to SM.", action="store_true") + parser.add_argument("-rt", "--releasetype", help='Set the release type. (PV, Music Performance, TV Music, TV Variety, TV-Drama)', nargs='?') parser.add_argument("-a", "--artists", help='Set the artists. (Romaji\English). Split multiple with ","', nargs='?') parser.add_argument("-oa", "--originalartist", help='Set the artist. (Original Language)', nargs='?') parser.add_argument("-ca", "--contributingartists", help='Set the contributing artists. (Romaji\English). Split multiple with ","', nargs='?') parser.add_argument("-ti", "--title", help='Set the title. (Romaji\English)', nargs='?') parser.add_argument("-oti", "--originaltitle", help='Set the title. (Original Language)', nargs='?') - parser.add_argument("-tdes", "--torrentdescription", help='Add a torrent description', nargs='?') - parser.add_argument("-tgdes", "--torrentgroupdescription", help='Add a torrent group description. This is a required argument.', nargs='?', required=True) parser.add_argument("-t", "--tags", help="Add additional tags to the upload. At least 2 tags are required", nargs='?') - parser.add_argument("-im", "--imageURL", help='Set the torrent cover URL.', nargs='?') - parser.add_argument("-ms", "--mediasource", help='Set the media source. ()', nargs='?') - parser.add_argument("-rt", "--releasetype", help='Set the release type. ()', nargs='?') - parser.add_argument("-s", "--sub", help='Set the subtitle type. (NoSubs,Softsubs,Hardsub)', nargs='?') - parser.add_argument("-l", "--language", help='Set the language (Japanese,English,Korean,Chinese,Vietnamese,Other)', 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='?') + parser.add_argument("-ms", "--mediasource", help='Set the media source. (HDTV, Web)', nargs='?') + parser.add_argument("-s", "--sub", help='Set the subtitle type. (NoSubs,Softsubs,Hardsub)', nargs='?') + parser.add_argument("-l", "--language", help='Set the language (Japanese, English, Korean, Chinese, Vietnamese, Other)', nargs='?') + parser.add_argument("-im", "--imageURL", help='Set the torrent cover URL.', nargs='?') + parser.add_argument("-ss", "--screenshots", help='Set the torrent screenshots', nargs='?') + parser.add_argument("-tdes", "--torrentdescription", help='Add a torrent description', nargs='?') + parser.add_argument("-tgdes", "--torrentgroupdescription", help='Add a torrent group description. This is a required argument.', nargs='?', required=True) + return parser.parse_args() @@ -72,6 +73,40 @@ def gatherdata(): releasedata = {"submit": "true"} releasedata["album_desc"] = torrentgroupdescription + if torrentdescription: + releasedata['release_desc'] = torrentdescription + + list_of_types = ["PV", "Music Performance", "TV Music", "TV Variety", "TV-Drama"] + if releasetype in list_of_types: + if releasetype == "PV": + releasedata["type"] = 5 + elif releasetype == "Music Performance": + releasedata["type"] = 6 + elif releasetype == "TV Music": + releasedata["type"] = 7 + elif releasetype == "TV Variety": + releasedata["type"] = 8 + elif releasetype == "TV-Drama": + releasedata["type"] = 9 + else: + while(True): + input_lang = input("\n" + "_" * 100 + "\nEnter a number to choose the upload type. \n1=PV\n2=Music Performance\n3=TV Music\n4=TV Variety\n5=TV-Drama\n") + if input_lang == "1": + releasedata["type"] = 5 + break + elif input_lang == "2": + releasedata["type"] = 6 + break + elif input_lang == "3": + releasedata["type"] = 7 + break + elif input_lang == "4": + releasedata["type"] = 8 + break + elif input_lang == "5": + releasedata["type"] = 9 + break + print("Invalid choice.") if artists: releasedata['idols[]'] = artists else: @@ -178,6 +213,10 @@ def gatherdata(): print("Invalid choice.") + + + + if tags: releasedata["tags"] = tags else: @@ -189,48 +228,14 @@ def gatherdata(): else: print("Please enter at least one tag.") - list_of_types = ["PV", "Music Performance", "TV Music", "TV Variety", "TV-Drama"] - if releasetype in list_of_types: - if releasetype == "PV": - releasedata["type"] = 5 - elif releasetype == "Music Performance": - releasedata["type"] = 6 - elif releasetype == "TV Music": - releasedata["type"] = 7 - elif releasetype == "TV Variety": - releasedata["type"] = 8 - elif releasetype == "TV-Drama": - releasedata["type"] = 9 - else: - while(True): - input_lang = input("\n" + "_" * 100 + "\nEnter a number to choose the upload type. \n1=PV\n2=Music Performance\n3=TV Music\n4=TV Variety\n5=TV-Drama\n") - if input_lang == "1": - releasedata["type"] = 5 - break - elif input_lang == "2": - releasedata["type"] = 6 - break - elif input_lang == "3": - releasedata["type"] = 7 - break - elif input_lang == "4": - releasedata["type"] = 8 - break - elif input_lang == "5": - releasedata["type"] = 9 - break - print("Invalid choice.") - if screenshots: input_screenshots = screenshots else: - input_screenshots = input("\n" + "_" * 100 + "\nEnter the screenshot links. Separate multiple with \",\".Press enter to skip.\n") + input_screenshots = input("\n" + "_" * 100 + "\nEnter the screenshot links. Separate multiple with \",\". Press enter to skip.\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): @@ -397,7 +402,15 @@ def uploadtorrent(torrent, imageURL, releasedata): ## TODO Filter through JPSres.text and create error handling based on responses #print(JPSres.text) -def localfileorganization(torrent, watch_folder): +def localfileorganization(torrent, directory, watch_folder, downloads_folder): + # Move torrent directory to downloads_folder + # if cfg['local_prefs']['add_to_downloads_folder']: + # try: + # os.mkdir(os.path.join(downloads_folder, os.path.basename(directory))) + # except FileExistsError: + # pass + # copytree(directory, os.path.join(downloads_folder, os.path.basename(directory))) + # shutil.rmtree(directory) if cfg['local_prefs']['add_to_watch_folder']: os.rename(torrent, f"{watch_folder}/{torrent}") @@ -407,7 +420,7 @@ if __name__ == "__main__": args = getargs() # TODO consider calling args[] directly, we will then not need this line - dryrun = debug = freeleech = imageURL = tags = inputfile = artists = contributingartists = title = None + dryrun = debug = imageURL = tags = inputfile = artists = contributingartists = title = None originalartist = originaltitle = torrentdescription = torrentgroupdescription = editiontitle = editionyear = sub = language = year = mediasource = releasetype = screenshots = None inputfile = args.input @@ -419,8 +432,8 @@ if __name__ == "__main__": if args.debug: debug = True - if args.freeleech: - freeleech = True + # if args.freeleech: + # freeleech = True if args.imageURL: imageURL = args.imageURL @@ -489,10 +502,10 @@ if __name__ == "__main__": uploadtorrent(torrentfile, imageURL, releasedata_and_mediainfo) # Setting variable for watch/download folders - ftp_watch_folder = cfg['ftp_prefs']['ftp_watch_folder'] - ftp_downloads_folder = cfg['ftp_prefs']['ftp_downloads_folder'] + # ftp_watch_folder = cfg['ftp_prefs']['ftp_watch_folder'] + # ftp_downloads_folder = cfg['ftp_prefs']['ftp_downloads_folder'] local_watch_folder = cfg['local_prefs']['local_watch_folder'] - local_downloads_folder = cfg['local_prefs']['local_downloads_folder'] + # local_downloads_folder = cfg['local_prefs']['local_downloads_folder'] if not dryrun: if cfg['local_prefs']['add_to_watch_folder'] or cfg['local_prefs']['add_to_downloads_folder']: