Исправление установки ресурс и шейдер паков. Выбрасывание ошибки при попутки установки модпака - требуется изучить как повлияло изменение процесса установки

This commit is contained in:
Евгений Титаренко 2023-07-23 14:15:53 +03:00
parent 5beb835d1e
commit 9c7819dfbd

View file

@ -74,15 +74,25 @@ def install(projects: list, version, loader):
for project in projects_ids:
project_data = api.project(project=project)
versions = api.get_versions(project=project, loaders=f'["{loader}"]',
game_versions=f'["{mc_ver}"]')
match project_data.project_type:
case "resourcepack":
versions = api.get_versions(project=project, game_versions=f'["{mc_ver}"]')
case "mod":
versions = api.get_versions(project=project, loaders=f'["{loader}"]', game_versions=f'["{mc_ver}"]')
case "shader": # TODO: Реализовать поддержку загрузчиков шейдеров
versions = api.get_versions(project=project, game_versions=f'["{mc_ver}"]')
case "modpack": # TODO: [РЕГРЕССИЯ] Реализовать поддержку модпаков
raise NotImplementedError
case _:
raise NotImplementedError
if versions:
to_install.append((project_data, versions[0]))
dependency_solver(versions[0])
else:
unavailable.append(project_data)
print("To install:", *[project.title + " " + version.version_number for project, version in to_install], sep="\n\t")
if to_install:
print("To install:", *[project.title + " " + version.version_number for project, version in to_install], sep="\n\t")
if dependencies_to_install:
print("With dependencies:",
*[project.title + " " + version.version_number for project, version in dependencies_to_install],
@ -93,14 +103,19 @@ def install(projects: list, version, loader):
if unavailable:
print("Cannot be installed:", *[project.title for project in unavailable], sep="\n\t")
choose = input("Continue? [y/n]")
all_to_install = to_install + dependencies_to_install
if not all_to_install:
return
choose = input("Continue? [y/n] ")
if choose.strip().lower() in ["n", "no"]:
print("Canceled.")
return
for project, version in to_install + dependencies_to_install:
for project, version in all_to_install:
file = type("mc_file", (object,), version.files[0])
filename = project.slug + ".jar"
filename = file.filename
download_cache(file.url, filename, file.size)
match project.project_type:
case "resourcepack":