[vlc-commits] python bindings: automatically convert strings to bytes for python3

Olivier Aubert git at videolan.org
Mon Sep 10 17:00:15 CEST 2012


vlc/python | branch: master | Olivier Aubert <olivier.aubert at liris.cnrs.fr> | Mon Sep 10 16:38:17 2012 +0200| [f9d1c27b38767a38bd60e41fdad4b3572a7a894d] | committer: Olivier Aubert

python bindings: automatically convert strings to bytes for python3

> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=f9d1c27b38767a38bd60e41fdad4b3572a7a894d
---

 override.py |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/override.py b/override.py
index b4ec6c3..be42fd7 100644
--- a/override.py
+++ b/override.py
@@ -25,6 +25,8 @@ class Instance:
              # no parameters passed, for win32 and MacOS,
              # specify the plugin_path if detected earlier
             args = ['vlc', '--plugin-path=' + plugin_path]
+        if PYTHON3:
+            args = [ str_to_bytes(a) for a in args ]
         return libvlc_new(len(args), args)
 
     def media_player_new(self, uri=None):
@@ -65,12 +67,12 @@ class Instance:
         """
         if ':' in mrl and mrl.index(':') > 1:
             # Assume it is a URL
-            m = libvlc_media_new_location(self, mrl)
+            m = libvlc_media_new_location(self, str_to_bytes(mrl))
         else:
             # Else it should be a local path.
-            m = libvlc_media_new_path(self, mrl)
+            m = libvlc_media_new_path(self, str_to_bytes(mrl))
         for o in options:
-            libvlc_media_add_option(m, o)
+            libvlc_media_add_option(m, str_to_bytes(o))
         m._instance = self
         return m
 



More information about the vlc-commits mailing list