Add OP's name first
This commit is contained in:
parent
93732b0367
commit
9d0fdc7521
2 changed files with 29 additions and 26 deletions
|
@ -423,11 +423,10 @@ def postFromLog(fileName):
|
||||||
|
|
||||||
return posts
|
return posts
|
||||||
|
|
||||||
def postExists(POST):
|
def isPostExists(POST):
|
||||||
"""Figure out a file's name and checks if the file already exists"""
|
"""Figure out a file's name and checks if the file already exists"""
|
||||||
|
|
||||||
title = nameCorrector(POST['postTitle'])
|
title = nameCorrector(POST['postTitle'])
|
||||||
FILENAME = title + "_" + POST['postId'] + "_" + POST["postSubmitter"]
|
|
||||||
PATH = GLOBAL.directory / POST["postSubreddit"]
|
PATH = GLOBAL.directory / POST["postSubreddit"]
|
||||||
|
|
||||||
possibleExtensions = [".jpg",".png",".mp4",".gif",".webm",".md"]
|
possibleExtensions = [".jpg",".png",".mp4",".gif",".webm",".md"]
|
||||||
|
@ -440,9 +439,9 @@ def postExists(POST):
|
||||||
+ extension
|
+ extension
|
||||||
)
|
)
|
||||||
FILE_PATH = PATH / (
|
FILE_PATH = PATH / (
|
||||||
title
|
POST["postSubmitter"]
|
||||||
|
+ "_" + title
|
||||||
+ "_" + POST['postId']
|
+ "_" + POST['postId']
|
||||||
+ "_" + POST["postSubmitter"]
|
|
||||||
+ extension
|
+ extension
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -539,7 +538,7 @@ def download(submissions):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if postExists(submissions[i]):
|
if isPostExists(submissions[i]):
|
||||||
print(submissions[i]['postType'].upper())
|
print(submissions[i]['postType'].upper())
|
||||||
print("It already exists")
|
print("It already exists")
|
||||||
duplicates += 1
|
duplicates += 1
|
||||||
|
|
|
@ -87,13 +87,13 @@ class Erome:
|
||||||
extension = getExtension(IMAGES[0])
|
extension = getExtension(IMAGES[0])
|
||||||
|
|
||||||
title = nameCorrector(post['postTitle'])
|
title = nameCorrector(post['postTitle'])
|
||||||
print(title+"_" +post['postId']+extension)
|
print(post["postSubmitter"]+"_"+title+"_"+post['postId']+extension)
|
||||||
|
|
||||||
fileDir = directory / (
|
fileDir = directory / (
|
||||||
title+"_"+POST["postSubmitter"]+"_"+POST['postId']+extension
|
POST["postSubmitter"]+"_"+title+"_"+POST['postId']+extension
|
||||||
)
|
)
|
||||||
tempDir = directory / (
|
tempDir = directory / (
|
||||||
title+"_"+POST["postSubmitter"]+"_"+POST['postId']+".tmp"
|
POST["postSubmitter"]+"_"+title+"_"+POST['postId']+".tmp"
|
||||||
)
|
)
|
||||||
|
|
||||||
imageURL = "https:" + IMAGES[0]
|
imageURL = "https:" + IMAGES[0]
|
||||||
|
@ -107,10 +107,10 @@ class Erome:
|
||||||
|
|
||||||
else:
|
else:
|
||||||
title = nameCorrector(post['postTitle'])
|
title = nameCorrector(post['postTitle'])
|
||||||
print(title+"_"+post['postId'],end="\n\n")
|
print(post["postSubmitter"]+"_"+title+"_"+post['postId'],end="\n\n")
|
||||||
|
|
||||||
folderDir = directory / (
|
folderDir = directory / (
|
||||||
title + "_" + post["postSubmitter"] + "_" + post['postId']
|
post["postSubmitter"] + "_" + title + "_" + post['postId']
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -216,18 +216,18 @@ class Imgur:
|
||||||
post['postExt'] = getExtension(post['mediaURL'])
|
post['postExt'] = getExtension(post['mediaURL'])
|
||||||
|
|
||||||
title = nameCorrector(post['postTitle'])
|
title = nameCorrector(post['postTitle'])
|
||||||
print(title+"_" +post['postId']+post['postExt'])
|
print(post["postSubmitter"]+"_"+title+"_"+post['postId']+post['postExt'])
|
||||||
|
|
||||||
fileDir = directory / (
|
fileDir = directory / (
|
||||||
title
|
post["postSubmitter"]
|
||||||
+ "_" + post["postSubmitter"]
|
+ "_" + title
|
||||||
+ "_" + post['postId']
|
+ "_" + post['postId']
|
||||||
+ post['postExt']
|
+ post['postExt']
|
||||||
)
|
)
|
||||||
|
|
||||||
tempDir = directory / (
|
tempDir = directory / (
|
||||||
title
|
post["postSubmitter"]
|
||||||
+ "_" + post["postSubmitter"]
|
+ "_" + title
|
||||||
+ "_" + post['postId']
|
+ "_" + post['postId']
|
||||||
+ ".tmp"
|
+ ".tmp"
|
||||||
)
|
)
|
||||||
|
@ -247,10 +247,10 @@ class Imgur:
|
||||||
duplicates = 0
|
duplicates = 0
|
||||||
|
|
||||||
title = nameCorrector(post['postTitle'])
|
title = nameCorrector(post['postTitle'])
|
||||||
print(title+"_"+post['postId'],end="\n\n")
|
print(post["postSubmitter"]+"_"+title+"_"+post['postId'],end="\n\n")
|
||||||
|
|
||||||
folderDir = directory / (
|
folderDir = directory / (
|
||||||
title + "_" + post["postSubmitter"] + "_" + post['postId']
|
post["postSubmitter"] + "_" + title + "_" + post['postId']
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -369,13 +369,13 @@ class Gfycat:
|
||||||
|
|
||||||
if not os.path.exists(directory): os.makedirs(directory)
|
if not os.path.exists(directory): os.makedirs(directory)
|
||||||
title = nameCorrector(POST['postTitle'])
|
title = nameCorrector(POST['postTitle'])
|
||||||
print(title+"_"+POST['postId']+POST['postExt'])
|
print(POST["postSubmitter"]+"_"+title+"_"+POST['postId']+POST['postExt'])
|
||||||
|
|
||||||
fileDir = directory / (
|
fileDir = directory / (
|
||||||
title+"_"+POST["postSubmitter"]+"_"+POST['postId']+POST['postExt']
|
POST["postSubmitter"]+"_"+title+"_"+POST['postId']+POST['postExt']
|
||||||
)
|
)
|
||||||
tempDir = directory / (
|
tempDir = directory / (
|
||||||
title+"_"+POST["postSubmitter"]+"_"+POST['postId']+".tmp"
|
POST["postSubmitter"]+"_"+title+"_"+POST['postId']+".tmp"
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -423,13 +423,13 @@ class Direct:
|
||||||
POST['postExt'] = getExtension(POST['postURL'])
|
POST['postExt'] = getExtension(POST['postURL'])
|
||||||
if not os.path.exists(directory): os.makedirs(directory)
|
if not os.path.exists(directory): os.makedirs(directory)
|
||||||
title = nameCorrector(POST['postTitle'])
|
title = nameCorrector(POST['postTitle'])
|
||||||
print(title+"_"+POST['postId']+POST['postExt'])
|
print(POST["postSubmitter"]+"_"+title+"_"+POST['postId']+POST['postExt'])
|
||||||
|
|
||||||
fileDir = directory / (
|
fileDir = directory / (
|
||||||
title+"_"+POST["postSubmitter"]+"_"+POST['postId']+POST['postExt']
|
POST["postSubmitter"]+"_"+title+"_"+POST['postId']+POST['postExt']
|
||||||
)
|
)
|
||||||
tempDir = directory / (
|
tempDir = directory / (
|
||||||
title+"_"+POST["postSubmitter"]+"_"+POST['postId']+".tmp"
|
POST["postSubmitter"]+"_"+title+"_"+POST['postId']+".tmp"
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -445,10 +445,10 @@ class Self:
|
||||||
if not os.path.exists(directory): os.makedirs(directory)
|
if not os.path.exists(directory): os.makedirs(directory)
|
||||||
|
|
||||||
title = nameCorrector(post['postTitle'])
|
title = nameCorrector(post['postTitle'])
|
||||||
print(title+"_"+post['postId']+".md")
|
print(post["postSubmitter"]+"_"+title+"_"+post['postId']+".md")
|
||||||
|
|
||||||
fileDir = directory / (
|
fileDir = directory / (
|
||||||
title+"_"+POST["postSubmitter"]+"_"+POST['postId']+".md"
|
post["postSubmitter"]+"_"+title+"_"+post['postId']+".md"
|
||||||
)
|
)
|
||||||
|
|
||||||
if Path.is_file(fileDir):
|
if Path.is_file(fileDir):
|
||||||
|
@ -472,7 +472,11 @@ class Self:
|
||||||
+ ")\n"
|
+ ")\n"
|
||||||
+ post["postContent"]
|
+ post["postContent"]
|
||||||
+ "\n\n---\n\n"
|
+ "\n\n---\n\n"
|
||||||
+ "submitted by [u/"
|
+ "submitted to [r/"
|
||||||
|
+ post["postSubreddit"]
|
||||||
|
+ "](https://www.reddit.com/r/"
|
||||||
|
+ post["postSubreddit"]
|
||||||
|
+ ") by [u/"
|
||||||
+ post["postSubmitter"]
|
+ post["postSubmitter"]
|
||||||
+ "](https://www.reddit.com/user/"
|
+ "](https://www.reddit.com/user/"
|
||||||
+ post["postSubmitter"]
|
+ post["postSubmitter"]
|
||||||
|
|
Loading…
Reference in a new issue