Initial other project types support
This commit is contained in:
parent
9dbc2b3666
commit
17d02bd27c
2 changed files with 16 additions and 4 deletions
16
mc-get.py
16
mc-get.py
|
@ -11,7 +11,7 @@ def validate():
|
|||
def version_selector_GUI(vers:list, project:str):
|
||||
def form(*args):
|
||||
F = npyscreen.Form(name=f"Select {project} version")
|
||||
sel = F.add(npyscreen.TitleSelectOne, value=[1,], name="versions:",\
|
||||
sel = F.add(npyscreen.TitleSelectOne, value=[0,], name="versions:",\
|
||||
values=[ver.version_number + " for " +\
|
||||
", ".join(ver.game_versions)\
|
||||
for ver in vers[::-1]], scroll_exit=True)
|
||||
|
@ -40,7 +40,19 @@ def install(projects:list):
|
|||
api.download(file.url, file.size, cache_file_path)
|
||||
else:
|
||||
print(f"{filename} is in cache.")
|
||||
mcfs.install(filename)
|
||||
|
||||
subdir = ""
|
||||
match project.project_type:
|
||||
case "resourcepack":
|
||||
subdir = "resourcepacks"
|
||||
case "mod":
|
||||
subdir = "mods"
|
||||
case "shader":
|
||||
subdir = "shaderpacks"
|
||||
case _:
|
||||
raise NotImplementedError
|
||||
|
||||
mcfs.install(filename, subdir)
|
||||
|
||||
def search():
|
||||
pass
|
||||
|
|
4
mcfs.py
4
mcfs.py
|
@ -36,9 +36,9 @@ def is_path_exist(path:str):
|
|||
def is_standart_dir_structure():
|
||||
return not os.path.exists(os.path.join(directory, "home"))
|
||||
|
||||
def install(filename):
|
||||
def install(filename, subdir:str):
|
||||
shutil.copy2(os.path.join(cache_dir,filename),\
|
||||
os.path.join(mc_dir,"mods",filename))
|
||||
os.path.join(mc_dir,subdir,filename))
|
||||
|
||||
mc_dir = __get_mc_dir()
|
||||
cache_dir = __get_cache_dir()
|
||||
|
|
Loading…
Add table
Reference in a new issue