[vlc-commits] In media_new, use either libvlc_media_new_location or libvlc_media_new_path
Olivier Aubert
git at videolan.org
Fri Apr 27 16:48:14 CEST 2012
vlc/python | branch: master | Olivier Aubert <olivier.aubert at liris.cnrs.fr> | Fri Apr 27 16:45:19 2012 +0200| [521b6bc88e9c437e7e7889fe1323f5ed44b0a558] | committer: Olivier Aubert
In media_new, use either libvlc_media_new_location or libvlc_media_new_path
depending on some advanced heuristics about the given mrl...
Knowledgeable users will directly use media_new_location/media_new_path
> http://git.videolan.org/gitweb.cgi/vlc/python.git/?a=commit;h=521b6bc88e9c437e7e7889fe1323f5ed44b0a558
---
override.py | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/override.py b/override.py
index da49ae6..00cf61c 100644
--- a/override.py
+++ b/override.py
@@ -48,6 +48,11 @@ class Instance:
def media_new(self, mrl, *options):
"""Create a new Media instance.
+ If mrl contains a colon (:), it will be treated as a
+ URL. Else, it will be considered as a local path. If you need
+ more control, directly use media_new_location/media_new_path
+ methods.
+
Options can be specified as supplementary string parameters, e.g.
C{m = i.media_new('foo.avi', 'sub-filter=marq{marquee=Hello}', 'vout-filter=invert')}
@@ -58,7 +63,12 @@ class Instance:
@param options: optional media option=value strings
"""
- m = libvlc_media_new_location(self, mrl)
+ if ':' in mrl:
+ # Assume it is a URL
+ m = libvlc_media_new_location(self, mrl)
+ else:
+ # Else it should be a local path.
+ m = libvlc_media_new_path(self, mrl)
for o in options:
libvlc_media_add_option(m, o)
m._instance = self
More information about the vlc-commits
mailing list