Skip to content

Commit 16dc32f

Browse files
committed
playback of unicode characters on filenames under Windows now works
1 parent 7e5f34e commit 16dc32f

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

CommandBar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import talkshowUtils
1212
def loadImage(path):
1313
newpath = talkshowUtils.getRelativePath(path)
14-
return pyglet.image.load(newpath.encode(sys.getfilesystemencoding()))
14+
return pyglet.image.load(newpath)
1515

1616

1717
class CommandBar(object):

talkshow.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,6 @@ def __init__(self, config, screen, player):
277277

278278

279279
self.player = player
280-
281-
#self.player.play("content/Drei/nicht_nur_europa.wav")
282-
283-
#self.DoLayout()
284280

285281
self.count = 9
286282

@@ -510,7 +506,7 @@ def onFieldClicked(self, f):
510506
#self.playPath_AudioRecorder(self.pathPrefix + self.pathForField(f.index))
511507

512508
def iconForPath(self, path):
513-
images = glob.glob1(path, "*.png")
509+
images = glob.glob1(path, u"*.png")
514510
if images:
515511
imagePath = os.path.join(path, images[0])
516512
image = wrappers.Image(None, name=imagePath, path=imagePath)
@@ -526,7 +522,7 @@ def cancelVideo(self):
526522

527523
def playPath(self, path):
528524

529-
mediaPatterns = ["*.wav", "*.avi", "*.wmv", "*.mpg", "*.mp3", "*.wma", "*.asf", "*.midi", "*.aiff", "*.au", "*.m4a"]
525+
mediaPatterns = [u"*.wav", u"*.avi", u"*.wmv", u"*.mpg", u"*.mp3", u"*.wma", u"*.asf", u"*.midi", u"*.aiff", u"*.au", u"*.m4a"]
530526
mediaPatterns_uppercase = [pattern.upper() for pattern in mediaPatterns]
531527
mediaPatterns += mediaPatterns_uppercase
532528
mediaFiles = []

vlcPlayer.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,13 @@ def stop(self):
3030

3131

3232
def play(self, path_to_media_file):
33+
debug(u"attempting to play file: {0} of type: {1} and repr: {2}".format(path_to_media_file, type(path_to_media_file), repr(path_to_media_file)))
34+
encoded_path=path_to_media_file.encode("UTF-8")
3335
if not os.path.isfile(path_to_media_file):
34-
warn("This file: {0} does not exist. Full path: {1}".format(path_to_media_file, os.path.abspath(path_to_media_file)))
36+
warn(u"This file: {0} does not exist. Full path: {1}".format(path_to_media_file, os.path.abspath(path_to_media_file)))
3537
return
3638
try:
37-
media = self.instance.media_new(path_to_media_file)
39+
media = self.instance.media_new(encoded_path)
3840
except Exception as e:
3941
logger.exception("exception! {0}".format(e))
4042
warn('NameError: %s (LibVLC %s)' % (sys.exc_info()[1],vlc.libvlc_get_version()))

0 commit comments

Comments
 (0)