Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ae265f3

Browse files
Modification de l'appel au player
1 parent de81a0a commit ae265f3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

‎SAMPLE/nabz.py‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import sys
22
import argparse
33
import subprocess
4+
import shlex
5+
import urllib
46
sys.path.append('../') # Just to make the GIT source more cleaner without creating a module. In YOUR project you DON'T have to do that
57
from extended_BaseHTTPServer import serve,route
68

@@ -12,8 +14,8 @@ def play(file=""):
1214
current_playing.pop().kill()
1315

1416
try:
15-
file=" ".join(("'"+item+"'"foriteminfile))
16-
current_playing.append(subprocess.Popen("{0} {1} vlc://quit".format(args.player, file), shell=True))
17+
# current_playing.append(subprocess.Popen("{0} {1} vlc://quit".format(args.player, file), shell=True))
18+
current_playing.append(subprocess.Popen(args.player+file, shell=False))
1719
return "{'stream':true}"
1820
except:
1921
return "{'stream':false}"
@@ -27,16 +29,16 @@ def stop():
2729
@route("/say",["GET"])
2830
def say(text="Bonjour"):
2931
try:
30-
url = "http://translate.google.com/translate_tts?tl=fr&q={0}".format(urllib.quote(text[0]))
31-
current_playing.append(subprocess.Popen("{0} '{1}' vlc://quit".format(args.player, url), shell=True))
32+
url = ["http://translate.google.com/translate_tts?tl=fr&q={0}".format(urllib.quote(text[0]))]
33+
current_playing.append(subprocess.Popen(args.player+url, shell=False))
3234
return "{'say':true}"
33-
except:
35+
exceptExceptionase:
3436
return "{'say':false}"
3537

3638

3739
parser = argparse.ArgumentParser(description='Simple Nabz.')
3840
parser.add_argument('--player', action='store',help='Path to VLC command line (/usr/bin/cvlc)')
3941
args = parser.parse_args()
40-
42+
args.player=shlex.split(args.player)
4143

4244
serve(ip="0.0.0.0", port=5000)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /