mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 03:30:13 +01:00
add proper metadata and bgmovie
This commit is contained in:
@@ -428,7 +428,7 @@ class FolderBox(BaseBox):
|
|||||||
tex.draw_texture('yellow_box', 'song_count_songs', color=color)
|
tex.draw_texture('yellow_box', 'song_count_songs', color=color)
|
||||||
dest_width = min(tex.skin_config["song_tja_count"].width, self.tja_count_text.texture.width)
|
dest_width = min(tex.skin_config["song_tja_count"].width, self.tja_count_text.texture.width)
|
||||||
self.tja_count_text.draw(outline_color=ray.BLACK, x=tex.skin_config["song_tja_count"].x - (dest_width//2), y=tex.skin_config["song_tja_count"].y, x2=dest_width-self.tja_count_text.texture.width, color=color)
|
self.tja_count_text.draw(outline_color=ray.BLACK, x=tex.skin_config["song_tja_count"].x - (dest_width//2), y=tex.skin_config["song_tja_count"].y, x2=dest_width-self.tja_count_text.texture.width, color=color)
|
||||||
if self.texture_index != TextureIndex.DEFAULT:
|
if self.texture_index != TextureIndex.DEFAULT and self.box_texture is None:
|
||||||
tex.draw_texture('box', 'folder_graphic', color=color, frame=self.genre_index)
|
tex.draw_texture('box', 'folder_graphic', color=color, frame=self.genre_index)
|
||||||
tex.draw_texture('box', 'folder_text', color=color, frame=self.genre_index)
|
tex.draw_texture('box', 'folder_text', color=color, frame=self.genre_index)
|
||||||
elif self.box_texture is not None:
|
elif self.box_texture is not None:
|
||||||
|
|||||||
@@ -29,6 +29,13 @@ class OsuParser:
|
|||||||
self.slider_multiplier = float(self.difficulty["SliderMultiplier"])
|
self.slider_multiplier = float(self.difficulty["SliderMultiplier"])
|
||||||
self.metadata = TJAMetadata()
|
self.metadata = TJAMetadata()
|
||||||
self.metadata.wave = osu_file.parent / self.general["AudioFilename"]
|
self.metadata.wave = osu_file.parent / self.general["AudioFilename"]
|
||||||
|
self.metadata.demostart = float(self.general["PreviewTime"]) / 1000
|
||||||
|
self.metadata.offset = -30/1000
|
||||||
|
self.metadata.title["en"] = self.osu_metadata["Version"]
|
||||||
|
self.metadata.subtitle["en"] = self.osu_metadata["Creator"]
|
||||||
|
match = re.search(r'\[Events\][\s\S]*?^[ \t]*(\d+),(\d+),"([^"]+)"', osu_file.read_text(), re.MULTILINE)
|
||||||
|
if match:
|
||||||
|
self.metadata.bgmovie = osu_file.parent / Path(match.group(3))
|
||||||
self.metadata.course_data[0] = CourseData()
|
self.metadata.course_data[0] = CourseData()
|
||||||
self.ex_data = TJAEXData()
|
self.ex_data = TJAEXData()
|
||||||
self.bpm = []
|
self.bpm = []
|
||||||
|
|||||||
@@ -14,6 +14,12 @@ class VideoPlayer:
|
|||||||
def __init__(self, path: Path):
|
def __init__(self, path: Path):
|
||||||
"""Initialize a video player instance"""
|
"""Initialize a video player instance"""
|
||||||
self.is_finished_list = [False, False]
|
self.is_finished_list = [False, False]
|
||||||
|
self.is_static = False
|
||||||
|
if path.suffix == '.png' or path.suffix == '.jpg':
|
||||||
|
self.texture = ray.LoadTexture(str(path).encode('utf-8'))
|
||||||
|
self.is_static = True
|
||||||
|
return
|
||||||
|
|
||||||
self.container = av.open(str(path))
|
self.container = av.open(str(path))
|
||||||
self.video_stream = self.container.streams.video[0]
|
self.video_stream = self.container.streams.video[0]
|
||||||
|
|
||||||
@@ -144,6 +150,8 @@ class VideoPlayer:
|
|||||||
|
|
||||||
def start(self, current_ms: float) -> None:
|
def start(self, current_ms: float) -> None:
|
||||||
"""Start video playback at call time"""
|
"""Start video playback at call time"""
|
||||||
|
if self.is_static:
|
||||||
|
return
|
||||||
self.start_ms = current_ms
|
self.start_ms = current_ms
|
||||||
self._init_frame_generator()
|
self._init_frame_generator()
|
||||||
self._load_frame(0)
|
self._load_frame(0)
|
||||||
@@ -154,11 +162,15 @@ class VideoPlayer:
|
|||||||
|
|
||||||
def set_volume(self, volume: float) -> None:
|
def set_volume(self, volume: float) -> None:
|
||||||
"""Set video volume, takes float value from 0.0 to 1.0"""
|
"""Set video volume, takes float value from 0.0 to 1.0"""
|
||||||
|
if self.is_static:
|
||||||
|
return
|
||||||
if self.audio is not None:
|
if self.audio is not None:
|
||||||
audio.set_music_volume(self.audio, volume)
|
audio.set_music_volume(self.audio, volume)
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Updates video playback, advancing frames and audio"""
|
"""Updates video playback, advancing frames and audio"""
|
||||||
|
if self.is_static:
|
||||||
|
return
|
||||||
self._audio_manager()
|
self._audio_manager()
|
||||||
|
|
||||||
if self.frame_index >= len(self.frame_timestamps):
|
if self.frame_index >= len(self.frame_timestamps):
|
||||||
@@ -197,6 +209,11 @@ class VideoPlayer:
|
|||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
"""Stops the video, audio, and clears its buffer"""
|
"""Stops the video, audio, and clears its buffer"""
|
||||||
|
if self.is_static:
|
||||||
|
if self.texture is not None:
|
||||||
|
ray.UnloadTexture(self.texture)
|
||||||
|
self.texture = None
|
||||||
|
return
|
||||||
if self.container:
|
if self.container:
|
||||||
self.container.close()
|
self.container.close()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user