Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ dependencies = [
"bson (>=0.5.10,<0.6.0)",
"numpy (>=2.2.4,<3.0.0)",
"click (>=8.1.7,<9.0.0)",
"pydub (>=0.25.1,<0.26.0)",
"fastcrc (>=0.3.2,<0.4.0)",
"unitypy (==1.22.5)",
"tenacity (>=9.0.0,<10.0.0)",
Expand All @@ -23,7 +22,6 @@ dependencies = [
"pydantic-settings (>=2.0.0,<3.0.0)",
"sentry-sdk[loguru,httpx] (>=2.13.0,<3.0.0)",
"ark-fbs (>=0.1.2,<0.2.0)",
"audioop-lts (>=0.2.2,<0.3.0)",
]

[dependency-groups]
Expand Down
2 changes: 1 addition & 1 deletion torappu/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Config(BaseSettings):

environment: Literal["production", "debug"] = "debug"

log_level: int | str = "INFO"
log_level: int | str = "DEBUG"

token: str | None = None
timeout: int = 10
Expand Down
36 changes: 28 additions & 8 deletions torappu/core/tasks/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import ClassVar

import UnityPy
from pydub import AudioSegment
from UnityPy.classes import AudioClip

from torappu.consts import STORAGE_DIR
Expand Down Expand Up @@ -83,11 +82,32 @@ async def mp3(self, path: str):

logger.error(f"ffmpeg error: {returncode=!r} {stdout=!r} {stderr=!r}")

def combie(self, intro_path: Path | None, loop_path: Path, combie_path: Path):
intro = AudioSegment.from_mp3(intro_path)
loop = AudioSegment.from_mp3(loop_path)
intro = intro + loop
intro.export(combie_path, format="mp3", bitrate="128k")
def combine(self, intro_path: Path, loop_path: Path, combine_path: Path):
result = subprocess.run(
[
"ffmpeg",
"-y",
"-i",
str(intro_path),
"-i",
str(loop_path),
"-filter_complex",
"[0:a][1:a]concat=n=2:v=0:a=1[a]",
"-map",
"[a]",
"-b:a",
"128k",
str(combine_path),
],
capture_output=True,
text=True,
)

if result.returncode != 0:
raise RuntimeError(
f"failed to concat audio: intro={intro_path!s} loop={loop_path!s} "
f"output={combine_path!s} stderr={result.stderr!r}"
)

def make_banks(self):
audio_data = get_gamedata(
Expand Down Expand Up @@ -128,8 +148,8 @@ def make_banks(self):
dist.symlink_to("../audio/" + loop_path)
continue

logger.debug(f"combie {intro_path} and {loop_path} to {dist}")
self.combie(AUDIO_DIR / intro_path, AUDIO_DIR / loop_path, dist)
logger.debug(f"combine {intro_path} and {loop_path} to {dist}")
self.combine(AUDIO_DIR / intro_path, AUDIO_DIR / loop_path, dist)

for key, value in audio_data["bankAlias"].items():
path = base_dir / (key + ".mp3")
Expand Down
Loading
Loading