From a473bcb59cac5c3a5ea06a17818938ca79492148 Mon Sep 17 00:00:00 2001 From: sharky555 Date: Thu, 5 May 2022 17:48:43 -0600 Subject: [PATCH 1/2] torrentdescriptiontest updated --- copycommand.txt | 1 - copycommand.txt.example | 2 +- torrentdescription.txt | 1 + torrentgroupdescription.txt | 1 + upload.py | 28 ++++++++++++++++++++++++++-- 5 files changed, 29 insertions(+), 4 deletions(-) delete mode 100644 copycommand.txt create mode 100644 torrentdescription.txt create mode 100644 torrentgroupdescription.txt diff --git a/copycommand.txt b/copycommand.txt deleted file mode 100644 index 913f68b..0000000 --- a/copycommand.txt +++ /dev/null @@ -1 +0,0 @@ -python upload.py -i "C:\file.ts" --releasetype "PV" --artist "" --title "" --tags "pop" --year "2022" --mediasource "HDTV" --imagepath "C:\file.ts_thumbs_[2022.04.29_19.06.07].jpg" --torrentgroupdescription "a long description!!!!" --torrentdescription "placeholder" diff --git a/copycommand.txt.example b/copycommand.txt.example index 7ea1ea1..da7012d 100644 --- a/copycommand.txt.example +++ b/copycommand.txt.example @@ -1,2 +1,2 @@ -python upload.py -i "C:\path to file" --releasetype "PV" --artist "" --title "" --tags "" --year "" --mediasource "" --imagepath "C:\path to image" --torrentgroupdescription "a long description!!!!" --torrentdescription "placeholder" +python upload.py -i "C:\path to file" --releasetype "PV" --artist "" --title "" --tags "" --year "" --mediasource "" --imagepath "C:\path to image" --torrentgroupdescription "torrentgroupdescription.txt" --torrentdescription "torrentdescription.txt" \ No newline at end of file diff --git a/torrentdescription.txt b/torrentdescription.txt new file mode 100644 index 0000000..48430a1 --- /dev/null +++ b/torrentdescription.txt @@ -0,0 +1 @@ +enter your torrent description here \ No newline at end of file diff --git a/torrentgroupdescription.txt b/torrentgroupdescription.txt new file mode 100644 index 0000000..6698dcb --- /dev/null +++ b/torrentgroupdescription.txt @@ -0,0 +1 @@ +enter your torrent group description here \ No newline at end of file diff --git a/upload.py b/upload.py index 7153c70..43b04cb 100644 --- a/upload.py +++ b/upload.py @@ -504,6 +504,25 @@ def localfileorganization(torrent, directory, watch_folder, downloads_folder): if cfg['local_prefs']['add_to_watch_folder']: os.rename(torrent, f"{watch_folder}/{torrent}") +def addnewline(text): + text = re.sub(r"\\n", "\n", text) + +def gettorrentgroupdescription(textfile): + result = "" + with open(textfile,encoding='utf8') as f: + lines = f.readlines() + for line in lines: + result += line + return result + +def gettorrentdescription(textfile): + result = "" + with open(textfile,encoding='utf8') as f: + lines = f.readlines() + for line in lines: + result += line + return result + if __name__ == "__main__": asciiart() @@ -514,8 +533,11 @@ if __name__ == "__main__": originalartist = originaltitle = torrentdescription = torrentgroupdescription = editiontitle = editionyear = year = mediasource = releasetype = None inputfile = args.input - torrentgroupdescription = args.torrentgroupdescription - torrentdescription = args.torrentdescription + # torrentgroupdescription = args.torrentgroupdescription + # torrentdescription = args.torrentdescription + torrentgroupdescription = gettorrentgroupdescription(args.torrentgroupdescription) + torrentdescription = gettorrentdescription(args.torrentdescription) + if args.dryrun: dryrun = True @@ -581,6 +603,8 @@ if __name__ == "__main__": # Identifying cover.jpg path # cover_path = directory + "/" + cfg['local_prefs']['cover_name'] + #= addnewline(releasedata["album_desc"]) + #print(releasedata["album_desc"] ) # Create torrent file. torrentfile = createtorrent(authkey, inputfile, releasedata) -- 2.16.2 From 9b7875d48d7ec35b2a650627b80d93d3a8c21f5c Mon Sep 17 00:00:00 2001 From: sharky555 Date: Sat, 14 May 2022 17:03:01 -0600 Subject: [PATCH 2/2] grammar fixed --- upload.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/upload.py b/upload.py index 43b04cb..1dd2c11 100644 --- a/upload.py +++ b/upload.py @@ -287,7 +287,7 @@ def gatherdata(): if originalartist: releasedata['artistjp'] = originalartist else: - input_artist = input("\n" + "_" * 100 + "\nEnter the original ARTIST name. Press enter to skip if this torrent has the artist name already english or already has a artist page.\n") + input_artist = input("\n" + "_" * 100 + "\nEnter the original ARTIST name. Press enter to skip if this torrent has the artist name already in English or already has a artist page.\n") releasedata['artistjp'] = input_artist if title: -- 2.16.2