Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes issue #207 - Add audio file argument #244

Merged
merged 1 commit into from
Nov 9, 2021
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
4 changes: 4 additions & 0 deletions pydoro/pydoro_core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import configparser
import os

from pydoro.pydoro_core.util import in_app_path


class Configuration:
def __init__(self):
Expand Down Expand Up @@ -37,6 +39,7 @@ def _cli_parse(self):
parser.add_argument(
"--version", help="display version and exit", action="store_true"
)
parser.add_argument("--audio-file", metavar='path', help="custom audio file")
self.cli_args = parser.parse_args()

def _ini_parse(self):
Expand Down Expand Up @@ -115,3 +118,4 @@ def _cli_load(self):
self.emoji = self.cli_args.emoji or self.emoji
self.audio_check = self.cli_args.audio_check
self.show_version = self.cli_args.version
self.audio_file = self.cli_args.audio_file or in_app_path("b15.wav")
2 changes: 1 addition & 1 deletion pydoro/pydoro_core/tomato.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def play_alarm(self):
return
# noinspection PyBroadException
try:
sound.play(in_app_path("b15.wav"), block=False)
sound.play(self.configs.audio_file, block=False)
except Exception:
pass

Expand Down