Skip to content

Commit

Permalink
move sound controller into error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
gogodr committed Aug 3, 2023
1 parent ea2d5cd commit b583a61
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
2 changes: 0 additions & 2 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ class LostArkMarketWatcher(QApplication):
message_box = Signal(dict)
open_config = Signal()
message_box_handler: MessageBoxHandler
volume_controller: VolumeController

def __init__(self, *args, **kwargs):
QApplication.__init__(self, *args, **kwargs)
Expand All @@ -50,7 +49,6 @@ def __init__(self, *args, **kwargs):
self.log_view = LostArkMarketWatcherLog()
AppLogger().signal_enable(self.log_view.signal)
self.config_form = LostArkMarketWatcherConfig(self.open_config)
self.volume_controller = VolumeController()
self.config_form.config_updated.connect(self.spawn_observer)
self.market_db.new_version.connect(self.new_version)
if Config().open_log_on_start:
Expand Down
2 changes: 1 addition & 1 deletion modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


class Config(metaclass=Singleton):
version = "0.8.18.2"
version = "0.8.18.4"
region: str
game_region: str
debug = False
Expand Down
18 changes: 11 additions & 7 deletions modules/sound.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,19 @@ def __init__(self, sound_file):
self.sound_file = sound_file

def run(self):
self.playsound(self.sound_file)
if Config().play_audio:
self.playsound(self.sound_file)

def playsound(self, file):
if VolumeController().audio == None:
VolumeController().searchProcess()
if VolumeController().audio:
wave_obj = sa.WaveObject.from_wave_file(file)
play_obj = wave_obj.play()
play_obj.wait_done()
try:
if VolumeController().audio == None:
VolumeController().searchProcess()
if VolumeController().audio:
wave_obj = sa.WaveObject.from_wave_file(file)
play_obj = wave_obj.play()
play_obj.wait_done()
except Exception as ex:
AppLogger().exception(ex)


def playSuccess():
Expand Down

0 comments on commit b583a61

Please sign in to comment.