Compare commits

...

2 Commits

Author SHA1 Message Date
f26a9d1bd8 chore: new logo 2023-10-11 00:14:23 +08:00
d8651abeab feat: 5.0 apk support 2023-10-11 00:14:17 +08:00
3 changed files with 75 additions and 45 deletions

View File

@ -5,6 +5,8 @@ import sys
import zipfile import zipfile
from pathlib import Path, PurePath from pathlib import Path, PurePath
from tqdm import tqdm
from common import ArcaeaApkParser, ExtractTask, extract from common import ArcaeaApkParser, ExtractTask, extract
ROOT_OUTPUT_PATH = Path(sys.argv[0]).parent.absolute() ROOT_OUTPUT_PATH = Path(sys.argv[0]).parent.absolute()
@ -52,12 +54,23 @@ class SongParser(ArcaeaApkParser):
continue continue
song_id = re.sub(r"^dl_", "", song_zf_path.name) song_id = re.sub(r"^dl_", "", song_zf_path.name)
if file_pure_path.stem == "base": if file_pure_path.stem in ["base", "1080_base"]:
new_file_name_stem = song_id new_file_name_stem = song_id
elif file_pure_path.stem == "base_night": elif file_pure_path.stem in ["1080_base_night", "base_night"]:
new_file_name_stem = f"{song_id}_night" new_file_name_stem = f"{song_id}_night"
elif file_pure_path.stem in ["0", "1", "2", "3"]: elif file_pure_path.stem in [
new_file_name_stem = f"{song_id}_{file_pure_path.stem}" "0",
"1",
"2",
"3",
"1080_0",
"1080_1",
"1080_2",
"1080_3",
]:
new_file_name_stem = (
f"{song_id}_{file_pure_path.stem.replace('1080_', '')}"
)
else: else:
continue continue
@ -69,7 +82,8 @@ class SongParser(ArcaeaApkParser):
class CharParser(ArcaeaApkParser): class CharParser(ArcaeaApkParser):
CHAR_RE = r"^\d*u?(_icon)?\.png$" CHAR_RE = r"^\d+u?\.png$"
CHAR_ICON_RE = r"^\d+u?_icon\.png$"
@property @property
def OUTPUT_PATH_CHAR(self): def OUTPUT_PATH_CHAR(self):
@ -80,23 +94,37 @@ class CharParser(ArcaeaApkParser):
return ROOT_OUTPUT_PATH / "Icon" return ROOT_OUTPUT_PATH / "Icon"
def parse(self): def parse(self):
char_dir_zf_path = zipfile.Path(self.zf) / "assets" / "char" if (zipfile.Path(self.zf) / "assets" / "char" / "1080").exists():
char_dir_zf_path = zipfile.Path(self.zf) / "assets" / "char" / "1080"
else:
char_dir_zf_path = zipfile.Path(self.zf) / "assets" / "char"
char_zf_path_list = [zfp for zfp in char_dir_zf_path.iterdir() if zfp.is_file()] char_zf_path_list = [zfp for zfp in char_dir_zf_path.iterdir() if zfp.is_file()]
char_icon_dir_zf_path = zipfile.Path(self.zf) / "assets" / "char"
char_icon_zf_path_list = [
zfp for zfp in char_icon_dir_zf_path.iterdir() if zfp.is_file()
]
tasks = [] tasks = []
for char_zf_path in char_zf_path_list: for char_zf_path in char_zf_path_list:
char_pure_path = PurePath(str(char_zf_path)) char_pure_path = PurePath(str(char_zf_path))
if not re.match(self.CHAR_RE, char_pure_path.name): if not re.match(self.CHAR_RE, char_pure_path.name):
continue continue
if "_icon" in char_pure_path.stem: new_file_name = char_pure_path.name
new_file_name = char_pure_path.name.replace("_icon", "") new_file_path = self.OUTPUT_PATH_CHAR / new_file_name
new_file_path = self.OUTPUT_PATH_ICON / new_file_name
else:
new_file_name = char_pure_path.name
new_file_path = self.OUTPUT_PATH_CHAR / new_file_name
tasks.append(ExtractTask(char_zf_path, new_file_path)) tasks.append(ExtractTask(char_zf_path, new_file_path))
for char_icon_zf_path in char_icon_zf_path_list:
char_icon_pure_path = PurePath(str(char_icon_zf_path))
if not re.match(self.CHAR_ICON_RE, char_icon_pure_path.name):
continue
new_file_name = char_icon_pure_path.name.replace("_icon", "")
new_file_path = self.OUTPUT_PATH_ICON / new_file_name
tasks.append(ExtractTask(char_icon_zf_path, new_file_path))
return tasks return tasks
@ -135,5 +163,5 @@ if __name__ == "__main__":
tasks = sp_tasks + cp_tasks tasks = sp_tasks + cp_tasks
logger.info("Extracting, please wait...") logger.info("Extracting, please wait...")
for task in tasks: for task in tqdm(tasks):
extract(task) extract(task)

BIN
logo.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 149 KiB

After

Width:  |  Height:  |  Size: 112 KiB

View File

@ -8,7 +8,7 @@
version="1.1" version="1.1"
id="svg1" id="svg1"
inkscape:version="1.3 (0e150ed6c4, 2023-07-21)" inkscape:version="1.3 (0e150ed6c4, 2023-07-21)"
sodipodi:docname="arcaea-apk-extract.svg" sodipodi:docname="arcaea-apk-extract.inkscape.svg"
inkscape:export-filename="arcaea-apk-extract.png" inkscape:export-filename="arcaea-apk-extract.png"
inkscape:export-xdpi="96" inkscape:export-xdpi="96"
inkscape:export-ydpi="96" inkscape:export-ydpi="96"
@ -148,27 +148,6 @@
offset="1" offset="1"
id="stop8" /> id="stop8" />
</linearGradient> </linearGradient>
<linearGradient
id="linearGradient2"
inkscape:collect="always">
<stop
style="stop-color:#206080;stop-opacity:1;"
offset="0"
id="stop2" />
<stop
style="stop-color:#27a6e5;stop-opacity:1;"
offset="0.85000002"
id="stop3" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2"
id="linearGradient3"
x1="0.59705299"
y1="115.49972"
x2="500"
y2="384.82227"
gradientUnits="userSpaceOnUse" />
<linearGradient <linearGradient
inkscape:collect="always" inkscape:collect="always"
xlink:href="#linearGradient7" xlink:href="#linearGradient7"
@ -197,22 +176,45 @@
x2="250" x2="250"
y2="114.21859" y2="114.21859"
gradientUnits="userSpaceOnUse" /> gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient2-4"
id="linearGradient3-3"
x1="87.5"
y1="165.07216"
x2="418.75003"
y2="359.92786"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(1.2316808,0,0,1.2316808,-57.92018,-57.920177)" />
<linearGradient
id="linearGradient2-4"
inkscape:collect="always">
<stop
style="stop-color:#27a6e5;stop-opacity:1;"
offset="0.1"
id="stop2-4" />
<stop
style="stop-color:#206080;stop-opacity:1;"
offset="0.89999998"
id="stop3-0" />
</linearGradient>
</defs> </defs>
<g <g
inkscape:label="图层 1" inkscape:label="图层 1"
inkscape:groupmode="layer" inkscape:groupmode="layer"
id="layer1"> id="layer1">
<rect <path
style="fill:url(#linearGradient3);stroke:none;stroke-width:6;stroke-linecap:round" style="display:inline;fill:url(#linearGradient3-3);fill-opacity:1;stroke:none;stroke-width:4.92672;stroke-dasharray:none;stroke-opacity:1"
id="rect1" d="M -27.12816,280.79201 126.83193,9.9999998 H 373.16807 L 527.12816,280.79201 388.56413,490 H 111.43587 Z"
width="500" id="path16"
height="500"
x="0"
y="0"
rx="128"
ry="128"
inkscape:label="bg" inkscape:label="bg"
sodipodi:insensitive="true" /> sodipodi:nodetypes="ccccccc" />
<path
style="display:inline;fill:#74c2e5;fill-opacity:1;stroke:none;stroke-width:4.92672;stroke-dasharray:none;stroke-opacity:1"
d="M 126.83193,9.9999998 77.91352,96.039901 H 422.08647 L 373.16807,9.9999998 Z"
id="path7-8"
inkscape:label="top-bg"
sodipodi:nodetypes="ccccc" />
<g <g
id="g11" id="g11"
transform="matrix(1.6981132,0,0,1.6981132,-178.77358,-293.39624)" transform="matrix(1.6981132,0,0,1.6981132,-178.77358,-293.39624)"

Before

Width:  |  Height:  |  Size: 8.6 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB