8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 01c8cf9 commit 116158bCopy full SHA for 116158b
recite/sound.py
100644
100755
@@ -2,7 +2,13 @@
2
import urllib2
3
import re
4
import os
5
-import mp3play
+import sys
6
+if sys.platform == 'win32':
7
+ import mp3play
8
+elif sys.platform == 'darwin':
9
+ pass
10
+else:
11
12
import socket
13
sound_dir = 'sound'
14
def download(url, path):
@@ -25,7 +31,8 @@ def download(url, path):
25
31
return False
26
32
raise e
27
33
def play(f):
28
- #TODO: play mp3 in mac x os with 'afplay '
34
+ if sys.platform == 'darwin':
35
+ return os.system('afplay %s' % f)
29
36
try:
30
37
clip = mp3play.load(f)
38
clip.play()
0 commit comments