fix/musify_artist_spam #27

Merged
Hazel merged 6 commits from fix/musify_artist_spam into experimental 2024-05-08 10:31:24 +00:00
3 changed files with 9 additions and 5 deletions
Showing only changes of commit 9d4e3e8545 - Show all commits

View File

@ -7,7 +7,8 @@ logging.getLogger().setLevel(logging.DEBUG)
if __name__ == "__main__":
commands = [
"s: #a Crystal F",
"10"
"10",
"2",
]

View File

@ -378,13 +378,13 @@ class Downloader:
continue
i = 0
if possible_index.isdigit():
try:
i = int(possible_index)
else:
except ValueError:
raise MKInvalidInputException(message=f"The index \"{possible_index}\" is not a number.")
if i < 0 and i >= len(self.current_results):
raise MKInvalidInputException(message=f"The index \"{i}\" is not within the bounds of 0-{len(self.current_results)}.")
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)

View File

@ -28,6 +28,9 @@ class Results:
self._by_index = dict()
self._page_by_index = dict()
def __len__(self) -> int:
return max(self._by_index.keys())
def __getitem__(self, index: int):
return self._by_index[index]