Downvoted argument added to ./script.py's parser, programMode and Attributes dictonary.

This commit is contained in:
2019-12-23 01:10:06 +01:00
parent d6194c57d9
commit f32d17796a
2 changed files with 21 additions and 3 deletions

View File

@@ -114,6 +114,10 @@ def parseArguments(arguments=[]):
action="store_true", action="store_true",
help="Gets upvoted posts of --user") help="Gets upvoted posts of --user")
parser.add_argument("--downvoted",
action="store_true",
help="Gets downvoted posts of --user")
parser.add_argument("--log", parser.add_argument("--log",
help="Takes a log file which created by itself " \ help="Takes a log file which created by itself " \
"(json files), reads posts and tries downloadin" \ "(json files), reads posts and tries downloadin" \
@@ -187,7 +191,7 @@ def checkConflicts():
search = 1 if GLOBAL.arguments.search else 0 search = 1 if GLOBAL.arguments.search else 0
modes = [ modes = [
"saved","subreddit","submitted","log","link","upvoted","multireddit" "saved","subreddit","submitted","log","link","upvoted","downvoted","multireddit"
] ]
values = { values = {
@@ -241,7 +245,7 @@ class PromptUser:
print("select program mode:") print("select program mode:")
programModes = [ programModes = [
"search","subreddit","multireddit", "search","subreddit","multireddit",
"submitted","upvoted","saved","log" "submitted","upvoted","downvoted","saved","log"
] ]
programMode = self.chooseFrom(programModes) programMode = self.chooseFrom(programModes)
@@ -346,6 +350,10 @@ class PromptUser:
GLOBAL.arguments.upvoted = True GLOBAL.arguments.upvoted = True
GLOBAL.arguments.user = input("\nredditor: ") GLOBAL.arguments.user = input("\nredditor: ")
elif programMode == "downvoted":
GLOBAL.arguments.downvoted = True
GLOBAL.arguments.user = input("\nredditor: ")
elif programMode == "saved": elif programMode == "saved":
GLOBAL.arguments.saved = True GLOBAL.arguments.saved = True
@@ -419,6 +427,9 @@ def prepareAttributes():
elif GLOBAL.arguments.upvoted is True: elif GLOBAL.arguments.upvoted is True:
ATTRIBUTES["upvoted"] = True ATTRIBUTES["upvoted"] = True
elif GLOBAL.arguments.downvoted is True:
ATTRIBUTES["downvoted"] = True
elif GLOBAL.arguments.submitted is not None: elif GLOBAL.arguments.submitted is not None:
ATTRIBUTES["submitted"] = True ATTRIBUTES["submitted"] = True

View File

@@ -92,7 +92,7 @@ def LinkParser(LINK):
if index == 0: if index == 0:
RESULT["subreddit"] = "frontpage" RESULT["subreddit"] = "frontpage"
elif SplittedLink[index] in ["submitted","saved","posts","upvoted"]: elif SplittedLink[index] in ["submitted","saved","posts","upvoted","downvoted"]:
if SplittedLink[index] == "submitted" or \ if SplittedLink[index] == "submitted" or \
SplittedLink[index] == "posts": SplittedLink[index] == "posts":
RESULT["submitted"] = {} RESULT["submitted"] = {}
@@ -103,6 +103,9 @@ def LinkParser(LINK):
elif SplittedLink[index] == "upvoted": elif SplittedLink[index] == "upvoted":
RESULT["upvoted"] = True RESULT["upvoted"] = True
elif SplittedLink[index] == "downvoted":
RESULT["downvoted"] = True
elif "?" in SplittedLink[index]: elif "?" in SplittedLink[index]:
ParsedQuery = QueryParser(SplittedLink[index],index) ParsedQuery = QueryParser(SplittedLink[index],index)
if ParsedQuery["HEADER"] == "search": if ParsedQuery["HEADER"] == "search":
@@ -119,6 +122,7 @@ def LinkParser(LINK):
RESULT["queries"] = ParsedQuery RESULT["queries"] = ParsedQuery
if not ("upvoted" in RESULT or \ if not ("upvoted" in RESULT or \
"downvoted" in RESULT or \
"saved" in RESULT or \ "saved" in RESULT or \
"submitted" in RESULT or \ "submitted" in RESULT or \
"multireddit" in RESULT) and \ "multireddit" in RESULT) and \
@@ -222,6 +226,9 @@ def LinkDesigner(LINK):
elif "upvoted" in attributes: elif "upvoted" in attributes:
MODE["upvoted"] = True MODE["upvoted"] = True
elif "downvoted" in attributes:
MODE["downvoted"] = True
elif "multireddit" in attributes: elif "multireddit" in attributes:
MODE["multireddit"] = attributes["multireddit"] MODE["multireddit"] = attributes["multireddit"]