Stylize the console output
This commit is contained in:
16
script.py
16
script.py
@@ -465,10 +465,9 @@ def downloadPost(SUBMISSION):
|
|||||||
"imgur":Imgur,"gfycat":Gfycat,"erome":Erome,"direct":Direct,"self":Self
|
"imgur":Imgur,"gfycat":Gfycat,"erome":Erome,"direct":Direct,"self":Self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print()
|
||||||
if SUBMISSION['postType'] in downloaders:
|
if SUBMISSION['postType'] in downloaders:
|
||||||
|
|
||||||
print(SUBMISSION['postType'].upper(),end=" ")
|
|
||||||
|
|
||||||
if SUBMISSION['postType'] == "imgur":
|
if SUBMISSION['postType'] == "imgur":
|
||||||
|
|
||||||
while int(time.time() - lastRequestTime) <= 2:
|
while int(time.time() - lastRequestTime) <= 2:
|
||||||
@@ -483,6 +482,7 @@ def downloadPost(SUBMISSION):
|
|||||||
+ str(int(IMGUR_RESET_TIME%60)) \
|
+ str(int(IMGUR_RESET_TIME%60)) \
|
||||||
+ " Seconds")
|
+ " Seconds")
|
||||||
|
|
||||||
|
if credit['ClientRemaining'] < 25 or credit['UserRemaining'] < 25:
|
||||||
print(
|
print(
|
||||||
"==> Client: {} - User: {} - Reset {}".format(
|
"==> Client: {} - User: {} - Reset {}".format(
|
||||||
credit['ClientRemaining'],
|
credit['ClientRemaining'],
|
||||||
@@ -509,7 +509,6 @@ def downloadPost(SUBMISSION):
|
|||||||
|
|
||||||
raise ImgurLimitError('{} LIMIT EXCEEDED\n'.format(KEYWORD.upper()))
|
raise ImgurLimitError('{} LIMIT EXCEEDED\n'.format(KEYWORD.upper()))
|
||||||
|
|
||||||
print()
|
|
||||||
downloaders[SUBMISSION['postType']] (directory,SUBMISSION)
|
downloaders[SUBMISSION['postType']] (directory,SUBMISSION)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -531,17 +530,13 @@ def download(submissions):
|
|||||||
FAILED_FILE = createLogFile("FAILED")
|
FAILED_FILE = createLogFile("FAILED")
|
||||||
|
|
||||||
for i in range(subsLenght):
|
for i in range(subsLenght):
|
||||||
print("\n({}/{})".format(i+1,subsLenght))
|
|
||||||
print(
|
print(
|
||||||
"https://reddit.com/r/{subreddit}/comments/{id}".format(
|
f"\n({i+1}/{subsLenght}) ({submissions[i]['postType'].upper()}) " \
|
||||||
subreddit=submissions[i]['postSubreddit'],
|
f"(r/{submissions[i]['postSubreddit']})",end=""
|
||||||
id=submissions[i]['postId']
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if isPostExists(submissions[i]):
|
if isPostExists(submissions[i]):
|
||||||
print(submissions[i]['postType'].upper())
|
print("\nIt already exists")
|
||||||
print("It already exists")
|
|
||||||
duplicates += 1
|
duplicates += 1
|
||||||
downloadedCount -= 1
|
downloadedCount -= 1
|
||||||
continue
|
continue
|
||||||
@@ -684,7 +679,6 @@ if __name__ == "__main__":
|
|||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
if GLOBAL.directory is None:
|
if GLOBAL.directory is None:
|
||||||
GLOBAL.directory = Path(".\\")
|
GLOBAL.directory = Path(".\\")
|
||||||
print("\nQUITTING...")
|
|
||||||
|
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
if GLOBAL.directory is None:
|
if GLOBAL.directory is None:
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ def getPosts(args):
|
|||||||
if args["user"] == "me":
|
if args["user"] == "me":
|
||||||
args["user"] = str(reddit.user.me())
|
args["user"] = str(reddit.user.me())
|
||||||
|
|
||||||
print("\nGETTING POSTS\n.\n.\n.\n")
|
# print("\nGETTING POSTS\n.\n.\n.\n")
|
||||||
|
|
||||||
if not "search" in args:
|
if not "search" in args:
|
||||||
if args["sort"] == "top" or args["sort"] == "controversial":
|
if args["sort"] == "top" or args["sort"] == "controversial":
|
||||||
|
|||||||
Reference in New Issue
Block a user