8000 compatible mac x os · codepongo/utocode@116158b · GitHub
[go: up one dir, main page]

Skip to content

Commit 116158b

Browse files
committed
compatible mac x os
1 parent 01c8cf9 commit 116158b

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

recite/sound.py

100644100755
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
import urllib2
33
import re
44
import os
5-
import mp3play
5+
import sys
6+
if sys.platform == 'win32':
7+
import mp3play
8+
elif sys.platform == 'darwin':
9+
pass
10+
else:
11+
pass
612
import socket
713
sound_dir = 'sound'
814
def download(url, path):
@@ -25,7 +31,8 @@ def download(url, path):
2531
return False
2632
raise e
2733
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)
2936
try:
3037
clip = mp3play.load(f)
3138
clip.play()

0 commit comments

Comments
 (0)
0