mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-17 13:56:47 +00:00
use try in case pygame isnt installed
This commit is contained in:
parent
a4373ef156
commit
5ad442341f
@ -149,19 +149,23 @@ class TorrentNotification:
|
||||
|
||||
def play_sound(self):
|
||||
if not deluge.common.windows_check():
|
||||
import pygame
|
||||
import os.path
|
||||
import sys
|
||||
pygame.init()
|
||||
try:
|
||||
name = self.config.get("sound_path")
|
||||
import pygame
|
||||
except:
|
||||
print "no file set"
|
||||
try:
|
||||
alert_sound = pygame.mixer.music
|
||||
alert_sound.load(name)
|
||||
alert_sound.play()
|
||||
except pygame.error, message:
|
||||
print 'Cannot load sound:'
|
||||
pass
|
||||
else:
|
||||
import os.path
|
||||
import sys
|
||||
pygame.init()
|
||||
try:
|
||||
name = self.config.get("sound_path")
|
||||
except:
|
||||
print "no file set"
|
||||
try:
|
||||
alert_sound = pygame.mixer.music
|
||||
alert_sound.load(name)
|
||||
alert_sound.play()
|
||||
except pygame.error, message:
|
||||
print 'Cannot load sound:'
|
||||
else:
|
||||
pass
|
||||
|
Loading…
x
Reference in New Issue
Block a user