summaryrefslogtreecommitdiff
blob: 1547cde8f00db93d49dba5606d41a38bf9ae9022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
diff --git a/gourmet/sound.py b/gourmet/sound.py
index 2dea6bb7..c232d258 100644
--- a/gourmet/sound.py
+++ b/gourmet/sound.py
@@ -1,15 +1,19 @@
 try:
-    from sound_gst import Player
+    from sound_pyglet import Player
 except ImportError:
-    print 'No gst player'
+    print 'No pyglet player'
     try:
-        from sound_windows import Player
+        from sound_gst import Player
     except ImportError:
-        print 'No windows player'
-        import sys
-        class Player:
-            """Fallback player"""
-            def play_file (self,path):
-                print 'No player installed -- beeping instead'
-                for n in range(5): sys.stdout.write('\a'); sys.stdout.flush()
+        print 'No gst player'
+        try:
+            from sound_windows import Player
+        except ImportError:
+            print 'No windows player'
+            import sys
+            class Player:
+                """Fallback player"""
+                def play_file (self,path):
+                    print 'No player installed -- beeping instead'
+                    for n in range(5): sys.stdout.write('\a'); sys.stdout.flush()
 
diff --git a/gourmet/sound_pyglet.py b/gourmet/sound_pyglet.py
new file mode 100644
index 00000000..41da613a
--- /dev/null
+++ b/gourmet/sound_pyglet.py
@@ -0,0 +1,16 @@
+import pyglet
+
+class Player:
+    def __init__ (self):
+        pass
+
+    def play_file (self,path):
+        self.source = pyglet.media.load(path,streaming=False)
+        self.source.play()
+
+    def stop_play (self,path):
+        pass
+
+if __name__ == '__main__':
+    p = Player()
+    p.play_file('../data/sound/phone.wav')