mirror of
https://github.com/qwerfd2/Groove_Coaster_2_Server.git
synced 2025-12-22 03:30:18 +00:00
update
This commit is contained in:
@@ -1,21 +1,41 @@
|
|||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
import zlib
|
||||||
|
|
||||||
base_dir = os.getcwd()
|
base_dir = os.getcwd()
|
||||||
|
|
||||||
|
def file_crc32(filepath):
|
||||||
|
with open(filepath, "rb") as f:
|
||||||
|
return zlib.crc32(f.read())
|
||||||
|
|
||||||
|
# 1. Stage files
|
||||||
stage_folder = os.path.join(base_dir, "stage")
|
stage_folder = os.path.join(base_dir, "stage")
|
||||||
stage_files = [f for f in os.listdir(stage_folder) if os.path.isfile(os.path.join(stage_folder, f))]
|
stage_files = {
|
||||||
|
f: file_crc32(os.path.join(stage_folder, f))
|
||||||
|
for f in os.listdir(stage_folder)
|
||||||
|
if os.path.isfile(os.path.join(stage_folder, f))
|
||||||
|
}
|
||||||
|
|
||||||
with open("download_manifest.json", "w", encoding="utf-8") as f:
|
with open("download_manifest.json", "w", encoding="utf-8") as f:
|
||||||
json.dump(stage_files, f, ensure_ascii=False, indent=2)
|
json.dump(stage_files, f, ensure_ascii=False, indent=2)
|
||||||
|
|
||||||
|
# 2. Android audio files (.ogg.zip)
|
||||||
audio_folder = os.path.join(base_dir, "audio")
|
audio_folder = os.path.join(base_dir, "audio")
|
||||||
ogg_zip_files = [f for f in os.listdir(audio_folder) if f.endswith(".ogg.zip") and os.path.isfile(os.path.join(audio_folder, f))]
|
ogg_zip_files = {
|
||||||
|
f: file_crc32(os.path.join(audio_folder, f))
|
||||||
|
for f in os.listdir(audio_folder)
|
||||||
|
if f.endswith(".ogg.zip") and os.path.isfile(os.path.join(audio_folder, f))
|
||||||
|
}
|
||||||
|
|
||||||
with open("download_manifest_android.json", "w", encoding="utf-8") as f:
|
with open("download_manifest_android.json", "w", encoding="utf-8") as f:
|
||||||
json.dump(ogg_zip_files, f, ensure_ascii=False, indent=2)
|
json.dump(ogg_zip_files, f, ensure_ascii=False, indent=2)
|
||||||
|
|
||||||
m4a_zip_files = [f for f in os.listdir(audio_folder) if f.endswith(".m4a.zip") and os.path.isfile(os.path.join(audio_folder, f))]
|
# 3. iOS audio files (.m4a.zip)
|
||||||
|
m4a_zip_files = {
|
||||||
|
f: file_crc32(os.path.join(audio_folder, f))
|
||||||
|
for f in os.listdir(audio_folder)
|
||||||
|
if f.endswith(".m4a.zip") and os.path.isfile(os.path.join(audio_folder, f))
|
||||||
|
}
|
||||||
|
|
||||||
with open("download_manifest_ios.json", "w", encoding="utf-8") as f:
|
with open("download_manifest_ios.json", "w", encoding="utf-8") as f:
|
||||||
json.dump(m4a_zip_files, f, ensure_ascii=False, indent=2)
|
json.dump(m4a_zip_files, f, ensure_ascii=False, indent=2)
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
Since flutter cannot do native zipcrypto and beautifulSoup shenanigans, I opted to pre-compute the list of files that the downloader should take.
|
Since flutter cannot do native zipcrypto and beautifulSoup shenanigans, I opted to pre-compute the list of files that the downloader should take.
|
||||||
|
|
||||||
Place this script with the `pak` files and run. It will generate 3 json files, one for `common` (stages), one for `android` (ogg), and one for `ios` (m4a). The flutter app will simply query the endpoint and use the list to download.
|
Place this script with the `pak` files and run. It will generate 3 json files, one for `common` (stages), one for `android` (ogg), and one for `ios` (m4a).
|
||||||
|
|
||||||
|
Move these files to api/config.
|
||||||
|
|
||||||
|
The flutter app will simply query the endpoint and use the list to download.
|
||||||
Reference in New Issue
Block a user