You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am adding my own sounds from sounds I have purchased online. Would be great to be aware how long are sounds.
Currently I did a small work around:
sound.py:
def _load_duration(self):
# Create a GStreamer pipeline to load the file and retrieve duration
player = Gst.ElementFactory.make("playbin", "player")
player.set_property("uri", self.uri if self.uri.startswith("file://") else f"file://{self.uri}")
player.set_state(Gst.State.PAUSED)
Gst.Element.get_state(player, Gst.CLOCK_TIME_NONE) # Force pipeline to preroll and get duration
self.duration = player.query_duration(Gst.Format.TIME)[1] // Gst.SECOND
player.set_state(Gst.State.NULL) # Stop the player
window.py:
def _create_sound_item(self, sound):
[...]
if isinstance(sound, Sound):
# Set tooltip with duration
formatted_duration = self.format_duration(sound.duration)
item.set_tooltip_text(f"Sound Duration: {formatted_duration}")
The text was updated successfully, but these errors were encountered:
I am adding my own sounds from sounds I have purchased online. Would be great to be aware how long are sounds.
Currently I did a small work around:
sound.py:
window.py:
The text was updated successfully, but these errors were encountered: