Compare commits
No commits in common. "ab61ff7e9b230f27e056f4653c7aea86aed47fee" and "e87075a8097b83838f049b6f0504ff25d0bc809f" have entirely different histories.
ab61ff7e9b
...
e87075a809
@ -354,41 +354,37 @@ class Downloader:
|
||||
command, query = _[0], ":".join(_[1:])
|
||||
|
||||
do_search = "s" in command
|
||||
do_fetch = "f" in command
|
||||
do_download = "d" in command
|
||||
do_merge = "m" in command
|
||||
|
||||
if do_search and (do_download or do_fetch or do_merge):
|
||||
raise MKInvalidInputException(message="You can't search and do another operation at the same time.")
|
||||
if do_search and do_download:
|
||||
raise MKInvalidInputException(message="You can't search and download at the same time.")
|
||||
|
||||
if do_search and do_merge:
|
||||
raise MKInvalidInputException(message="You can't search and merge at the same time.")
|
||||
|
||||
if do_search:
|
||||
self.search(":".join(input_str.split(":")[1:]))
|
||||
return False
|
||||
|
||||
def get_selected_objects(q: str):
|
||||
if q.strip().lower() == "all":
|
||||
return list(self.current_results)
|
||||
indices = []
|
||||
for possible_index in query.split(","):
|
||||
possible_index = possible_index.strip()
|
||||
if possible_index == "":
|
||||
continue
|
||||
|
||||
i = 0
|
||||
try:
|
||||
i = int(possible_index)
|
||||
except ValueError:
|
||||
raise MKInvalidInputException(message=f"The index \"{possible_index}\" is not a number.")
|
||||
|
||||
indices = []
|
||||
for possible_index in q.split(","):
|
||||
possible_index = possible_index.strip()
|
||||
if possible_index == "":
|
||||
continue
|
||||
|
||||
i = 0
|
||||
try:
|
||||
i = int(possible_index)
|
||||
except ValueError:
|
||||
raise MKInvalidInputException(message=f"The index \"{possible_index}\" is not a number.")
|
||||
if i < 0 or i >= len(self.current_results):
|
||||
raise MKInvalidInputException(message=f"The index \"{i}\" is not within the bounds of 0-{len(self.current_results) - 1}.")
|
||||
|
||||
indices.append(i)
|
||||
|
||||
if i < 0 or i >= len(self.current_results):
|
||||
raise MKInvalidInputException(message=f"The index \"{i}\" is not within the bounds of 0-{len(self.current_results) - 1}.")
|
||||
|
||||
indices.append(i)
|
||||
|
||||
return [self.current_results[i] for i in indices]
|
||||
|
||||
selected_objects = get_selected_objects(query)
|
||||
selected_objects = [self.current_results[i] for i in indices]
|
||||
|
||||
if do_merge:
|
||||
old_selected_objects = selected_objects
|
||||
@ -401,13 +397,6 @@ class Downloader:
|
||||
|
||||
selected_objects = [a]
|
||||
|
||||
if do_fetch:
|
||||
for data_object in selected_objects:
|
||||
self.pages.fetch_details(data_object)
|
||||
|
||||
self.print_current_options()
|
||||
return False
|
||||
|
||||
if do_download:
|
||||
self.download(selected_objects)
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user