mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-09 01:48:40 +00:00
use try in case pygame isnt installed
This commit is contained in:
parent
a4373ef156
commit
5ad442341f
1 changed files with 16 additions and 12 deletions
|
@ -149,19 +149,23 @@ class TorrentNotification:
|
||||||
|
|
||||||
def play_sound(self):
|
def play_sound(self):
|
||||||
if not deluge.common.windows_check():
|
if not deluge.common.windows_check():
|
||||||
import pygame
|
|
||||||
import os.path
|
|
||||||
import sys
|
|
||||||
pygame.init()
|
|
||||||
try:
|
try:
|
||||||
name = self.config.get("sound_path")
|
import pygame
|
||||||
except:
|
except:
|
||||||
print "no file set"
|
pass
|
||||||
try:
|
else:
|
||||||
alert_sound = pygame.mixer.music
|
import os.path
|
||||||
alert_sound.load(name)
|
import sys
|
||||||
alert_sound.play()
|
pygame.init()
|
||||||
except pygame.error, message:
|
try:
|
||||||
print 'Cannot load sound:'
|
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:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue