feat: support multiple audio formats and load alarm files dynamically - #1
Open
422August wants to merge 1 commit into
Open
feat: support multiple audio formats and load alarm files dynamically#1422August wants to merge 1 commit into
422August wants to merge 1 commit into
Conversation
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Background & Purpose
Previously, the application hardcoded the alarm sound file to
.wavand resolved the file path only once upon application launch. To improve flexibility, this PR expands audio format compatibility and switches to dynamic file discovery whenever the alarm triggers.Key Changes
.mp3,.ogg, and.flacformats viaSUPPORTED_FORMATS = (".mp3", ".wav", ".ogg", ".flac").sorted()inget_alarm_path()to ensure a predictable file loading order when multiple audio files exist.get_alarm_path()resolution inside_startAlarm(). Replacing or adding audio files while the application is running takes effect immediately without needing a restart.Code Diff Summary
Verification & Testing
.mp3and.oggfiles in thealarm/directory; both play as expected.alarm/while the app was running; the new audio played successfully on the next alarm trigger.