Fix resources dl for melee
parent
18a4b6674e
commit
1fc572debe
|
@ -46,10 +46,10 @@ EVERYONE = [
|
||||||
Character(
|
Character(
|
||||||
smashggid = 4,
|
smashggid = 4,
|
||||||
name = "dr mario",
|
name = "dr mario",
|
||||||
codenames = [ "doc", ],
|
codenames = [ "dr", "doc", ],
|
||||||
res_urls = {
|
res_urls = {
|
||||||
"smashlyon": [
|
"smashlyon": [
|
||||||
"https://resources.smashlyon.com/melee/doc.zip",
|
"https://resources.smashlyon.com/melee/dr.zip",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -86,10 +86,10 @@ EVERYONE = [
|
||||||
Character(
|
Character(
|
||||||
smashggid = 8,
|
smashggid = 8,
|
||||||
name = "ice climbers",
|
name = "ice climbers",
|
||||||
codenames = [ "iceclimber", ],
|
codenames = [ "ice", "iceclimber", ],
|
||||||
res_urls = {
|
res_urls = {
|
||||||
"smashlyon": [
|
"smashlyon": [
|
||||||
"https://resources.smashlyon.com/melee/iceclimber.zip",
|
"https://resources.smashlyon.com/melee/ice.zip",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -246,10 +246,10 @@ EVERYONE = [
|
||||||
Character(
|
Character(
|
||||||
smashggid = 25,
|
smashggid = 25,
|
||||||
name = "young link",
|
name = "young link",
|
||||||
codenames = [ "yink", ],
|
codenames = [ "young", "yink", ],
|
||||||
res_urls = {
|
res_urls = {
|
||||||
"smashlyon": [
|
"smashlyon": [
|
||||||
"https://resources.smashlyon.com/melee/yink.zip",
|
"https://resources.smashlyon.com/melee/young.zip",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -266,10 +266,10 @@ EVERYONE = [
|
||||||
Character(
|
Character(
|
||||||
smashggid = None,
|
smashggid = None,
|
||||||
name = "mr game and watch",
|
name = "mr game and watch",
|
||||||
codenames = [ "mrgameandwatch", ],
|
codenames = [ "game", "mrgameandwatch", ],
|
||||||
res_urls = {
|
res_urls = {
|
||||||
"smashlyon": [
|
"smashlyon": [
|
||||||
"https://resources.smashlyon.com/melee/mrgameandwatch.zip",
|
"https://resources.smashlyon.com/melee/game.zip",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -62,11 +62,13 @@ def download_res(
|
||||||
|
|
||||||
# Select default source if needed
|
# Select default source if needed
|
||||||
if not source:
|
if not source:
|
||||||
if game.GAME.name == "pplus":
|
if game.GAME.name in [ "pplus", "melee" ]:
|
||||||
source = "smashlyon"
|
source = "smashlyon"
|
||||||
elif game.GAME.name == "ssbu":
|
elif game.GAME.name == "ssbu":
|
||||||
source = "spriters"
|
source = "spriters"
|
||||||
|
|
||||||
|
log.info("Using default source {}".format(source))
|
||||||
|
|
||||||
if source not in ["smashlyon", "spriters"]:
|
if source not in ["smashlyon", "spriters"]:
|
||||||
raise NotImplementedError(
|
raise NotImplementedError(
|
||||||
"The only working sources are 'smashlyon' and 'spriters'",
|
"The only working sources are 'smashlyon' and 'spriters'",
|
||||||
|
@ -165,12 +167,17 @@ def download_res(
|
||||||
# otherwise: get the characters pictures and write them in the
|
# otherwise: get the characters pictures and write them in the
|
||||||
# outdir
|
# outdir
|
||||||
with zipfile.ZipFile(f) as zf:
|
with zipfile.ZipFile(f) as zf:
|
||||||
for source_filename in zf.namelist():
|
for source_file in zf.filelist:
|
||||||
|
|
||||||
|
if source_file.is_dir():
|
||||||
|
continue
|
||||||
|
|
||||||
|
source_filename = source_file.filename
|
||||||
|
|
||||||
if "No Gamma Fix" in source_filename:
|
if "No Gamma Fix" in source_filename:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not any(c in source_filename for c in characters.codenames):
|
if not any(c in source_filename for c in character.codenames):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
target_filename = pathlib.Path(source_filename).name
|
target_filename = pathlib.Path(source_filename).name
|
||||||
|
@ -180,10 +187,11 @@ def download_res(
|
||||||
|
|
||||||
target_filename = pathlib.Path(source_filename).name
|
target_filename = pathlib.Path(source_filename).name
|
||||||
|
|
||||||
target_filename = target_filename.replace(
|
for codename in character.codenames:
|
||||||
character.codenames[0],
|
target_filename = target_filename.replace(
|
||||||
character.name,
|
codename,
|
||||||
)
|
character.name,
|
||||||
|
)
|
||||||
|
|
||||||
log.debug("Writing file '{}'".format(target_filename))
|
log.debug("Writing file '{}'".format(target_filename))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue