From 17a3ec4fef6e761794f490eb198c41812f9a2780 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Wed, 4 Dec 2019 23:06:38 +0300 Subject: [PATCH 1/6] base impl of send to --- app/connections.py | 4 ++-- app/ui/transmitter.glade | 14 ++++++++------ app/ui/transmitter.py | 28 ++++++++++++++++++++-------- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/app/connections.py b/app/connections.py index 0de6844a..715f592a 100644 --- a/app/connections.py +++ b/app/connections.py @@ -278,8 +278,8 @@ class HttpAPI: self._base_url = "http://{}:{}/api/".format(host, port) init_auth(user, password, self._base_url) - from concurrent.futures import ProcessPoolExecutor as PoolExecutor - self._executor = PoolExecutor(max_workers=1) + from concurrent.futures import ThreadPoolExecutor as PoolExecutor + self._executor = PoolExecutor(max_workers=2) def send(self, req_type, ref, callback=print): url = self._base_url + req_type.value diff --git a/app/ui/transmitter.glade b/app/ui/transmitter.glade index f9d1f85d..6a2568de 100644 --- a/app/ui/transmitter.glade +++ b/app/ui/transmitter.glade @@ -49,19 +49,18 @@ Author: Dmitriy Yefremov - + True False - 2 - 2 - 2 - 2 vertical - 5 True True + 2 + 2 + 2 + 2 gtk-dnd-multiple @@ -71,6 +70,9 @@ Author: Dmitriy Yefremov 0 + diff --git a/app/ui/transmitter.py b/app/ui/transmitter.py index 20dd372a..e286edb6 100644 --- a/app/ui/transmitter.py +++ b/app/ui/transmitter.py @@ -3,7 +3,7 @@ from gi.repository import GLib from app.connections import HttpRequestType from app.tools.yt import YouTube from app.ui.iptv import get_yt_icon -from .uicommons import Gtk, UI_RESOURCES_PATH, TEXT_DOMAIN +from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, TEXT_DOMAIN class LinksTransmitter: @@ -27,6 +27,11 @@ class LinksTransmitter: self._main_window = builder.get_object("main_window") self._url_entry = builder.get_object("url_entry") + style_provider = Gtk.CssProvider() + style_provider.load_from_path(UI_RESOURCES_PATH + "style.css") + self._url_entry.get_style_context().add_provider_for_screen(Gdk.Screen.get_default(), style_provider, + Gtk.STYLE_PROVIDER_PRIORITY_USER) + def show(self, show): self._tray.set_visible(show) if not show: @@ -44,18 +49,22 @@ class LinksTransmitter: self._app_window.present() if visible else self._app_window.iconify() def on_query_tooltip(self, icon, g, x, y, tooltip: Gtk.Tooltip): - if self._main_window.get_visible(): + if self._main_window.get_visible() or not self._url_entry.get_text(): return False - tooltip.set_text("Test") + tooltip.set_text(self._url_entry.get_text()) return True - def on_drag_data_received(self, widget, drag_context, x, y, data, info, time): - gen = self.activate_url(data.get_text()) + def on_drag_data_received(self, entry, drag_context, x, y, data, info, time): + url = data.get_text() + GLib.idle_add(entry.set_text, url) + gen = self.activate_url(url) GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW) def activate_url(self, url): + self._url_entry.set_name("GtkEntry") result = urlparse(url) + if result.scheme and result.netloc: self._url_entry.set_sensitive(False) yt_id = YouTube.get_yt_id(url) @@ -67,6 +76,9 @@ class LinksTransmitter: yield True if links: url = links[sorted(links, key=lambda x: int(x.rstrip("p")), reverse=True)[0]] + else: + self.on_play(links) + return else: self._url_entry.set_icon_from_stock(Gtk.EntryIconPosition.SECONDARY, None) @@ -75,9 +87,9 @@ class LinksTransmitter: def on_play(self, res): """ Play callback """ - self._url_entry.set_sensitive(True) - if res: - print(res) + GLib.idle_add(self._url_entry.set_sensitive, True) + res = res.get("result", None) if res else res + self._url_entry.set_name("GtkEntry" if res else "digit-entry") def on_exit(self, item=None): self.show(False) From 24311827bf4dc298129b8ab06e5b37786421ebd5 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Sat, 7 Dec 2019 21:06:18 +0300 Subject: [PATCH 2/6] update vlc --- app/tools/vlc.py | 2896 +++++++++++++++++++++++----------------------- 1 file changed, 1425 insertions(+), 1471 deletions(-) diff --git a/app/tools/vlc.py b/app/tools/vlc.py index 09e7262a..7f3a4374 100644 --- a/app/tools/vlc.py +++ b/app/tools/vlc.py @@ -28,7 +28,7 @@ U{http://wiki.videolan.org/LibVLC}. You can find the documentation and a README file with some examples -at U{http://www.olivieraubert.net/vlc/python-ctypes/}. +at U{https://www.olivieraubert.net/vlc/python-ctypes/}. Basically, the most important class is L{Instance}, which is used to create a libvlc instance. From this instance, you then create @@ -50,13 +50,12 @@ import functools from inspect import getargspec import logging - logger = logging.getLogger(__name__) -__version__ = "3.0.3104" -__libvlc_version__ = "3.0.3" -__generator_version__ = "1.4" -build_date = "Fri Jul 13 15:18:27 2018 3.0.3" +__version__ = "3.0.8111" +__libvlc_version__ = "3.0.8" +__generator_version__ = "1.11" +build_date = "Sun Oct 27 20:26:27 2019 3.0.8" # The libvlc doc states that filenames are expected to be in UTF8, do # not rely on sys.getfilesystemencoding() which will be confused, @@ -69,8 +68,6 @@ if sys.version_info[0] > 2: bytes = bytes basestring = (str, bytes) PYTHON3 = True - - def str_to_bytes(s): """Translate string or bytes to bytes. """ @@ -79,7 +76,6 @@ if sys.version_info[0] > 2: else: return s - def bytes_to_str(b): """Translate bytes to string. """ @@ -93,8 +89,6 @@ else: bytes = str basestring = basestring PYTHON3 = False - - def str_to_bytes(s): """Translate string or bytes to bytes. """ @@ -103,7 +97,6 @@ else: else: return s - def bytes_to_str(b): """Translate bytes to unicode string. """ @@ -116,7 +109,6 @@ else: # instanciated. _internal_guard = object() - def find_lib(): dll = None plugin_path = os.environ.get('PYTHON_VLC_MODULE_PATH', None) @@ -132,13 +124,7 @@ def find_lib(): if dll is not None: return dll, plugin_path - if sys.platform.startswith('linux'): - p = find_library('vlc') - try: - dll = ctypes.CDLL(p) - except OSError: # may fail - dll = ctypes.CDLL('libvlc.so.5') - elif sys.platform.startswith('win'): + if sys.platform.startswith('win'): libname = 'libvlc.dll' p = find_library(libname) if p is None: @@ -163,19 +149,19 @@ def find_lib(): programfiles = os.environ["ProgramFiles"] homedir = os.environ["HOMEDRIVE"] for p in ('{programfiles}\\VideoLan{libname}', '{homedir}:\\VideoLan{libname}', - '{programfiles}{libname}', '{homedir}:{libname}'): - p = p.format(homedir=homedir, - programfiles=programfiles, - libname='\\VLC\\' + libname) + '{programfiles}{libname}', '{homedir}:{libname}'): + p = p.format(homedir = homedir, + programfiles = programfiles, + libname = '\\VLC\\' + libname) if os.path.exists(p): plugin_path = os.path.dirname(p) break if plugin_path is not None: # try loading p = os.getcwd() os.chdir(plugin_path) - # if chdir failed, this will raise an exception + # if chdir failed, this will raise an exception dll = ctypes.CDLL(libname) - # restore cwd after dll has been loaded + # restore cwd after dll has been loaded os.chdir(p) else: # may fail dll = ctypes.CDLL(libname) @@ -203,28 +189,34 @@ def find_lib(): dll = ctypes.CDLL('libvlc.dylib') else: - raise NotImplementedError('%s: %s not supported' % (sys.argv[0], sys.platform)) + # All other OSes (linux, freebsd...) + p = find_library('vlc') + try: + dll = ctypes.CDLL(p) + except OSError: # may fail + dll = None + if dll is None: + try: + dll = ctypes.CDLL('libvlc.so.5') + except: + raise NotImplementedError('Cannot find libvlc lib') return (dll, plugin_path) - # plugin_path used on win32 and MacOS in override.py -dll, plugin_path = find_lib() - +dll, plugin_path = find_lib() class VLCException(Exception): """Exception raised by libvlc methods. """ pass - try: _Ints = (int, long) except NameError: # no long in Python 3+ - _Ints = int + _Ints = int _Seqs = (list, tuple) - # Used for handling *event_manager() methods. class memoize_parameterless(object): """Decorator. Caches a parameterless method's return value each time it is called. @@ -233,7 +225,6 @@ class memoize_parameterless(object): (not reevaluated). Adapted from https://wiki.python.org/moin/PythonDecoratorLibrary """ - def __init__(self, func): self.func = func self._cache = {} @@ -251,16 +242,14 @@ class memoize_parameterless(object): return self.func.__doc__ def __get__(self, obj, objtype): - """Support instance methods. - """ - return functools.partial(self.__call__, obj) - + """Support instance methods. + """ + return functools.partial(self.__call__, obj) # Default instance. It is used to instanciate classes directly in the # OO-wrapper. _default_instance = None - def get_default_instance(): """Return the default VLC.Instance. """ @@ -269,11 +258,18 @@ def get_default_instance(): _default_instance = Instance() return _default_instance +def try_fspath(path): + """Try calling os.fspath + os.fspath is only available from py3.6 + """ + try: + return os.fspath(path) + except (AttributeError, TypeError): + return path _Cfunctions = {} # from LibVLC __version__ _Globals = globals() # sys.modules[__name__].__dict__ - def _Cfunction(name, flags, errcheck, *types): """(INTERNAL) New ctypes function binding. """ @@ -292,7 +288,6 @@ def _Cfunction(name, flags, errcheck, *types): return f raise NameError('no function %r' % (name,)) - def _Cobject(cls, ctype): """(INTERNAL) New instance from ctypes. """ @@ -300,22 +295,19 @@ def _Cobject(cls, ctype): o._as_parameter_ = ctype return o - def _Constructor(cls, ptr=_internal_guard): """(INTERNAL) New wrapper from ctypes. """ if ptr == _internal_guard: - raise VLCException( - "(INTERNAL) ctypes class. You should get references for this class through methods of the LibVLC API.") + raise VLCException("(INTERNAL) ctypes class. You should get references for this class through methods of the LibVLC API.") if ptr is None or ptr == 0: return None return _Cobject(cls, ctypes.c_void_p(ptr)) - class _Cstruct(ctypes.Structure): """(INTERNAL) Base class for ctypes structures. """ - _fields_ = [] # list of 2-tuples ('name', ctyptes.) + _fields_ = [] # list of 2-tuples ('name', ctypes.) def __str__(self): l = [' %s:\t%s' % (n, getattr(self, n)) for n, _ in self._fields_] @@ -324,11 +316,9 @@ class _Cstruct(ctypes.Structure): def __repr__(self): return '%s.%s' % (self.__class__.__module__, self) - class _Ctype(object): """(INTERNAL) Base class for ctypes. """ - @staticmethod def from_param(this): # not self """(INTERNAL) ctypes parameter conversion method. @@ -337,11 +327,9 @@ class _Ctype(object): return None return this._as_parameter_ - class ListPOINTER(object): - """Just like a POINTER but accept a list of ctype as an argument. + """Just like a POINTER but accept a list of etype elements as an argument. """ - def __init__(self, etype): self.etype = etype @@ -351,7 +339,6 @@ class ListPOINTER(object): else: return ctypes.POINTER(param) - # errcheck functions for some native functions. def string_result(result, func, arguments): """Errcheck function. Returns a string and frees the original pointer. @@ -366,33 +353,24 @@ def string_result(result, func, arguments): return s return None - def class_result(classname): """Errcheck function. Returns a function that creates the specified class. """ - def wrap_errcheck(result, func, arguments): if result is None: return None return classname(result) - return wrap_errcheck - # Wrapper for the opaque struct libvlc_log_t class Log(ctypes.Structure): pass - - Log_ptr = ctypes.POINTER(Log) - # FILE* ctypes wrapper, copied from # http://svn.python.org/projects/ctypes/trunk/ctypeslib/ctypeslib/contrib/pythonhdr.py class FILE(ctypes.Structure): pass - - FILE_ptr = ctypes.POINTER(FILE) if PYTHON3: @@ -405,7 +383,7 @@ if PYTHON3: ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, - ctypes.c_int] + ctypes.c_int ] PyFile_AsFd = ctypes.pythonapi.PyObject_AsFileDescriptor PyFile_AsFd.restype = ctypes.c_int @@ -422,8 +400,7 @@ else: PyFile_AsFile.restype = FILE_ptr PyFile_AsFile.argtypes = [ctypes.py_object] - -# Generated enum types # + # Generated enum types # class _Enum(ctypes.c_uint): '''(INTERNAL) Base class @@ -441,13 +418,12 @@ class _Enum(ctypes.c_uint): return '.'.join((self.__class__.__module__, self.__str__())) def __eq__(self, other): - return ((isinstance(other, _Enum) and self.value == other.value) - or (isinstance(other, _Ints) and self.value == other)) + return ( (isinstance(other, _Enum) and self.value == other.value) + or (isinstance(other, _Ints) and self.value == other) ) def __ne__(self, other): return not self.__eq__(other) - class LogLevel(_Enum): '''Logging messages level. \note future libvlc versions may define new levels. @@ -458,14 +434,11 @@ class LogLevel(_Enum): 3: 'WARNING', 4: 'ERROR', } - - -LogLevel.DEBUG = LogLevel(0) -LogLevel.ERROR = LogLevel(4) -LogLevel.NOTICE = LogLevel(2) +LogLevel.DEBUG = LogLevel(0) +LogLevel.ERROR = LogLevel(4) +LogLevel.NOTICE = LogLevel(2) LogLevel.WARNING = LogLevel(3) - class MediaDiscovererCategory(_Enum): '''Category of a media discoverer See libvlc_media_discoverer_list_get(). @@ -476,13 +449,10 @@ See libvlc_media_discoverer_list_get(). 2: 'podcasts', 3: 'localdirs', } - - -MediaDiscovererCategory.devices = MediaDiscovererCategory(0) -MediaDiscovererCategory.lan = MediaDiscovererCategory(1) +MediaDiscovererCategory.devices = MediaDiscovererCategory(0) +MediaDiscovererCategory.lan = MediaDiscovererCategory(1) MediaDiscovererCategory.localdirs = MediaDiscovererCategory(3) -MediaDiscovererCategory.podcasts = MediaDiscovererCategory(2) - +MediaDiscovererCategory.podcasts = MediaDiscovererCategory(2) class DialogQuestionType(_Enum): '''@defgroup libvlc_dialog libvlc dialog @@ -492,16 +462,13 @@ class DialogQuestionType(_Enum): libvlc dialog external api. ''' _enum_names_ = { - 0: 'NORMAL', - 1: 'WARNING', - 2: 'CRITICAL', + 0: 'DIALOG_QUESTION_NORMAL', + 1: 'DIALOG_QUESTION_WARNING', + 2: 'DIALOG_QUESTION_CRITICAL', } - - -DialogQuestionType.CRITICAL = DialogQuestionType(2) -DialogQuestionType.NORMAL = DialogQuestionType(0) -DialogQuestionType.WARNING = DialogQuestionType(1) - +DialogQuestionType.DIALOG_QUESTION_CRITICAL = DialogQuestionType(2) +DialogQuestionType.DIALOG_QUESTION_NORMAL = DialogQuestionType(0) +DialogQuestionType.DIALOG_QUESTION_WARNING = DialogQuestionType(1) class EventType(_Enum): '''Event types. @@ -572,73 +539,70 @@ class EventType(_Enum): 1545: 'VlmMediaInstanceStatusEnd', 1546: 'VlmMediaInstanceStatusError', } - - -EventType.MediaDiscovererEnded = EventType(1281) -EventType.MediaDiscovererStarted = EventType(0x500) -EventType.MediaDurationChanged = EventType(2) -EventType.MediaFreed = EventType(4) -EventType.MediaListEndReached = EventType(516) -EventType.MediaListItemAdded = EventType(0x200) -EventType.MediaListItemDeleted = EventType(514) -EventType.MediaListPlayerNextItemSet = EventType(1025) -EventType.MediaListPlayerPlayed = EventType(0x400) -EventType.MediaListPlayerStopped = EventType(1026) -EventType.MediaListViewItemAdded = EventType(0x300) -EventType.MediaListViewItemDeleted = EventType(770) -EventType.MediaListViewWillAddItem = EventType(769) -EventType.MediaListViewWillDeleteItem = EventType(771) -EventType.MediaListWillAddItem = EventType(513) -EventType.MediaListWillDeleteItem = EventType(515) -EventType.MediaMetaChanged = EventType(0) -EventType.MediaParsedChanged = EventType(3) -EventType.MediaPlayerAudioDevice = EventType(284) -EventType.MediaPlayerAudioVolume = EventType(283) -EventType.MediaPlayerBackward = EventType(264) -EventType.MediaPlayerBuffering = EventType(259) -EventType.MediaPlayerChapterChanged = EventType(285) -EventType.MediaPlayerCorked = EventType(279) -EventType.MediaPlayerESAdded = EventType(276) -EventType.MediaPlayerESDeleted = EventType(277) -EventType.MediaPlayerESSelected = EventType(278) -EventType.MediaPlayerEncounteredError = EventType(266) -EventType.MediaPlayerEndReached = EventType(265) -EventType.MediaPlayerForward = EventType(263) -EventType.MediaPlayerLengthChanged = EventType(273) -EventType.MediaPlayerMediaChanged = EventType(0x100) -EventType.MediaPlayerMuted = EventType(281) -EventType.MediaPlayerNothingSpecial = EventType(257) -EventType.MediaPlayerOpening = EventType(258) -EventType.MediaPlayerPausableChanged = EventType(270) -EventType.MediaPlayerPaused = EventType(261) -EventType.MediaPlayerPlaying = EventType(260) -EventType.MediaPlayerPositionChanged = EventType(268) -EventType.MediaPlayerScrambledChanged = EventType(275) -EventType.MediaPlayerSeekableChanged = EventType(269) -EventType.MediaPlayerSnapshotTaken = EventType(272) -EventType.MediaPlayerStopped = EventType(262) -EventType.MediaPlayerTimeChanged = EventType(267) -EventType.MediaPlayerTitleChanged = EventType(271) -EventType.MediaPlayerUncorked = EventType(280) -EventType.MediaPlayerUnmuted = EventType(282) -EventType.MediaPlayerVout = EventType(274) -EventType.MediaStateChanged = EventType(5) -EventType.MediaSubItemAdded = EventType(1) -EventType.MediaSubItemTreeAdded = EventType(6) -EventType.RendererDiscovererItemAdded = EventType(1282) +EventType.MediaDiscovererEnded = EventType(1281) +EventType.MediaDiscovererStarted = EventType(0x500) +EventType.MediaDurationChanged = EventType(2) +EventType.MediaFreed = EventType(4) +EventType.MediaListEndReached = EventType(516) +EventType.MediaListItemAdded = EventType(0x200) +EventType.MediaListItemDeleted = EventType(514) +EventType.MediaListPlayerNextItemSet = EventType(1025) +EventType.MediaListPlayerPlayed = EventType(0x400) +EventType.MediaListPlayerStopped = EventType(1026) +EventType.MediaListViewItemAdded = EventType(0x300) +EventType.MediaListViewItemDeleted = EventType(770) +EventType.MediaListViewWillAddItem = EventType(769) +EventType.MediaListViewWillDeleteItem = EventType(771) +EventType.MediaListWillAddItem = EventType(513) +EventType.MediaListWillDeleteItem = EventType(515) +EventType.MediaMetaChanged = EventType(0) +EventType.MediaParsedChanged = EventType(3) +EventType.MediaPlayerAudioDevice = EventType(284) +EventType.MediaPlayerAudioVolume = EventType(283) +EventType.MediaPlayerBackward = EventType(264) +EventType.MediaPlayerBuffering = EventType(259) +EventType.MediaPlayerChapterChanged = EventType(285) +EventType.MediaPlayerCorked = EventType(279) +EventType.MediaPlayerESAdded = EventType(276) +EventType.MediaPlayerESDeleted = EventType(277) +EventType.MediaPlayerESSelected = EventType(278) +EventType.MediaPlayerEncounteredError = EventType(266) +EventType.MediaPlayerEndReached = EventType(265) +EventType.MediaPlayerForward = EventType(263) +EventType.MediaPlayerLengthChanged = EventType(273) +EventType.MediaPlayerMediaChanged = EventType(0x100) +EventType.MediaPlayerMuted = EventType(281) +EventType.MediaPlayerNothingSpecial = EventType(257) +EventType.MediaPlayerOpening = EventType(258) +EventType.MediaPlayerPausableChanged = EventType(270) +EventType.MediaPlayerPaused = EventType(261) +EventType.MediaPlayerPlaying = EventType(260) +EventType.MediaPlayerPositionChanged = EventType(268) +EventType.MediaPlayerScrambledChanged = EventType(275) +EventType.MediaPlayerSeekableChanged = EventType(269) +EventType.MediaPlayerSnapshotTaken = EventType(272) +EventType.MediaPlayerStopped = EventType(262) +EventType.MediaPlayerTimeChanged = EventType(267) +EventType.MediaPlayerTitleChanged = EventType(271) +EventType.MediaPlayerUncorked = EventType(280) +EventType.MediaPlayerUnmuted = EventType(282) +EventType.MediaPlayerVout = EventType(274) +EventType.MediaStateChanged = EventType(5) +EventType.MediaSubItemAdded = EventType(1) +EventType.MediaSubItemTreeAdded = EventType(6) +EventType.RendererDiscovererItemAdded = EventType(1282) EventType.RendererDiscovererItemDeleted = EventType(1283) -EventType.VlmMediaAdded = EventType(0x600) -EventType.VlmMediaChanged = EventType(1538) -EventType.VlmMediaInstanceStarted = EventType(1539) -EventType.VlmMediaInstanceStatusEnd = EventType(1545) -EventType.VlmMediaInstanceStatusError = EventType(1546) -EventType.VlmMediaInstanceStatusInit = EventType(1541) +EventType.VlmMediaAdded = EventType(0x600) +EventType.VlmMediaChanged = EventType(1538) +EventType.VlmMediaInstanceStarted = EventType(1539) +EventType.VlmMediaInstanceStatusEnd = EventType(1545) +EventType.VlmMediaInstanceStatusError = EventType(1546) +EventType.VlmMediaInstanceStatusInit = EventType(1541) EventType.VlmMediaInstanceStatusOpening = EventType(1542) -EventType.VlmMediaInstanceStatusPause = EventType(1544) +EventType.VlmMediaInstanceStatusPause = EventType(1544) EventType.VlmMediaInstanceStatusPlaying = EventType(1543) -EventType.VlmMediaInstanceStopped = EventType(1540) -EventType.VlmMediaRemoved = EventType(1537) - +EventType.VlmMediaInstanceStopped = EventType(1540) +EventType.VlmMediaRemoved = EventType(1537) class Meta(_Enum): '''Meta data types. @@ -671,35 +635,32 @@ class Meta(_Enum): 24: 'DiscNumber', 25: 'DiscTotal', } - - -Meta.Actors = Meta(22) -Meta.Album = Meta(4) +Meta.Actors = Meta(22) +Meta.Album = Meta(4) Meta.AlbumArtist = Meta(23) -Meta.Artist = Meta(1) -Meta.ArtworkURL = Meta(15) -Meta.Copyright = Meta(3) -Meta.Date = Meta(8) +Meta.Artist = Meta(1) +Meta.ArtworkURL = Meta(15) +Meta.Copyright = Meta(3) +Meta.Date = Meta(8) Meta.Description = Meta(6) -Meta.Director = Meta(18) -Meta.DiscNumber = Meta(24) -Meta.DiscTotal = Meta(25) -Meta.EncodedBy = Meta(14) -Meta.Episode = Meta(20) -Meta.Genre = Meta(2) -Meta.Language = Meta(11) -Meta.NowPlaying = Meta(12) -Meta.Publisher = Meta(13) -Meta.Rating = Meta(7) -Meta.Season = Meta(19) -Meta.Setting = Meta(9) -Meta.ShowName = Meta(21) -Meta.Title = Meta(0) -Meta.TrackID = Meta(16) +Meta.Director = Meta(18) +Meta.DiscNumber = Meta(24) +Meta.DiscTotal = Meta(25) +Meta.EncodedBy = Meta(14) +Meta.Episode = Meta(20) +Meta.Genre = Meta(2) +Meta.Language = Meta(11) +Meta.NowPlaying = Meta(12) +Meta.Publisher = Meta(13) +Meta.Rating = Meta(7) +Meta.Season = Meta(19) +Meta.Setting = Meta(9) +Meta.ShowName = Meta(21) +Meta.Title = Meta(0) +Meta.TrackID = Meta(16) Meta.TrackNumber = Meta(5) -Meta.TrackTotal = Meta(17) -Meta.URL = Meta(10) - +Meta.TrackTotal = Meta(17) +Meta.URL = Meta(10) class State(_Enum): '''Note the order of libvlc_state_t enum must match exactly the order of @@ -719,17 +680,14 @@ stopping=5, ended=6, error=7. 6: 'Ended', 7: 'Error', } - - -State.Buffering = State(2) -State.Ended = State(6) -State.Error = State(7) +State.Buffering = State(2) +State.Ended = State(6) +State.Error = State(7) State.NothingSpecial = State(0) -State.Opening = State(1) -State.Paused = State(4) -State.Playing = State(3) -State.Stopped = State(5) - +State.Opening = State(1) +State.Paused = State(4) +State.Playing = State(3) +State.Stopped = State(5) class TrackType(_Enum): '''N/A @@ -738,40 +696,34 @@ class TrackType(_Enum): -1: 'unknown', 0: 'audio', 1: 'video', - 2: 'text', + 2: 'ext', } - - -TrackType.audio = TrackType(0) -TrackType.text = TrackType(2) +TrackType.audio = TrackType(0) +TrackType.ext = TrackType(2) TrackType.unknown = TrackType(-1) -TrackType.video = TrackType(1) - +TrackType.video = TrackType(1) class VideoOrient(_Enum): '''N/A ''' _enum_names_ = { - 0: 'left', - 1: 'right', - 2: 'left', - 3: 'right', - 4: 'top', - 5: 'bottom', - 6: 'top', - 7: 'bottom', + 0: 'top_left', + 1: 'top_right', + 2: 'bottom_left', + 3: 'bottom_right', + 4: 'left_top', + 5: 'left_bottom', + 6: 'right_top', + 7: 'right_bottom', } - - -VideoOrient.bottom = VideoOrient(5) -VideoOrient.bottom = VideoOrient(7) -VideoOrient.left = VideoOrient(0) -VideoOrient.left = VideoOrient(2) -VideoOrient.right = VideoOrient(1) -VideoOrient.right = VideoOrient(3) -VideoOrient.top = VideoOrient(4) -VideoOrient.top = VideoOrient(6) - +VideoOrient.bottom_left = VideoOrient(2) +VideoOrient.bottom_right = VideoOrient(3) +VideoOrient.left_bottom = VideoOrient(5) +VideoOrient.left_top = VideoOrient(4) +VideoOrient.right_bottom = VideoOrient(7) +VideoOrient.right_top = VideoOrient(6) +VideoOrient.top_left = VideoOrient(0) +VideoOrient.top_right = VideoOrient(1) class VideoProjection(_Enum): '''N/A @@ -779,14 +731,11 @@ class VideoProjection(_Enum): _enum_names_ = { 0: 'rectangular', 1: 'equirectangular', - 0x100: 'standard', + 0x100: 'cubemap_layout_standard', } - - -VideoProjection.equirectangular = VideoProjection(1) -VideoProjection.rectangular = VideoProjection(0) -VideoProjection.standard = VideoProjection(0x100) - +VideoProjection.cubemap_layout_standard = VideoProjection(0x100) +VideoProjection.equirectangular = VideoProjection(1) +VideoProjection.rectangular = VideoProjection(0) class MediaType(_Enum): '''Media type @@ -800,15 +749,12 @@ See libvlc_media_get_type. 4: 'stream', 5: 'playlist', } - - MediaType.directory = MediaType(2) -MediaType.disc = MediaType(3) -MediaType.file = MediaType(1) -MediaType.playlist = MediaType(5) -MediaType.stream = MediaType(4) -MediaType.unknown = MediaType(0) - +MediaType.disc = MediaType(3) +MediaType.file = MediaType(1) +MediaType.playlist = MediaType(5) +MediaType.stream = MediaType(4) +MediaType.unknown = MediaType(0) class MediaParseFlag(_Enum): '''Parse flags used by libvlc_media_parse_with_options() @@ -817,18 +763,15 @@ See libvlc_media_parse_with_options. _enum_names_ = { 0x0: 'local', 0x1: 'network', - 0x2: 'local', - 0x4: 'network', - 0x8: 'interact', + 0x2: 'fetch_local', + 0x4: 'fetch_network', + 0x8: 'do_interact', } - - -MediaParseFlag.interact = MediaParseFlag(0x8) -MediaParseFlag.local = MediaParseFlag(0x0) -MediaParseFlag.local = MediaParseFlag(0x2) -MediaParseFlag.network = MediaParseFlag(0x1) -MediaParseFlag.network = MediaParseFlag(0x4) - +MediaParseFlag.do_interact = MediaParseFlag(0x8) +MediaParseFlag.fetch_local = MediaParseFlag(0x2) +MediaParseFlag.fetch_network = MediaParseFlag(0x4) +MediaParseFlag.local = MediaParseFlag(0x0) +MediaParseFlag.network = MediaParseFlag(0x1) class MediaParsedStatus(_Enum): '''Parse status used sent by libvlc_media_parse_with_options() or returned by @@ -842,14 +785,11 @@ See libvlc_media_get_parsed_status. 3: 'timeout', 4: 'done', } - - -MediaParsedStatus.done = MediaParsedStatus(4) -MediaParsedStatus.failed = MediaParsedStatus(2) +MediaParsedStatus.done = MediaParsedStatus(4) +MediaParsedStatus.failed = MediaParsedStatus(2) MediaParsedStatus.skipped = MediaParsedStatus(1) MediaParsedStatus.timeout = MediaParsedStatus(3) - class MediaSlaveType(_Enum): '''Type of a media slave: subtitle or audio. ''' @@ -857,12 +797,9 @@ class MediaSlaveType(_Enum): 0: 'subtitle', 1: 'audio', } - - -MediaSlaveType.audio = MediaSlaveType(1) +MediaSlaveType.audio = MediaSlaveType(1) MediaSlaveType.subtitle = MediaSlaveType(0) - class VideoMarqueeOption(_Enum): '''Marq options definition. ''' @@ -875,22 +812,19 @@ class VideoMarqueeOption(_Enum): 5: 'Refresh', 6: 'Size', 7: 'Timeout', - 8: 'marquee_X', - 9: 'marquee_Y', + 8: 'X', + 9: 'Y', } - - -VideoMarqueeOption.Color = VideoMarqueeOption(2) -VideoMarqueeOption.Enable = VideoMarqueeOption(0) -VideoMarqueeOption.Opacity = VideoMarqueeOption(3) +VideoMarqueeOption.Color = VideoMarqueeOption(2) +VideoMarqueeOption.Enable = VideoMarqueeOption(0) +VideoMarqueeOption.Opacity = VideoMarqueeOption(3) VideoMarqueeOption.Position = VideoMarqueeOption(4) -VideoMarqueeOption.Refresh = VideoMarqueeOption(5) -VideoMarqueeOption.Size = VideoMarqueeOption(6) -VideoMarqueeOption.Text = VideoMarqueeOption(1) -VideoMarqueeOption.Timeout = VideoMarqueeOption(7) -VideoMarqueeOption.marquee_X = VideoMarqueeOption(8) -VideoMarqueeOption.marquee_Y = VideoMarqueeOption(9) - +VideoMarqueeOption.Refresh = VideoMarqueeOption(5) +VideoMarqueeOption.Size = VideoMarqueeOption(6) +VideoMarqueeOption.Text = VideoMarqueeOption(1) +VideoMarqueeOption.Timeout = VideoMarqueeOption(7) +VideoMarqueeOption.X = VideoMarqueeOption(8) +VideoMarqueeOption.Y = VideoMarqueeOption(9) class NavigateMode(_Enum): '''Navigation mode. @@ -903,15 +837,12 @@ class NavigateMode(_Enum): 4: 'right', 5: 'popup', } - - NavigateMode.activate = NavigateMode(0) -NavigateMode.down = NavigateMode(2) -NavigateMode.left = NavigateMode(3) -NavigateMode.popup = NavigateMode(5) -NavigateMode.right = NavigateMode(4) -NavigateMode.up = NavigateMode(1) - +NavigateMode.down = NavigateMode(2) +NavigateMode.left = NavigateMode(3) +NavigateMode.popup = NavigateMode(5) +NavigateMode.right = NavigateMode(4) +NavigateMode.up = NavigateMode(1) class Position(_Enum): '''Enumeration of values used to set position (e.g. of video title). @@ -922,25 +853,22 @@ class Position(_Enum): 1: 'left', 2: 'right', 3: 'top', - 4: 'left', - 5: 'right', + 4: 'top_left', + 5: 'top_right', 6: 'bottom', - 7: 'left', - 8: 'right', + 7: 'bottom_left', + 8: 'bottom_right', } - - -Position.bottom = Position(6) -Position.center = Position(0) -Position.disable = Position(-1) -Position.left = Position(1) -Position.left = Position(4) -Position.left = Position(7) -Position.right = Position(2) -Position.right = Position(5) -Position.right = Position(8) -Position.top = Position(3) - +Position.bottom = Position(6) +Position.bottom_left = Position(7) +Position.bottom_right = Position(8) +Position.center = Position(0) +Position.disable = Position(-1) +Position.left = Position(1) +Position.right = Position(2) +Position.top = Position(3) +Position.top_left = Position(4) +Position.top_right = Position(5) class TeletextKey(_Enum): '''Enumeration of teletext keys than can be passed via @@ -953,39 +881,33 @@ libvlc_video_set_teletext(). 6422528: 'blue', 6881280: 'index', } - - -TeletextKey.blue = TeletextKey(6422528) -TeletextKey.green = TeletextKey(6750208) -TeletextKey.index = TeletextKey(6881280) -TeletextKey.red = TeletextKey(7471104) +TeletextKey.blue = TeletextKey(6422528) +TeletextKey.green = TeletextKey(6750208) +TeletextKey.index = TeletextKey(6881280) +TeletextKey.red = TeletextKey(7471104) TeletextKey.yellow = TeletextKey(7929856) - class VideoLogoOption(_Enum): '''Option values for libvlc_video_{get,set}_logo_{int,string}. ''' _enum_names_ = { - 0: 'enable', - 1: 'file', + 0: 'logo_enable', + 1: 'logo_file', 2: 'logo_x', 3: 'logo_y', - 4: 'delay', - 5: 'repeat', - 6: 'opacity', - 7: 'position', + 4: 'logo_delay', + 5: 'logo_repeat', + 6: 'logo_opacity', + 7: 'logo_position', } - - -VideoLogoOption.delay = VideoLogoOption(4) -VideoLogoOption.enable = VideoLogoOption(0) -VideoLogoOption.file = VideoLogoOption(1) -VideoLogoOption.logo_x = VideoLogoOption(2) -VideoLogoOption.logo_y = VideoLogoOption(3) -VideoLogoOption.opacity = VideoLogoOption(6) -VideoLogoOption.position = VideoLogoOption(7) -VideoLogoOption.repeat = VideoLogoOption(5) - +VideoLogoOption.logo_delay = VideoLogoOption(4) +VideoLogoOption.logo_enable = VideoLogoOption(0) +VideoLogoOption.logo_file = VideoLogoOption(1) +VideoLogoOption.logo_opacity = VideoLogoOption(6) +VideoLogoOption.logo_position = VideoLogoOption(7) +VideoLogoOption.logo_repeat = VideoLogoOption(5) +VideoLogoOption.logo_x = VideoLogoOption(2) +VideoLogoOption.logo_y = VideoLogoOption(3) class VideoAdjustOption(_Enum): '''Option values for libvlc_video_{get,set}_adjust_{int,float,bool}. @@ -998,16 +920,13 @@ class VideoAdjustOption(_Enum): 4: 'Saturation', 5: 'Gamma', } - - VideoAdjustOption.Brightness = VideoAdjustOption(2) -VideoAdjustOption.Contrast = VideoAdjustOption(1) -VideoAdjustOption.Enable = VideoAdjustOption(0) -VideoAdjustOption.Gamma = VideoAdjustOption(5) -VideoAdjustOption.Hue = VideoAdjustOption(3) +VideoAdjustOption.Contrast = VideoAdjustOption(1) +VideoAdjustOption.Enable = VideoAdjustOption(0) +VideoAdjustOption.Gamma = VideoAdjustOption(5) +VideoAdjustOption.Hue = VideoAdjustOption(3) VideoAdjustOption.Saturation = VideoAdjustOption(4) - class AudioOutputDeviceTypes(_Enum): '''Audio device types. ''' @@ -1022,18 +941,15 @@ class AudioOutputDeviceTypes(_Enum): 8: '_7_1', 10: 'SPDIF', } - - -AudioOutputDeviceTypes.Error = AudioOutputDeviceTypes(-1) -AudioOutputDeviceTypes.Mono = AudioOutputDeviceTypes(1) -AudioOutputDeviceTypes.SPDIF = AudioOutputDeviceTypes(10) +AudioOutputDeviceTypes.Error = AudioOutputDeviceTypes(-1) +AudioOutputDeviceTypes.Mono = AudioOutputDeviceTypes(1) +AudioOutputDeviceTypes.SPDIF = AudioOutputDeviceTypes(10) AudioOutputDeviceTypes.Stereo = AudioOutputDeviceTypes(2) -AudioOutputDeviceTypes._2F2R = AudioOutputDeviceTypes(4) -AudioOutputDeviceTypes._3F2R = AudioOutputDeviceTypes(5) -AudioOutputDeviceTypes._5_1 = AudioOutputDeviceTypes(6) -AudioOutputDeviceTypes._6_1 = AudioOutputDeviceTypes(7) -AudioOutputDeviceTypes._7_1 = AudioOutputDeviceTypes(8) - +AudioOutputDeviceTypes._2F2R = AudioOutputDeviceTypes(4) +AudioOutputDeviceTypes._3F2R = AudioOutputDeviceTypes(5) +AudioOutputDeviceTypes._5_1 = AudioOutputDeviceTypes(6) +AudioOutputDeviceTypes._6_1 = AudioOutputDeviceTypes(7) +AudioOutputDeviceTypes._7_1 = AudioOutputDeviceTypes(8) class AudioOutputChannel(_Enum): '''Audio channels. @@ -1046,15 +962,12 @@ class AudioOutputChannel(_Enum): 4: 'Right', 5: 'Dolbys', } - - -AudioOutputChannel.Dolbys = AudioOutputChannel(5) -AudioOutputChannel.Error = AudioOutputChannel(-1) -AudioOutputChannel.Left = AudioOutputChannel(3) +AudioOutputChannel.Dolbys = AudioOutputChannel(5) +AudioOutputChannel.Error = AudioOutputChannel(-1) +AudioOutputChannel.Left = AudioOutputChannel(3) AudioOutputChannel.RStereo = AudioOutputChannel(2) -AudioOutputChannel.Right = AudioOutputChannel(4) -AudioOutputChannel.Stereo = AudioOutputChannel(1) - +AudioOutputChannel.Right = AudioOutputChannel(4) +AudioOutputChannel.Stereo = AudioOutputChannel(1) class MediaPlayerRole(_Enum): '''Media player roles. @@ -1073,19 +986,16 @@ see \ref libvlc_media_player_set_role(). 8: 'Accessibility', 9: 'Test', } - - MediaPlayerRole.Accessibility = MediaPlayerRole(8) -MediaPlayerRole.Animation = MediaPlayerRole(6) +MediaPlayerRole.Animation = MediaPlayerRole(6) MediaPlayerRole.Communication = MediaPlayerRole(3) -MediaPlayerRole.Game = MediaPlayerRole(4) -MediaPlayerRole.Music = MediaPlayerRole(1) -MediaPlayerRole.Notification = MediaPlayerRole(5) -MediaPlayerRole.Production = MediaPlayerRole(7) -MediaPlayerRole.Test = MediaPlayerRole(9) -MediaPlayerRole.Video = MediaPlayerRole(2) -MediaPlayerRole._None = MediaPlayerRole(0) - +MediaPlayerRole.Game = MediaPlayerRole(4) +MediaPlayerRole.Music = MediaPlayerRole(1) +MediaPlayerRole.Notification = MediaPlayerRole(5) +MediaPlayerRole.Production = MediaPlayerRole(7) +MediaPlayerRole.Test = MediaPlayerRole(9) +MediaPlayerRole.Video = MediaPlayerRole(2) +MediaPlayerRole._None = MediaPlayerRole(0) class PlaybackMode(_Enum): '''Defines playback modes for playlist. @@ -1095,20 +1005,362 @@ class PlaybackMode(_Enum): 1: 'loop', 2: 'repeat', } - - PlaybackMode.default = PlaybackMode(0) -PlaybackMode.loop = PlaybackMode(1) -PlaybackMode.repeat = PlaybackMode(2) +PlaybackMode.loop = PlaybackMode(1) +PlaybackMode.repeat = PlaybackMode(2) + + # End of generated enum types # + + # From libvlc_structures.h + +class AudioOutput(_Cstruct): + + def __str__(self): + return '%s(%s:%s)' % (self.__class__.__name__, self.name, self.description) + +AudioOutput._fields_ = [ # recursive struct + ('name', ctypes.c_char_p), + ('description', ctypes.c_char_p), + ('next', ctypes.POINTER(AudioOutput)), + ] + +class LogMessage(_Cstruct): + _fields_ = [ + ('size', ctypes.c_uint ), + ('severity', ctypes.c_int ), + ('type', ctypes.c_char_p), + ('name', ctypes.c_char_p), + ('header', ctypes.c_char_p), + ('message', ctypes.c_char_p), + ] + + def __init__(self): + super(LogMessage, self).__init__() + self.size = ctypes.sizeof(self) + + def __str__(self): + return '%s(%d:%s): %s' % (self.__class__.__name__, self.severity, self.type, self.message) + +class MediaEvent(_Cstruct): + _fields_ = [ + ('media_name', ctypes.c_char_p), + ('instance_name', ctypes.c_char_p), + ] + +class MediaStats(_Cstruct): + _fields_ = [ + ('read_bytes', ctypes.c_int ), + ('input_bitrate', ctypes.c_float), + ('demux_read_bytes', ctypes.c_int ), + ('demux_bitrate', ctypes.c_float), + ('demux_corrupted', ctypes.c_int ), + ('demux_discontinuity', ctypes.c_int ), + ('decoded_video', ctypes.c_int ), + ('decoded_audio', ctypes.c_int ), + ('displayed_pictures', ctypes.c_int ), + ('lost_pictures', ctypes.c_int ), + ('played_abuffers', ctypes.c_int ), + ('lost_abuffers', ctypes.c_int ), + ('sent_packets', ctypes.c_int ), + ('sent_bytes', ctypes.c_int ), + ('send_bitrate', ctypes.c_float), + ] + +class MediaTrackInfo(_Cstruct): + _fields_ = [ + ('codec', ctypes.c_uint32), + ('id', ctypes.c_int ), + ('type', TrackType ), + ('profile', ctypes.c_int ), + ('level', ctypes.c_int ), + ('channels_or_height', ctypes.c_uint ), + ('rate_or_width', ctypes.c_uint ), + ] + +class AudioTrack(_Cstruct): + _fields_ = [ + ('channels', ctypes.c_uint), + ('rate', ctypes.c_uint), + ] + +class VideoTrack(_Cstruct): + _fields_ = [ + ('height', ctypes.c_uint), + ('width', ctypes.c_uint), + ('sar_num', ctypes.c_uint), + ('sar_den', ctypes.c_uint), + ('frame_rate_num', ctypes.c_uint), + ('frame_rate_den', ctypes.c_uint), + ] + +class SubtitleTrack(_Cstruct): + _fields_ = [ + ('encoding', ctypes.c_char_p), + ] + +class MediaTrackTracks(ctypes.Union): + _fields_ = [ + ('audio', ctypes.POINTER(AudioTrack)), + ('video', ctypes.POINTER(VideoTrack)), + ('subtitle', ctypes.POINTER(SubtitleTrack)), + ] + +class MediaTrack(_Cstruct): + _anonymous_ = ("u",) + _fields_ = [ + ('codec', ctypes.c_uint32), + ('original_fourcc', ctypes.c_uint32), + ('id', ctypes.c_int ), + ('type', TrackType ), + ('profile', ctypes.c_int ), + ('level', ctypes.c_int ), + + ('u', MediaTrackTracks), + ('bitrate', ctypes.c_uint), + ('language', ctypes.c_char_p), + ('description', ctypes.c_char_p), + ] + +class PlaylistItem(_Cstruct): + _fields_ = [ + ('id', ctypes.c_int ), + ('uri', ctypes.c_char_p), + ('name', ctypes.c_char_p), + ] + + def __str__(self): + return '%s #%d %s (uri %s)' % (self.__class__.__name__, self.id, self.name, self.uri) + +class Position(object): + """Enum-like, immutable window position constants. + + See e.g. VideoMarqueeOption.Position. + """ + Center = 0 + Left = 1 + CenterLeft = 1 + Right = 2 + CenterRight = 2 + Top = 4 + TopCenter = 4 + TopLeft = 5 + TopRight = 6 + Bottom = 8 + BottomCenter = 8 + BottomLeft = 9 + BottomRight = 10 + def __init__(self, *unused): + raise TypeError('constants only') + def __setattr__(self, *unused): #PYCHOK expected + raise TypeError('immutable constants') + +class Rectangle(_Cstruct): + _fields_ = [ + ('top', ctypes.c_int), + ('left', ctypes.c_int), + ('bottom', ctypes.c_int), + ('right', ctypes.c_int), + ] + +class TrackDescription(_Cstruct): + + def __str__(self): + return '%s(%d:%s)' % (self.__class__.__name__, self.id, self.name) + +TrackDescription._fields_ = [ # recursive struct + ('id', ctypes.c_int ), + ('name', ctypes.c_char_p), + ('next', ctypes.POINTER(TrackDescription)), + ] + +def track_description_list(head): + """Convert a TrackDescription linked list to a Python list (and release the former). + """ + r = [] + if head: + item = head + while item: + item = item.contents + r.append((item.id, item.name)) + item = item.next + try: + libvlc_track_description_release(head) + except NameError: + libvlc_track_description_list_release(head) + + return r + +class EventUnion(ctypes.Union): + _fields_ = [ + ('meta_type', ctypes.c_uint ), + ('new_child', ctypes.c_uint ), + ('new_duration', ctypes.c_longlong), + ('new_status', ctypes.c_int ), + ('media', ctypes.c_void_p ), + ('new_state', ctypes.c_uint ), + # FIXME: Media instance + ('new_cache', ctypes.c_float ), + ('new_position', ctypes.c_float ), + ('new_time', ctypes.c_longlong), + ('new_title', ctypes.c_int ), + ('new_seekable', ctypes.c_longlong), + ('new_pausable', ctypes.c_longlong), + ('new_scrambled', ctypes.c_longlong), + ('new_count', ctypes.c_longlong), + # FIXME: Skipped MediaList and MediaListView... + ('filename', ctypes.c_char_p ), + ('new_length', ctypes.c_longlong), + ('media_event', MediaEvent ), + ] + +class Event(_Cstruct): + _fields_ = [ + ('type', EventType ), + ('object', ctypes.c_void_p), + ('u', EventUnion ), + ] + +class ModuleDescription(_Cstruct): + + def __str__(self): + return '%s %s (%s)' % (self.__class__.__name__, self.shortname, self.name) + +ModuleDescription._fields_ = [ # recursive struct + ('name', ctypes.c_char_p), + ('shortname', ctypes.c_char_p), + ('longname', ctypes.c_char_p), + ('help', ctypes.c_char_p), + ('next', ctypes.POINTER(ModuleDescription)), + ] + +def module_description_list(head): + """Convert a ModuleDescription linked list to a Python list (and release the former). + """ + r = [] + if head: + item = head + while item: + item = item.contents + r.append((item.name, item.shortname, item.longname, item.help)) + item = item.next + libvlc_module_description_list_release(head) + return r + +class AudioOutputDevice(_Cstruct): + + def __str__(self): + return '%s(%d:%s)' % (self.__class__.__name__, self.id, self.name) + +AudioOutputDevice._fields_ = [ # recursive struct + ('next', ctypes.POINTER(AudioOutputDevice)), + ('device', ctypes.c_char_p ), + ('description', ctypes.c_char_p), + ] + +class TitleDescription(_Cstruct): + _fields_ = [ + ('duration', ctypes.c_longlong), + ('name', ctypes.c_char_p), + ('menu', ctypes.c_bool), + ] + +class ChapterDescription(_Cstruct): + _fields_ = [ + ('time_offset', ctypes.c_longlong), + ('duration', ctypes.c_longlong), + ('name', ctypes.c_char_p), + ] + +class VideoViewpoint(_Cstruct): + _fields_ = [ + ('yaw', ctypes.c_float), + ('pitch', ctypes.c_float), + ('roll', ctypes.c_float), + ('field_of_view', ctypes.c_float), + ] + +class MediaDiscovererDescription(_Cstruct): + _fields_ = [ + ('name', ctypes.c_char_p), + ('longname', ctypes.c_char_p), + ('cat', MediaDiscovererCategory), + ] + + def __str__(self): + return '%s %s (%d) - %s' % (self.__class__.__name__, self.name, self.cat, self.longname) + +# This struct depends on the MediaSlaveType enum that is defined only +# in > 2.2 +if 'MediaSlaveType' in locals(): + class MediaSlave(_Cstruct): + _fields_ = [ + ('psz_uri', ctypes.c_char_p), + ('i_type', MediaSlaveType), + ('i_priority', ctypes.c_uint) + ] + +class RDDescription(_Cstruct): + _fields_ = [ + ('name', ctypes.c_char_p), + ('longname', ctypes.c_char_p) + ] +class MediaThumbnailRequest: + def __new__(cls, *args): + if len(args) == 1 and isinstance(args[0], _Ints): + return _Constructor(cls, args[0]) + +class Direct3dDeviceSetup(_Cstruct): + _fields_ = [ + ('device_context', ctypes.c_void_p), + ] + +class Direct3dDeviceCfg(_Cstruct): + _fields_ = [ + ('hardware_decoding', ctypes.c_bool), + ] + +class Direct3dCfg(_Cstruct): + _fields_ = [ + ('width', ctypes.c_uint), + ('height', ctypes.c_uint), + ('bitdepth', ctypes.c_uint), + ('full_range', ctypes.c_bool), + # FIXME: should be references to enums + ('colorspace', ctypes.c_uint), + ('primaries', ctypes.c_uint), + ('transfer', ctypes.c_uint), + ] + +class VideoOutputCfg(_Cstruct): + _fields_ = [ + ('surface_format', ctypes.c_int), + ('full_range', ctypes.c_bool), + # FIXME: should be references to enums + ('colorspace', ctypes.c_uint), + ('primaries', ctypes.c_uint), + ('transfer', ctypes.c_uint), + ] + +class Direct3dHdr10Metadata(_Cstruct): + _fields_ = [ + ('RedPrimary ', ctypes.c_uint16 * 2), + ('GreenPrimary', ctypes.c_uint16 * 2), + ('BluePrimary', ctypes.c_uint16 * 2), + ('WhitePoint', ctypes.c_uint16 * 2), + ('MaxMasteringLuminance', ctypes.c_uint), + ('MinMasteringLuminance', ctypes.c_uint), + ('MaxContentLightLevel', ctypes.c_uint16), + ('MaxFrameAverageLightLevel', ctypes.c_uint16), + ] + +# Generated callback definitions # class Callback(ctypes.c_void_p): """Callback function notification. @param p_event: the event triggering the callback. """ pass - - class LogCb(ctypes.c_void_p): """Callback prototype for LibVLC log message handler. @param data: data pointer as given to L{libvlc_log_set}(). @@ -1118,8 +1370,6 @@ class LogCb(ctypes.c_void_p): @param args: variable argument list for the format @note Log message handlers B{must} be thread-safe. @warning The message context pointer, the format string parameters and the variable arguments are only valid until the callback returns. """ pass - - class MediaOpenCb(ctypes.c_void_p): """Callback prototype to open a custom bitstream input media. The same media item can be opened multiple times. Each time, this callback @@ -1130,8 +1380,6 @@ class MediaOpenCb(ctypes.c_void_p): @return: datap storage space for a private data pointer, sizep byte length of the bitstream or UINT64_MAX if unknown. """ pass - - class MediaReadCb(ctypes.c_void_p): """Callback prototype to read data from a custom bitstream input media. @param opaque: private pointer as set by the @ref libvlc_media_open_cb callback. @@ -1140,8 +1388,6 @@ class MediaReadCb(ctypes.c_void_p): @return: strictly positive number of bytes read, 0 on end-of-stream, or -1 on non-recoverable error @note If no data is immediately available, then the callback should sleep. @warning The application is responsible for avoiding deadlock situations. In particular, the callback should return an error if playback is stopped; if it does not return, then L{libvlc_media_player_stop}() will never return. """ pass - - class MediaSeekCb(ctypes.c_void_p): """Callback prototype to seek a custom bitstream input media. @param opaque: private pointer as set by the @ref libvlc_media_open_cb callback. @@ -1149,15 +1395,11 @@ class MediaSeekCb(ctypes.c_void_p): @return: 0 on success, -1 on error. """ pass - - class MediaCloseCb(ctypes.c_void_p): """Callback prototype to close a custom bitstream input media. @param opaque: private pointer as set by the @ref libvlc_media_open_cb callback. """ pass - - class VideoLockCb(ctypes.c_void_p): """Callback prototype to allocate and lock a picture buffer. Whenever a new video frame needs to be decoded, the lock callback is @@ -1169,8 +1411,6 @@ class VideoLockCb(ctypes.c_void_p): @return: a private pointer for the display and unlock callbacks to identify the picture buffers. """ pass - - class VideoUnlockCb(ctypes.c_void_p): """Callback prototype to unlock a picture buffer. When the video frame decoding is complete, the unlock callback is invoked. @@ -1183,8 +1423,6 @@ class VideoUnlockCb(ctypes.c_void_p): @param planes: pixel planes as defined by the @ref libvlc_video_lock_cb callback (this parameter is only for convenience) [IN]. """ pass - - class VideoDisplayCb(ctypes.c_void_p): """Callback prototype to display a picture. When the video frame needs to be shown, as determined by the media playback @@ -1193,8 +1431,6 @@ class VideoDisplayCb(ctypes.c_void_p): @param picture: private pointer returned from the @ref libvlc_video_lock_cb callback [IN]. """ pass - - class VideoFormatCb(ctypes.c_void_p): """Callback prototype to configure picture buffers format. This callback gets the format of the video as output by the video decoder @@ -1209,15 +1445,11 @@ class VideoFormatCb(ctypes.c_void_p): @return: lines table of scanlines count for each plane. """ pass - - class VideoCleanupCb(ctypes.c_void_p): """Callback prototype to configure picture buffers format. @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() (and possibly modified by @ref libvlc_video_format_cb) [IN]. """ pass - - class AudioPlayCb(ctypes.c_void_p): """Callback prototype for audio playback. The LibVLC media player decodes and post-processes the audio signal @@ -1237,8 +1469,6 @@ class AudioPlayCb(ctypes.c_void_p): @param pts: expected play time stamp (see libvlc_delay()). """ pass - - class AudioPauseCb(ctypes.c_void_p): """Callback prototype for audio pause. LibVLC invokes this callback to pause audio playback. @@ -1247,8 +1477,6 @@ class AudioPauseCb(ctypes.c_void_p): @param pts: time stamp of the pause request (should be elapsed already). """ pass - - class AudioResumeCb(ctypes.c_void_p): """Callback prototype for audio resumption. LibVLC invokes this callback to resume audio playback after it was @@ -1258,8 +1486,6 @@ class AudioResumeCb(ctypes.c_void_p): @param pts: time stamp of the resumption request (should be elapsed already). """ pass - - class AudioFlushCb(ctypes.c_void_p): """Callback prototype for audio buffer flush. LibVLC invokes this callback if it needs to discard all pending buffers and @@ -1268,8 +1494,6 @@ class AudioFlushCb(ctypes.c_void_p): @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. """ pass - - class AudioDrainCb(ctypes.c_void_p): """Callback prototype for audio buffer drain. LibVLC may invoke this callback when the decoded audio track is ending. @@ -1278,8 +1502,6 @@ class AudioDrainCb(ctypes.c_void_p): @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. """ pass - - class AudioSetVolumeCb(ctypes.c_void_p): """Callback prototype for audio volume change. @param data: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. @@ -1287,8 +1509,6 @@ class AudioSetVolumeCb(ctypes.c_void_p): @param mute: muted flag. """ pass - - class AudioSetupCb(ctypes.c_void_p): """Callback prototype to setup the audio playback. This is called when the media player needs to create a new audio output. @@ -1299,16 +1519,12 @@ class AudioSetupCb(ctypes.c_void_p): @return: 0 on success, anything else to skip audio playback. """ pass - - class AudioCleanupCb(ctypes.c_void_p): """Callback prototype for audio playback cleanup. This is called when the media player no longer needs an audio output. @param opaque: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. """ pass - - class CallbackDecorators(object): "Class holding various method decorators for callback functions." Callback = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p) @@ -1323,8 +1539,7 @@ class CallbackDecorators(object): @param fmt: printf() format string (as defined by ISO C11). @param args: variable argument list for the format @note Log message handlers B{must} be thread-safe. @warning The message context pointer, the format string parameters and the variable arguments are only valid until the callback returns. ''' - MediaOpenCb = ctypes.CFUNCTYPE(ctypes.POINTER(ctypes.c_int), ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), - ctypes.POINTER(ctypes.c_uint64)) + MediaOpenCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.POINTER(ctypes.c_uint64)) MediaOpenCb.__doc__ = '''Callback prototype to open a custom bitstream input media. The same media item can be opened multiple times. Each time, this callback is invoked. It should allocate and initialize any instance-specific @@ -1333,14 +1548,14 @@ class CallbackDecorators(object): @param opaque: private pointer as passed to L{libvlc_media_new_callbacks}(). @return: datap storage space for a private data pointer, sizep byte length of the bitstream or UINT64_MAX if unknown. ''' - MediaReadCb = ctypes.CFUNCTYPE(ctypes.POINTER(ctypes.c_ssize_t), ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t) + MediaReadCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_size_t) MediaReadCb.__doc__ = '''Callback prototype to read data from a custom bitstream input media. @param opaque: private pointer as set by the @ref libvlc_media_open_cb callback. @param buf: start address of the buffer to read data into. @param len: bytes length of the buffer. @return: strictly positive number of bytes read, 0 on end-of-stream, or -1 on non-recoverable error @note If no data is immediately available, then the callback should sleep. @warning The application is responsible for avoiding deadlock situations. In particular, the callback should return an error if playback is stopped; if it does not return, then L{libvlc_media_player_stop}() will never return. ''' - MediaSeekCb = ctypes.CFUNCTYPE(ctypes.POINTER(ctypes.c_int), ctypes.c_void_p, ctypes.c_uint64) + MediaSeekCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.c_uint64) MediaSeekCb.__doc__ = '''Callback prototype to seek a custom bitstream input media. @param opaque: private pointer as set by the @ref libvlc_media_open_cb callback. @param offset: absolute byte offset to seek to. @@ -1350,7 +1565,7 @@ class CallbackDecorators(object): MediaCloseCb.__doc__ = '''Callback prototype to close a custom bitstream input media. @param opaque: private pointer as set by the @ref libvlc_media_open_cb callback. ''' - VideoLockCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)) + VideoLockCb = ctypes.CFUNCTYPE(ctypes.POINTER(ctypes.c_void_p), ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)) VideoLockCb.__doc__ = '''Callback prototype to allocate and lock a picture buffer. Whenever a new video frame needs to be decoded, the lock callback is invoked. Depending on the video chroma, one or three pixel planes of @@ -1378,9 +1593,7 @@ class CallbackDecorators(object): @param opaque: private pointer as passed to L{libvlc_video_set_callbacks}() [IN]. @param picture: private pointer returned from the @ref libvlc_video_lock_cb callback [IN]. ''' - VideoFormatCb = ctypes.CFUNCTYPE(ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_void_p), ctypes.c_char_p, - ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), - ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)) + VideoFormatCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)) VideoFormatCb.__doc__ = '''Callback prototype to configure picture buffers format. This callback gets the format of the video as output by the video decoder and the chain of video filters (if any). It can opt to change any parameter @@ -1450,8 +1663,7 @@ class CallbackDecorators(object): @param volume: software volume (1. = nominal, 0. = mute). @param mute: muted flag. ''' - AudioSetupCb = ctypes.CFUNCTYPE(ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_void_p), ctypes.c_char_p, - ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)) + AudioSetupCb = ctypes.CFUNCTYPE(ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p), ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)) AudioSetupCb.__doc__ = '''Callback prototype to setup the audio playback. This is called when the media player needs to create a new audio output. @param opaque: pointer to the data pointer passed to L{libvlc_audio_set_callbacks}() [IN/OUT]. @@ -1465,340 +1677,76 @@ class CallbackDecorators(object): This is called when the media player no longer needs an audio output. @param opaque: data pointer as passed to L{libvlc_audio_set_callbacks}() [IN]. ''' - - cb = CallbackDecorators - - # End of generated enum types # -# From libvlc_structures.h - -class AudioOutput(_Cstruct): - - def __str__(self): - return '%s(%s:%s)' % (self.__class__.__name__, self.name, self.description) - - -AudioOutput._fields_ = [ # recursive struct - ('name', ctypes.c_char_p), - ('description', ctypes.c_char_p), - ('next', ctypes.POINTER(AudioOutput)), -] - - -class LogMessage(_Cstruct): - _fields_ = [ - ('size', ctypes.c_uint), - ('severity', ctypes.c_int), - ('type', ctypes.c_char_p), - ('name', ctypes.c_char_p), - ('header', ctypes.c_char_p), - ('message', ctypes.c_char_p), - ] - - def __init__(self): - super(LogMessage, self).__init__() - self.size = ctypes.sizeof(self) - - def __str__(self): - return '%s(%d:%s): %s' % (self.__class__.__name__, self.severity, self.type, self.message) - - -class MediaEvent(_Cstruct): - _fields_ = [ - ('media_name', ctypes.c_char_p), - ('instance_name', ctypes.c_char_p), - ] - - -class MediaStats(_Cstruct): - _fields_ = [ - ('read_bytes', ctypes.c_int), - ('input_bitrate', ctypes.c_float), - ('demux_read_bytes', ctypes.c_int), - ('demux_bitrate', ctypes.c_float), - ('demux_corrupted', ctypes.c_int), - ('demux_discontinuity', ctypes.c_int), - ('decoded_video', ctypes.c_int), - ('decoded_audio', ctypes.c_int), - ('displayed_pictures', ctypes.c_int), - ('lost_pictures', ctypes.c_int), - ('played_abuffers', ctypes.c_int), - ('lost_abuffers', ctypes.c_int), - ('sent_packets', ctypes.c_int), - ('sent_bytes', ctypes.c_int), - ('send_bitrate', ctypes.c_float), - ] - - -class MediaTrackInfo(_Cstruct): - _fields_ = [ - ('codec', ctypes.c_uint32), - ('id', ctypes.c_int), - ('type', TrackType), - ('profile', ctypes.c_int), - ('level', ctypes.c_int), - ('channels_or_height', ctypes.c_uint), - ('rate_or_width', ctypes.c_uint), - ] - - -class AudioTrack(_Cstruct): - _fields_ = [ - ('channels', ctypes.c_uint), - ('rate', ctypes.c_uint), - ] - - -class VideoTrack(_Cstruct): - _fields_ = [ - ('height', ctypes.c_uint), - ('width', ctypes.c_uint), - ('sar_num', ctypes.c_uint), - ('sar_den', ctypes.c_uint), - ('frame_rate_num', ctypes.c_uint), - ('frame_rate_den', ctypes.c_uint), - ] - - -class SubtitleTrack(_Cstruct): - _fields_ = [ - ('encoding', ctypes.c_char_p), - ] - - -class MediaTrackTracks(ctypes.Union): - _fields_ = [ - ('audio', ctypes.POINTER(AudioTrack)), - ('video', ctypes.POINTER(VideoTrack)), - ('subtitle', ctypes.POINTER(SubtitleTrack)), - ] - - -class MediaTrack(_Cstruct): - _anonymous_ = ("u",) - _fields_ = [ - ('codec', ctypes.c_uint32), - ('original_fourcc', ctypes.c_uint32), - ('id', ctypes.c_int), - ('type', TrackType), - ('profile', ctypes.c_int), - ('level', ctypes.c_int), - - ('u', MediaTrackTracks), - ('bitrate', ctypes.c_uint), - ('language', ctypes.c_char_p), - ('description', ctypes.c_char_p), - ] - - -class PlaylistItem(_Cstruct): - _fields_ = [ - ('id', ctypes.c_int), - ('uri', ctypes.c_char_p), - ('name', ctypes.c_char_p), - ] - - def __str__(self): - return '%s #%d %s (uri %s)' % (self.__class__.__name__, self.id, self.name, self.uri) - - -class Position(object): - """Enum-like, immutable window position constants. - - See e.g. VideoMarqueeOption.Position. - """ - Center = 0 - Left = 1 - CenterLeft = 1 - Right = 2 - CenterRight = 2 - Top = 4 - TopCenter = 4 - TopLeft = 5 - TopRight = 6 - Bottom = 8 - BottomCenter = 8 - BottomLeft = 9 - BottomRight = 10 - - def __init__(self, *unused): - raise TypeError('constants only') - - def __setattr__(self, *unused): # PYCHOK expected - raise TypeError('immutable constants') - - -class Rectangle(_Cstruct): - _fields_ = [ - ('top', ctypes.c_int), - ('left', ctypes.c_int), - ('bottom', ctypes.c_int), - ('right', ctypes.c_int), - ] - - -class TrackDescription(_Cstruct): - - def __str__(self): - return '%s(%d:%s)' % (self.__class__.__name__, self.id, self.name) - - -TrackDescription._fields_ = [ # recursive struct - ('id', ctypes.c_int), - ('name', ctypes.c_char_p), - ('next', ctypes.POINTER(TrackDescription)), -] - - -def track_description_list(head): - """Convert a TrackDescription linked list to a Python list (and release the former). - """ - r = [] - if head: - item = head - while item: - item = item.contents - r.append((item.id, item.name)) - item = item.next - try: - libvlc_track_description_release(head) - except NameError: - libvlc_track_description_list_release(head) - - return r - - -class EventUnion(ctypes.Union): - _fields_ = [ - ('meta_type', ctypes.c_uint), - ('new_child', ctypes.c_uint), - ('new_duration', ctypes.c_longlong), - ('new_status', ctypes.c_int), - ('media', ctypes.c_void_p), - ('new_state', ctypes.c_uint), - # FIXME: Media instance - ('new_cache', ctypes.c_float), - ('new_position', ctypes.c_float), - ('new_time', ctypes.c_longlong), - ('new_title', ctypes.c_int), - ('new_seekable', ctypes.c_longlong), - ('new_pausable', ctypes.c_longlong), - ('new_scrambled', ctypes.c_longlong), - ('new_count', ctypes.c_longlong), - # FIXME: Skipped MediaList and MediaListView... - ('filename', ctypes.c_char_p), - ('new_length', ctypes.c_longlong), - ('media_event', MediaEvent), - ] - - -class Event(_Cstruct): - _fields_ = [ - ('type', EventType), - ('object', ctypes.c_void_p), - ('u', EventUnion), - ] - - -class ModuleDescription(_Cstruct): - - def __str__(self): - return '%s %s (%s)' % (self.__class__.__name__, self.shortname, self.name) - - -ModuleDescription._fields_ = [ # recursive struct - ('name', ctypes.c_char_p), - ('shortname', ctypes.c_char_p), - ('longname', ctypes.c_char_p), - ('help', ctypes.c_char_p), - ('next', ctypes.POINTER(ModuleDescription)), -] - - -def module_description_list(head): - """Convert a ModuleDescription linked list to a Python list (and release the former). - """ - r = [] - if head: - item = head - while item: - item = item.contents - r.append((item.name, item.shortname, item.longname, item.help)) - item = item.next - libvlc_module_description_list_release(head) - return r - - -class AudioOutputDevice(_Cstruct): - - def __str__(self): - return '%s(%d:%s)' % (self.__class__.__name__, self.id, self.name) - - -AudioOutputDevice._fields_ = [ # recursive struct - ('next', ctypes.POINTER(AudioOutputDevice)), - ('device', ctypes.c_char_p), - ('description', ctypes.c_char_p), -] - - -class TitleDescription(_Cstruct): - _fields_ = [ - ('duration', ctypes.c_longlong), - ('name', ctypes.c_char_p), - ('menu', ctypes.c_bool), - ] - - -class ChapterDescription(_Cstruct): - _fields_ = [ - ('time_offset', ctypes.c_longlong), - ('duration', ctypes.c_longlong), - ('name', ctypes.c_char_p), - ] - - -class VideoViewpoint(_Cstruct): - _fields_ = [ - ('yaw', ctypes.c_float), - ('pitch', ctypes.c_float), - ('roll', ctypes.c_float), - ('field_of_view', ctypes.c_float), - ] - - -class MediaDiscovererDescription(_Cstruct): - _fields_ = [ - ('name', ctypes.c_char_p), - ('longname', ctypes.c_char_p), - ('cat', MediaDiscovererCategory), - ] - - def __str__(self): - return '%s %s (%d) - %s' % (self.__class__.__name__, self.name, self.cat, self.longname) - - -# This struct depends on the MediaSlaveType enum that is defined only -# in > 2.2 -if 'MediaSlaveType' in locals(): - class MediaSlave(_Cstruct): - _fields_ = [ - ('psz_uri', ctypes.c_char_p), - ('i_type', MediaSlaveType), - ('i_priority', ctypes.c_uint) - ] - - -class RDDescription(_Cstruct): - _fields_ = [ - ('name', ctypes.c_char_p), - ('longname', ctypes.c_char_p) - ] - - # End of header.py # +class AudioEqualizer(_Ctype): + '''Create a new default equalizer, with all frequency values zeroed. + + The new equalizer can subsequently be applied to a media player by invoking + L{MediaPlayer.set_equalizer}. + The returned handle should be freed via libvlc_audio_equalizer_release() when + it is no longer needed. + ''' + + def __new__(cls, *args): + if len(args) == 1 and isinstance(args[0], _Ints): + return _Constructor(cls, args[0]) + return libvlc_audio_equalizer_new() + + + def release(self): + '''Release a previously created equalizer instance. + The equalizer was previously created by using L{new}() or + L{new_from_preset}(). + It is safe to invoke this method with a None p_equalizer parameter for no effect. + @version: LibVLC 2.2.0 or later. + ''' + return libvlc_audio_equalizer_release(self) + + + def set_preamp(self, f_preamp): + '''Set a new pre-amplification value for an equalizer. + The new equalizer settings are subsequently applied to a media player by invoking + L{media_player_set_equalizer}(). + The supplied amplification value will be clamped to the -20.0 to +20.0 range. + @param f_preamp: preamp value (-20.0 to 20.0 Hz). + @return: zero on success, -1 on error. + @version: LibVLC 2.2.0 or later. + ''' + return libvlc_audio_equalizer_set_preamp(self, f_preamp) + + + def get_preamp(self): + '''Get the current pre-amplification value from an equalizer. + @return: preamp value (Hz). + @version: LibVLC 2.2.0 or later. + ''' + return libvlc_audio_equalizer_get_preamp(self) + + + def set_amp_at_index(self, f_amp, u_band): + '''Set a new amplification value for a particular equalizer frequency band. + The new equalizer settings are subsequently applied to a media player by invoking + L{media_player_set_equalizer}(). + The supplied amplification value will be clamped to the -20.0 to +20.0 range. + @param f_amp: amplification value (-20.0 to 20.0 Hz). + @param u_band: index, counting from zero, of the frequency band to set. + @return: zero on success, -1 on error. + @version: LibVLC 2.2.0 or later. + ''' + return libvlc_audio_equalizer_set_amp_at_index(self, f_amp, u_band) + + + def get_amp_at_index(self, u_band): + '''Get the amplification value for a particular equalizer frequency band. + @param u_band: index, counting from zero, of the frequency band to get. + @return: amplification value (Hz); NaN if there is no such frequency band. + @version: LibVLC 2.2.0 or later. + ''' + return libvlc_audio_equalizer_get_amp_at_index(self, u_band) + class EventManager(_Ctype): '''Create an event manager with callback handler. @@ -1822,8 +1770,7 @@ class EventManager(_Ctype): def __new__(cls, ptr=_internal_guard): if ptr == _internal_guard: - raise VLCException( - "(INTERNAL) ctypes class.\nYou should get a reference to EventManager through the MediaPlayer.event_manager() method.") + raise VLCException("(INTERNAL) ctypes class.\nYou should get a reference to EventManager through the MediaPlayer.event_manager() method.") return _Constructor(cls, ptr) def event_attach(self, eventtype, callback, *args, **kwds): @@ -1837,19 +1784,21 @@ class EventManager(_Ctype): @note: The callback function must have at least one argument, an Event instance. Any other, optional positional and keyword - arguments are in B{addition} to the first one. + arguments are in B{addition} to the first one. Warning: libvlc + is not reentrant, i.e. you cannot call libvlc functions from + an event handler. They must be called from the main + application thread. """ if not isinstance(eventtype, EventType): raise VLCException("%s required: %r" % ('EventType', eventtype)) if not hasattr(callback, '__call__'): # callable() raise VLCException("%s required: %r" % ('callable', callback)) - # check that the callback expects arguments + # check that the callback expects arguments if not any(getargspec(callback)[:2]): # list(...) raise VLCException("%s required: %r" % ('argument', callback)) if self._callback_handler is None: _called_from_ctypes = ctypes.CFUNCTYPE(None, ctypes.POINTER(Event), ctypes.c_void_p) - @_called_from_ctypes def _callback_handler(event, k): """(INTERNAL) handle callback call from ctypes. @@ -1858,13 +1807,13 @@ class EventManager(_Ctype): method since ctypes does not prepend self as the first parameter, hence this closure. """ - try: # retrieve Python callback and arguments + try: # retrieve Python callback and arguments call, args, kwds = self._callbacks[k] - # deref event.contents to simplify callback code - call(event.contents, *args, **kwds) except KeyError: # detached? pass - + else: + # deref event.contents to simplify callback code + call(event.contents, *args, **kwds) self._callback_handler = _callback_handler self._callbacks = {} @@ -1884,7 +1833,7 @@ class EventManager(_Ctype): k = eventtype.value if k in self._callbacks: - del self._callbacks[k] # remove, regardless of libvlc return value + del self._callbacks[k] # remove, regardless of libvlc return value libvlc_event_detach(self, k, self._callback_handler, k) @@ -1925,13 +1874,13 @@ class Instance(_Ctype): os.environ.setdefault('VLC_PLUGIN_PATH', plugin_path) if PYTHON3: - args = [str_to_bytes(a) for a in args] + args = [ str_to_bytes(a) for a in args ] return libvlc_new(len(args), args) def media_player_new(self, uri=None): """Create a new MediaPlayer instance. - @param uri: an optional URI to play in the player. + @param uri: an optional URI to play in the player as a str, bytes or PathLike object. """ p = libvlc_media_player_new(self) if uri: @@ -1963,8 +1912,10 @@ class Instance(_Ctype): Alternatively, options can be added to the media using the Media.add_options method (with the same limitation). + @param mrl: A str, bytes or PathLike object @param options: optional media option=value strings """ + mrl = try_fspath(mrl) if ':' in mrl and mrl.index(':') > 1: # Assume it is a URL m = libvlc_media_new_location(self, str_to_bytes(mrl)) @@ -1976,9 +1927,18 @@ class Instance(_Ctype): m._instance = self return m + def media_new_path(self, path): + """Create a media for a certain file path. + See L{media_release}. + @param path: A str, byte, or PathLike object representing a local filesystem path. + @return: the newly created media or None on error. + """ + path = try_fspath(path) + return libvlc_media_new_path(self, str_to_bytes(path)) + def media_list_new(self, mrls=None): """Create a new MediaList instance. - @param mrls: optional list of MRL strings + @param mrls: optional list of MRL strings, bytes, or PathLike objects. """ l = libvlc_media_list_new(self) # We should take the lock, but since we did not leak the @@ -2000,10 +1960,7 @@ class Instance(_Ctype): i = head while i: i = i.contents - d = [{'id': libvlc_audio_output_device_id(self, i.name, d), - 'longname': libvlc_audio_output_device_longname(self, i.name, d)} - for d in range(libvlc_audio_output_device_count(self, i.name))] - r.append({'name': i.name, 'description': i.description, 'devices': d}) + r.append({'name': i.name, 'description': i.description}) i = i.next libvlc_audio_output_list_release(head) return r @@ -2020,18 +1977,22 @@ class Instance(_Ctype): """ return module_description_list(libvlc_video_filter_list_get(self)) + + def release(self): '''Decrement the reference count of a libvlc instance, and destroy it if it reaches zero. ''' return libvlc_release(self) + def retain(self): '''Increments the reference count of a libvlc instance. The initial reference count is 1 after L{new}() returns. ''' return libvlc_retain(self) + def add_intf(self, name): '''Try to start a user interface for the libvlc instance. @param name: interface name, or None for default. @@ -2039,6 +2000,7 @@ class Instance(_Ctype): ''' return libvlc_add_intf(self, str_to_bytes(name)) + def set_user_agent(self, name, http): '''Sets the application name. LibVLC passes this as the user agent string when a protocol requires it. @@ -2048,6 +2010,7 @@ class Instance(_Ctype): ''' return libvlc_set_user_agent(self, str_to_bytes(name), str_to_bytes(http)) + def set_app_id(self, id, version, icon): '''Sets some meta-information about the application. See also L{set_user_agent}(). @@ -2058,6 +2021,7 @@ class Instance(_Ctype): ''' return libvlc_set_app_id(self, str_to_bytes(id), str_to_bytes(version), str_to_bytes(icon)) + def log_unset(self): '''Unsets the logging callback. This function deregisters the logging callback for a LibVLC instance. @@ -2069,6 +2033,7 @@ class Instance(_Ctype): ''' return libvlc_log_unset(self) + def log_set(self, cb, data): '''Sets the logging callback for a LibVLC instance. This function is thread-safe: it will wait for any pending callbacks @@ -2079,6 +2044,7 @@ class Instance(_Ctype): ''' return libvlc_log_set(self, cb, data) + def log_set_file(self, stream): '''Sets up logging to a file. @param stream: FILE pointer opened for writing (the FILE pointer must remain valid until L{log_unset}()). @@ -2086,6 +2052,7 @@ class Instance(_Ctype): ''' return libvlc_log_set_file(self, stream) + def media_discoverer_new(self, psz_name): '''Create a media discoverer object by name. After this object is created, you should attach to media_list events in @@ -2101,6 +2068,7 @@ class Instance(_Ctype): ''' return libvlc_media_discoverer_new(self, str_to_bytes(psz_name)) + def media_discoverer_list_get(self, i_cat, ppp_services): '''Get media discoverer services by category. @param i_cat: category of services to fetch. @@ -2110,17 +2078,20 @@ class Instance(_Ctype): ''' return libvlc_media_discoverer_list_get(self, i_cat, ppp_services) + def media_library_new(self): '''Create an new Media Library object. @return: a new object or None on error. ''' return libvlc_media_library_new(self) + def vlm_release(self): '''Release the vlm instance related to the given L{Instance}. ''' return libvlc_vlm_release(self) + def vlm_add_broadcast(self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop): '''Add a broadcast, with one input. @param psz_name: the name of the new broadcast. @@ -2132,8 +2103,8 @@ class Instance(_Ctype): @param b_loop: Should this broadcast be played in loop ? @return: 0 on success, -1 on error. ''' - return libvlc_vlm_add_broadcast(self, str_to_bytes(psz_name), str_to_bytes(psz_input), str_to_bytes(psz_output), - i_options, ppsz_options, b_enabled, b_loop) + return libvlc_vlm_add_broadcast(self, str_to_bytes(psz_name), str_to_bytes(psz_input), str_to_bytes(psz_output), i_options, ppsz_options, b_enabled, b_loop) + def vlm_add_vod(self, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux): '''Add a vod, with one input. @@ -2145,8 +2116,8 @@ class Instance(_Ctype): @param psz_mux: the muxer of the vod media. @return: 0 on success, -1 on error. ''' - return libvlc_vlm_add_vod(self, str_to_bytes(psz_name), str_to_bytes(psz_input), i_options, ppsz_options, - b_enabled, str_to_bytes(psz_mux)) + return libvlc_vlm_add_vod(self, str_to_bytes(psz_name), str_to_bytes(psz_input), i_options, ppsz_options, b_enabled, str_to_bytes(psz_mux)) + def vlm_del_media(self, psz_name): '''Delete a media (VOD or broadcast). @@ -2155,6 +2126,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_del_media(self, str_to_bytes(psz_name)) + def vlm_set_enabled(self, psz_name, b_enabled): '''Enable or disable a media (VOD or broadcast). @param psz_name: the media to work on. @@ -2163,6 +2135,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_set_enabled(self, str_to_bytes(psz_name), b_enabled) + def vlm_set_output(self, psz_name, psz_output): '''Set the output for a media. @param psz_name: the media to work on. @@ -2171,6 +2144,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_set_output(self, str_to_bytes(psz_name), str_to_bytes(psz_output)) + def vlm_set_input(self, psz_name, psz_input): '''Set a media's input MRL. This will delete all existing inputs and add the specified one. @@ -2180,6 +2154,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_set_input(self, str_to_bytes(psz_name), str_to_bytes(psz_input)) + def vlm_add_input(self, psz_name, psz_input): '''Add a media's input MRL. This will add the specified one. @param psz_name: the media to work on. @@ -2188,6 +2163,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_add_input(self, str_to_bytes(psz_name), str_to_bytes(psz_input)) + def vlm_set_loop(self, psz_name, b_loop): '''Set a media's loop status. @param psz_name: the media to work on. @@ -2196,6 +2172,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_set_loop(self, str_to_bytes(psz_name), b_loop) + def vlm_set_mux(self, psz_name, psz_mux): '''Set a media's vod muxer. @param psz_name: the media to work on. @@ -2204,6 +2181,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_set_mux(self, str_to_bytes(psz_name), str_to_bytes(psz_mux)) + def vlm_change_media(self, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop): '''Edit the parameters of a media. This will delete all existing inputs and add the specified one. @@ -2216,8 +2194,8 @@ class Instance(_Ctype): @param b_loop: Should this broadcast be played in loop ? @return: 0 on success, -1 on error. ''' - return libvlc_vlm_change_media(self, str_to_bytes(psz_name), str_to_bytes(psz_input), str_to_bytes(psz_output), - i_options, ppsz_options, b_enabled, b_loop) + return libvlc_vlm_change_media(self, str_to_bytes(psz_name), str_to_bytes(psz_input), str_to_bytes(psz_output), i_options, ppsz_options, b_enabled, b_loop) + def vlm_play_media(self, psz_name): '''Play the named broadcast. @@ -2226,6 +2204,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_play_media(self, str_to_bytes(psz_name)) + def vlm_stop_media(self, psz_name): '''Stop the named broadcast. @param psz_name: the name of the broadcast. @@ -2233,6 +2212,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_stop_media(self, str_to_bytes(psz_name)) + def vlm_pause_media(self, psz_name): '''Pause the named broadcast. @param psz_name: the name of the broadcast. @@ -2240,6 +2220,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_pause_media(self, str_to_bytes(psz_name)) + def vlm_seek_media(self, psz_name, f_percentage): '''Seek in the named broadcast. @param psz_name: the name of the broadcast. @@ -2248,6 +2229,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_seek_media(self, str_to_bytes(psz_name), f_percentage) + def vlm_show_media(self, psz_name): '''Return information about the named media as a JSON string representation. @@ -2262,6 +2244,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_show_media(self, str_to_bytes(psz_name)) + def vlm_get_media_instance_position(self, psz_name, i_instance): '''Get vlm_media instance position by name or instance id. @param psz_name: name of vlm media instance. @@ -2270,6 +2253,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_position(self, str_to_bytes(psz_name), i_instance) + def vlm_get_media_instance_time(self, psz_name, i_instance): '''Get vlm_media instance time by name or instance id. @param psz_name: name of vlm media instance. @@ -2278,6 +2262,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_time(self, str_to_bytes(psz_name), i_instance) + def vlm_get_media_instance_length(self, psz_name, i_instance): '''Get vlm_media instance length by name or instance id. @param psz_name: name of vlm media instance. @@ -2286,6 +2271,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_length(self, str_to_bytes(psz_name), i_instance) + def vlm_get_media_instance_rate(self, psz_name, i_instance): '''Get vlm_media instance playback rate by name or instance id. @param psz_name: name of vlm media instance. @@ -2294,6 +2280,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_rate(self, str_to_bytes(psz_name), i_instance) + def vlm_get_media_instance_title(self, psz_name, i_instance): '''Get vlm_media instance title number by name or instance id. @param psz_name: name of vlm media instance. @@ -2303,6 +2290,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_title(self, str_to_bytes(psz_name), i_instance) + def vlm_get_media_instance_chapter(self, psz_name, i_instance): '''Get vlm_media instance chapter number by name or instance id. @param psz_name: name of vlm media instance. @@ -2312,6 +2300,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_media_instance_chapter(self, str_to_bytes(psz_name), i_instance) + def vlm_get_media_instance_seekable(self, psz_name, i_instance): '''Is libvlc instance seekable ? @param psz_name: name of vlm media instance. @@ -2329,6 +2318,7 @@ class Instance(_Ctype): ''' return libvlc_vlm_get_event_manager(self) + def media_new_location(self, psz_mrl): '''Create a media with a certain given media resource location, for instance a valid URL. @@ -2342,13 +2332,6 @@ class Instance(_Ctype): ''' return libvlc_media_new_location(self, str_to_bytes(psz_mrl)) - def media_new_path(self, path): - '''Create a media for a certain file path. - See L{media_release}. - @param path: local filesystem path. - @return: the newly created media or None on error. - ''' - return libvlc_media_new_path(self, str_to_bytes(path)) def media_new_fd(self, fd): '''Create a media for an already open file descriptor. @@ -2370,6 +2353,7 @@ class Instance(_Ctype): ''' return libvlc_media_new_fd(self, fd) + def media_new_callbacks(self, open_cb, read_cb, seek_cb, close_cb, opaque): '''Create a media with custom callbacks to read the data from. @param open_cb: callback to open the custom bitstream input media. @@ -2382,6 +2366,7 @@ class Instance(_Ctype): ''' return libvlc_media_new_callbacks(self, open_cb, read_cb, seek_cb, close_cb, opaque) + def media_new_as_node(self, psz_name): '''Create a media as an empty node with a given name. See L{media_release}. @@ -2390,6 +2375,7 @@ class Instance(_Ctype): ''' return libvlc_media_new_as_node(self, str_to_bytes(psz_name)) + def renderer_discoverer_new(self, psz_name): '''Create a renderer discoverer object by name After this object is created, you should attach to events in order to be @@ -2404,6 +2390,7 @@ class Instance(_Ctype): ''' return libvlc_renderer_discoverer_new(self, str_to_bytes(psz_name)) + def renderer_discoverer_list_get(self, ppp_services): '''Get media discoverer services See libvlc_renderer_list_release(). @@ -2413,6 +2400,7 @@ class Instance(_Ctype): ''' return libvlc_renderer_discoverer_list_get(self, ppp_services) + def audio_output_device_count(self, psz_audio_output): '''Backward compatibility stub. Do not use in new code. \deprecated Use L{audio_output_device_list_get}() instead. @@ -2420,6 +2408,7 @@ class Instance(_Ctype): ''' return libvlc_audio_output_device_count(self, str_to_bytes(psz_audio_output)) + def audio_output_device_longname(self, psz_output, i_device): '''Backward compatibility stub. Do not use in new code. \deprecated Use L{audio_output_device_list_get}() instead. @@ -2427,6 +2416,7 @@ class Instance(_Ctype): ''' return libvlc_audio_output_device_longname(self, str_to_bytes(psz_output), i_device) + def audio_output_device_id(self, psz_audio_output, i_device): '''Backward compatibility stub. Do not use in new code. \deprecated Use L{audio_output_device_list_get}() instead. @@ -2434,17 +2424,20 @@ class Instance(_Ctype): ''' return libvlc_audio_output_device_id(self, str_to_bytes(psz_audio_output), i_device) + def media_discoverer_new_from_name(self, psz_name): '''\deprecated Use L{media_discoverer_new}() and L{media_discoverer_start}(). ''' return libvlc_media_discoverer_new_from_name(self, str_to_bytes(psz_name)) + def wait(self): '''Waits until an interface causes the instance to exit. You should start at least one interface first, using L{add_intf}(). ''' return libvlc_wait(self) + def get_log_verbosity(self): '''Always returns minus one. This function is only provided for backward compatibility. @@ -2452,6 +2445,7 @@ class Instance(_Ctype): ''' return libvlc_get_log_verbosity(self) + def set_log_verbosity(self, level): '''This function does nothing. It is only provided for backward compatibility. @@ -2459,6 +2453,7 @@ class Instance(_Ctype): ''' return libvlc_set_log_verbosity(self, level) + def log_open(self): '''This function does nothing useful. It is only provided for backward compatibility. @@ -2466,6 +2461,7 @@ class Instance(_Ctype): ''' return libvlc_log_open(self) + def playlist_play(self, i_id, i_options, ppsz_options): '''Start playing (if there is any item in the playlist). Additionnal playlist item options can be specified for addition to the @@ -2476,12 +2472,14 @@ class Instance(_Ctype): ''' return libvlc_playlist_play(self, i_id, i_options, ppsz_options) + def audio_output_list_get(self): '''Gets the list of available audio output modules. @return: list of available audio outputs. It must be freed with In case of error, None is returned. ''' return libvlc_audio_output_list_get(self) + def audio_output_device_list_get(self, aout): '''Gets a list of audio output devices for a given audio output module, See L{audio_output_device_set}(). @@ -2498,7 +2496,6 @@ class Instance(_Ctype): ''' return libvlc_audio_output_device_list_get(self, str_to_bytes(aout)) - class LogIterator(_Ctype): '''Create a new VLC log iterator. @@ -2522,11 +2519,14 @@ class LogIterator(_Ctype): def __next__(self): return self.next() + + def free(self): '''Frees memory allocated by L{log_get_iterator}(). ''' return libvlc_log_iterator_free(self) + def has_next(self): '''Always returns zero. This function is only provided for backward compatibility. @@ -2534,7 +2534,6 @@ class LogIterator(_Ctype): ''' return libvlc_log_iterator_has_next(self) - class Media(_Ctype): '''Create a new Media instance. @@ -2587,10 +2586,12 @@ class Media(_Ctype): except ValueError: # Media not parsed, no info. return None - tracks = (contents[i].contents for i in range(len(contents))) + tracks = ( contents[i].contents for i in range(len(contents)) ) # libvlc_media_tracks_release(mediaTrack_pp, n) return tracks + + def add_option(self, psz_options): '''Add an option to the media. This option will be used to determine how the media_player will @@ -2607,6 +2608,7 @@ class Media(_Ctype): ''' return libvlc_media_add_option(self, str_to_bytes(psz_options)) + def add_option_flag(self, psz_options, i_flags): '''Add an option to the media with configurable flags. This option will be used to determine how the media_player will @@ -2622,6 +2624,7 @@ class Media(_Ctype): ''' return libvlc_media_add_option_flag(self, str_to_bytes(psz_options), i_flags) + def retain(self): '''Retain a reference to a media descriptor object (L{Media}). Use L{release}() to decrement the reference count of a @@ -2629,6 +2632,7 @@ class Media(_Ctype): ''' return libvlc_media_retain(self) + def release(self): '''Decrement the reference count of a media descriptor object. If the reference count is 0, then L{release}() will release the @@ -2638,17 +2642,20 @@ class Media(_Ctype): ''' return libvlc_media_release(self) + def get_mrl(self): '''Get the media resource locator (mrl) from a media descriptor object. @return: string with mrl of media descriptor object. ''' return libvlc_media_get_mrl(self) + def duplicate(self): '''Duplicate a media descriptor object. ''' return libvlc_media_duplicate(self) + def get_meta(self, e_meta): '''Read the meta of the media. If the media has not yet been parsed this will return None. @@ -2660,6 +2667,7 @@ class Media(_Ctype): ''' return libvlc_media_get_meta(self, e_meta) + def set_meta(self, e_meta, psz_value): '''Set the meta of the media (this function will not save the meta, call L{save_meta} in order to save the meta). @@ -2668,12 +2676,14 @@ class Media(_Ctype): ''' return libvlc_media_set_meta(self, e_meta, str_to_bytes(psz_value)) + def save_meta(self): '''Save the meta previously set. @return: true if the write operation was successful. ''' return libvlc_media_save_meta(self) + def get_state(self): '''Get current state of media descriptor object. Possible media states are libvlc_NothingSpecial=0, libvlc_Opening, libvlc_Playing, libvlc_Paused, @@ -2683,6 +2693,7 @@ class Media(_Ctype): ''' return libvlc_media_get_state(self) + def get_stats(self, p_stats): '''Get the current statistics about the media. @param p_stats:: structure that contain the statistics about the media (this structure must be allocated by the caller). @@ -2690,6 +2701,7 @@ class Media(_Ctype): ''' return libvlc_media_get_stats(self, p_stats) + def subitems(self): '''Get subitems of media descriptor object. This will increment the reference count of supplied media descriptor object. Use @@ -2706,12 +2718,14 @@ class Media(_Ctype): ''' return libvlc_media_event_manager(self) + def get_duration(self): '''Get duration (in ms) of media descriptor object item. @return: duration of media item or -1 on error. ''' return libvlc_media_get_duration(self) + def parse_with_options(self, parse_flag, timeout): '''Parse the media asynchronously with options. This fetches (local or network) art, meta data and/or tracks information. @@ -2735,6 +2749,7 @@ class Media(_Ctype): ''' return libvlc_media_parse_with_options(self, parse_flag, timeout) + def parse_stop(self): '''Stop the parsing of the media When the media parsing is stopped, the libvlc_MediaParsedChanged event will @@ -2744,6 +2759,7 @@ class Media(_Ctype): ''' return libvlc_media_parse_stop(self) + def get_parsed_status(self): '''Get Parsed status for media descriptor object. See libvlc_MediaParsedChanged @@ -2753,6 +2769,7 @@ class Media(_Ctype): ''' return libvlc_media_get_parsed_status(self) + def set_user_data(self, p_new_user_data): '''Sets media descriptor's user_data. user_data is specialized data accessed by the host application, VLC.framework uses it as a pointer to @@ -2761,6 +2778,7 @@ class Media(_Ctype): ''' return libvlc_media_set_user_data(self, p_new_user_data) + def get_user_data(self): '''Get media descriptor's user_data. user_data is specialized data accessed by the host application, VLC.framework uses it as a pointer to @@ -2768,6 +2786,7 @@ class Media(_Ctype): ''' return libvlc_media_get_user_data(self) + def get_type(self): '''Get the media type of the media descriptor object. @return: media type. @@ -2775,6 +2794,7 @@ class Media(_Ctype): ''' return libvlc_media_get_type(self) + def slaves_add(self, i_type, i_priority, psz_uri): '''Add a slave to the current media. A slave is an external input source that may contains an additional subtitle @@ -2790,6 +2810,7 @@ class Media(_Ctype): ''' return libvlc_media_slaves_add(self, i_type, i_priority, str_to_bytes(psz_uri)) + def slaves_clear(self): '''Clear all slaves previously added by L{slaves_add}() or internally. @@ -2797,6 +2818,7 @@ class Media(_Ctype): ''' return libvlc_media_slaves_clear(self) + def slaves_get(self, ppp_slaves): '''Get a media descriptor's slave list The list will contain slaves parsed by VLC or previously added by @@ -2808,6 +2830,7 @@ class Media(_Ctype): ''' return libvlc_media_slaves_get(self, ppp_slaves) + def parse(self): '''Parse a media. This fetches (local) art, meta data and tracks information. @@ -2820,6 +2843,7 @@ class Media(_Ctype): ''' return libvlc_media_parse(self) + def parse_async(self): '''Parse a media. This fetches (local) art, meta data and tracks information. @@ -2837,6 +2861,7 @@ class Media(_Ctype): ''' return libvlc_media_parse_async(self) + def is_parsed(self): '''Return true is the media descriptor object is parsed \deprecated This can return true in case of failure. @@ -2846,6 +2871,7 @@ class Media(_Ctype): ''' return libvlc_media_is_parsed(self) + def get_tracks_info(self): '''Get media descriptor's elementary streams description Note, you need to call L{parse}() or play the media at least once @@ -2857,13 +2883,13 @@ class Media(_Ctype): ''' return libvlc_media_get_tracks_info(self) + def player_new_from_media(self): '''Create a Media Player object from a Media. @return: a new media player object, or None on error. ''' return libvlc_media_player_new_from_media(self) - class MediaDiscoverer(_Ctype): '''N/A ''' @@ -2883,6 +2909,7 @@ class MediaDiscoverer(_Ctype): ''' return libvlc_media_discoverer_start(self) + def stop(self): '''Stop media discovery. See L{start}. @@ -2890,24 +2917,28 @@ class MediaDiscoverer(_Ctype): ''' return libvlc_media_discoverer_stop(self) + def release(self): '''Release media discover object. If the reference count reaches 0, then the object will be released. ''' return libvlc_media_discoverer_release(self) + def media_list(self): '''Get media service discover media list. @return: list of media items. ''' return libvlc_media_discoverer_media_list(self) + def is_running(self): '''Query if media service discover object is running. @return: true if running, false if not \libvlc_return_bool. ''' return libvlc_media_discoverer_is_running(self) + def localized_name(self): '''Get media service discover object its localized name. \deprecated Useless, use L{list_get}() to get the @@ -2925,7 +2956,6 @@ class MediaDiscoverer(_Ctype): ''' return libvlc_media_discoverer_event_manager(self) - class MediaLibrary(_Ctype): '''N/A ''' @@ -2942,6 +2972,7 @@ class MediaLibrary(_Ctype): ''' return libvlc_media_library_release(self) + def retain(self): '''Retain a reference to a media library object. This function will increment the reference counting for this object. Use @@ -2949,19 +2980,20 @@ class MediaLibrary(_Ctype): ''' return libvlc_media_library_retain(self) + def load(self): '''Load media library. @return: 0 on success, -1 on error. ''' return libvlc_media_library_load(self) + def media_list(self): '''Get media library subitems. @return: media list subitems. ''' return libvlc_media_library_media_list(self) - class MediaList(_Ctype): '''Create a new MediaList instance. @@ -2992,20 +3024,25 @@ class MediaList(_Ctype): @param mrl: a media instance or a MRL. @return: 0 on success, -1 if the media list is read-only. """ + mrl = try_fspath(mrl) if isinstance(mrl, basestring): mrl = (self.get_instance() or get_default_instance()).media_new(mrl) return libvlc_media_list_add_media(self, mrl) + + def release(self): '''Release media list created with L{new}(). ''' return libvlc_media_list_release(self) + def retain(self): '''Retain reference to a media list. ''' return libvlc_media_list_retain(self) + def set_media(self, p_md): '''Associate media instance with this media list instance. If another media instance was present it will be released. @@ -3014,6 +3051,7 @@ class MediaList(_Ctype): ''' return libvlc_media_list_set_media(self, p_md) + def media(self): '''Get media instance from this media list instance. This action will increase the refcount on the media instance. @@ -3022,6 +3060,7 @@ class MediaList(_Ctype): ''' return libvlc_media_list_media(self) + def insert_media(self, p_md, i_pos): '''Insert media instance in media list on a position The L{lock} should be held upon entering this function. @@ -3031,6 +3070,7 @@ class MediaList(_Ctype): ''' return libvlc_media_list_insert_media(self, p_md, i_pos) + def remove_index(self, i_pos): '''Remove media instance from media list on a position The L{lock} should be held upon entering this function. @@ -3039,6 +3079,7 @@ class MediaList(_Ctype): ''' return libvlc_media_list_remove_index(self, i_pos) + def count(self): '''Get count on media list items The L{lock} should be held upon entering this function. @@ -3049,6 +3090,7 @@ class MediaList(_Ctype): def __len__(self): return libvlc_media_list_count(self) + def item_at_index(self, i_pos): '''List media instance in media list at a position The L{lock} should be held upon entering this function. @@ -3064,6 +3106,7 @@ class MediaList(_Ctype): for i in range(len(self)): yield self[i] + def index_of_item(self, p_md): '''Find index position of List media instance in media list. Warning: the function will return the first matched position. @@ -3073,17 +3116,20 @@ class MediaList(_Ctype): ''' return libvlc_media_list_index_of_item(self, p_md) + def is_readonly(self): '''This indicates if this media list is read-only from a user point of view. @return: 1 on readonly, 0 on readwrite \libvlc_return_bool. ''' return libvlc_media_list_is_readonly(self) + def lock(self): '''Get lock on media list items. ''' return libvlc_media_list_lock(self) + def unlock(self): '''Release lock on media list items The L{lock} should be held upon entering this function. @@ -3098,7 +3144,6 @@ class MediaList(_Ctype): ''' return libvlc_media_list_event_manager(self) - class MediaListPlayer(_Ctype): '''Create a new MediaListPlayer instance. @@ -3123,7 +3168,9 @@ class MediaListPlayer(_Ctype): def get_instance(self): """Return the associated Instance. """ - return self._instance # PYCHOK expected + return self._instance #PYCHOK expected + + def release(self): '''Release a media_list_player after use @@ -3134,6 +3181,7 @@ class MediaListPlayer(_Ctype): ''' return libvlc_media_list_player_release(self) + def retain(self): '''Retain a reference to a media player list object. Use L{release}() to decrement reference count. @@ -3147,34 +3195,40 @@ class MediaListPlayer(_Ctype): ''' return libvlc_media_list_player_event_manager(self) + def set_media_player(self, p_mi): '''Replace media player in media_list_player with this instance. @param p_mi: media player instance. ''' return libvlc_media_list_player_set_media_player(self, p_mi) + def get_media_player(self): '''Get media player of the media_list_player instance. @return: media player instance @note the caller is responsible for releasing the returned instance. ''' return libvlc_media_list_player_get_media_player(self) + def set_media_list(self, p_mlist): '''Set the media list associated with the player. @param p_mlist: list of media. ''' return libvlc_media_list_player_set_media_list(self, p_mlist) + def play(self): '''Play media list. ''' return libvlc_media_list_player_play(self) + def pause(self): '''Toggle pause (or resume) media list. ''' return libvlc_media_list_player_pause(self) + def set_pause(self, do_pause): '''Pause or resume media list. @param do_pause: play/resume if zero, pause if non-zero. @@ -3182,18 +3236,21 @@ class MediaListPlayer(_Ctype): ''' return libvlc_media_list_player_set_pause(self, do_pause) + def is_playing(self): '''Is media list playing? @return: true for playing and false for not playing \libvlc_return_bool. ''' return libvlc_media_list_player_is_playing(self) + def get_state(self): '''Get current libvlc_state of media list player. @return: L{State} for media list player. ''' return libvlc_media_list_player_get_state(self) + def play_item_at_index(self, i_index): '''Play media list item at position index. @param i_index: index in media list to play. @@ -3208,6 +3265,7 @@ class MediaListPlayer(_Ctype): for i in range(len(self)): yield self[i] + def play_item(self, p_md): '''Play the given media item. @param p_md: the media instance. @@ -3215,30 +3273,33 @@ class MediaListPlayer(_Ctype): ''' return libvlc_media_list_player_play_item(self, p_md) + def stop(self): '''Stop playing media list. ''' return libvlc_media_list_player_stop(self) + def next(self): '''Play next item from media list. @return: 0 upon success -1 if there is no next item. ''' return libvlc_media_list_player_next(self) + def previous(self): '''Play previous item from media list. @return: 0 upon success -1 if there is no previous item. ''' return libvlc_media_list_player_previous(self) + def set_playback_mode(self, e_mode): '''Sets the playback mode for the playlist. @param e_mode: playback mode specification. ''' return libvlc_media_list_player_set_playback_mode(self, e_mode) - class MediaPlayer(_Ctype): '''Create a new MediaPlayer instance. @@ -3266,7 +3327,7 @@ class MediaPlayer(_Ctype): def get_instance(self): """Return the associated Instance. """ - return self._instance # PYCHOK expected + return self._instance #PYCHOK expected def set_mrl(self, mrl, *options): """Set the MRL to play. @@ -3288,18 +3349,6 @@ class MediaPlayer(_Ctype): """ return track_description_list(libvlc_video_get_spu_description(self)) - def video_get_title_description(self): - """Get the description of available titles. - """ - return track_description_list(libvlc_video_get_title_description(self)) - - def video_get_chapter_description(self, title): - """Get the description of available chapters for specific title. - - @param title: selected title (int) - """ - return track_description_list(libvlc_video_get_chapter_description(self, title)) - def video_get_track_description(self): """Get the description of available video tracks. """ @@ -3323,7 +3372,7 @@ class MediaPlayer(_Ctype): except ValueError: # Media not parsed, no info. return None - descr = (contents[i].contents for i in range(len(contents))) + descr = ( contents[i].contents for i in range(len(contents)) ) return descr def get_full_chapter_descriptions(self, i_chapters_of_title): @@ -3340,7 +3389,7 @@ class MediaPlayer(_Ctype): except ValueError: # Media not parsed, no info. return None - descr = (contents[i].contents for i in range(len(contents))) + descr = ( contents[i].contents for i in range(len(contents)) ) return descr def video_get_size(self, num=0): @@ -3405,6 +3454,8 @@ class MediaPlayer(_Ctype): return r raise VLCException('invalid video number (%s)' % (num,)) + + def get_fps(self): '''Get movie fps rate This function is provided for backward compatibility. It cannot deal with @@ -3415,16 +3466,34 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_get_fps(self) + def set_agl(self, drawable): '''\deprecated Use L{set_nsobject}() instead. ''' return libvlc_media_player_set_agl(self, drawable) + def get_agl(self): '''\deprecated Use L{get_nsobject}() instead. ''' return libvlc_media_player_get_agl(self) + + def video_get_title_description(self): + '''Get the description of available titles. + @return: list containing description of available titles. It must be freed with L{track_description_list_release}(). + ''' + return libvlc_video_get_title_description(self) + + + def video_get_chapter_description(self, i_title): + '''Get the description of available chapters for specific title. + @param i_title: selected title. + @return: list containing description of available chapter for title i_title. It must be freed with L{track_description_list_release}(). + ''' + return libvlc_video_get_chapter_description(self, i_title) + + def video_set_subtitle_file(self, psz_subtitle): '''Set new video subtitle file. \deprecated Use L{add_slave}() instead. @@ -3433,12 +3502,14 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_subtitle_file(self, str_to_bytes(psz_subtitle)) + def toggle_teletext(self): '''Toggle teletext transparent status on video output. \deprecated use L{video_set_teletext}() instead. ''' return libvlc_toggle_teletext(self) + def release(self): '''Release a media_player after use Decrement the reference count of a media player object. If the @@ -3448,12 +3519,14 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_release(self) + def retain(self): '''Retain a reference to a media player object. Use L{release}() to decrement reference count. ''' return libvlc_media_player_retain(self) + def set_media(self, p_md): '''Set the media that will be used by the media_player. If any, previous md will be released. @@ -3461,6 +3534,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_media(self, p_md) + def get_media(self): '''Get the media used by the media_player. @return: the media associated with p_mi, or None if no media is associated. @@ -3474,18 +3548,21 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_event_manager(self) + def is_playing(self): '''is_playing. @return: 1 if the media player is playing, 0 otherwise \libvlc_return_bool. ''' return libvlc_media_player_is_playing(self) + def play(self): '''Play. @return: 0 if playback started (and was already started), or -1 on error. ''' return libvlc_media_player_play(self) + def set_pause(self, do_pause): '''Pause or resume (no effect if there is no media). @param do_pause: play/resume if zero, pause if non-zero. @@ -3493,16 +3570,19 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_pause(self, do_pause) + def pause(self): '''Toggle pause (no effect if there is no media). ''' return libvlc_media_player_pause(self) + def stop(self): '''Stop (no effect if there is no media). ''' return libvlc_media_player_stop(self) + def set_renderer(self, p_item): '''Set a renderer to the media player @note: must be called before the first call of L{play}() to @@ -3514,6 +3594,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_renderer(self, p_item) + def video_set_callbacks(self, lock, unlock, display, opaque): '''Set callbacks and private data to render decoded video to a custom area in memory. @@ -3547,6 +3628,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_callbacks(self, lock, unlock, display, opaque) + def video_set_format(self, chroma, width, height, pitch): '''Set decoded video chroma and dimensions. This only works in combination with L{video_set_callbacks}(), @@ -3560,6 +3642,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_format(self, str_to_bytes(chroma), width, height, pitch) + def video_set_format_callbacks(self, setup, cleanup): '''Set decoded video chroma and dimensions. This only works in combination with L{video_set_callbacks}(). @@ -3569,6 +3652,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_format_callbacks(self, setup, cleanup) + def set_nsobject(self, drawable): '''Set the NSView handler where the media player should render its video output. Use the vout called "macosx". @@ -3596,12 +3680,14 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_nsobject(self, drawable) + def get_nsobject(self): '''Get the NSView handler previously set with L{set_nsobject}(). @return: the NSView handler or 0 if none where set. ''' return libvlc_media_player_get_nsobject(self) + def set_xwindow(self, drawable): '''Set an X Window System drawable where the media player should render its video output. The call takes effect when the playback starts. If it is @@ -3624,6 +3710,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_xwindow(self, drawable) + def get_xwindow(self): '''Get the X Window System window identifier previously set with L{set_xwindow}(). Note that this will return the identifier @@ -3633,6 +3720,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_get_xwindow(self) + def get_hwnd(self): '''Get the Windows API window handle (HWND) previously set with L{set_hwnd}(). The handle will be returned even if LibVLC @@ -3641,6 +3729,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_get_hwnd(self) + def set_android_context(self, p_awindow_handler): '''Set the android context. @param p_awindow_handler: org.videolan.libvlc.AWindow jobject owned by the org.videolan.libvlc.MediaPlayer class from the libvlc-android project. @@ -3648,6 +3737,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_android_context(self, p_awindow_handler) + def set_evas_object(self, p_evas_object): '''Set the EFL Evas Object. @param p_evas_object: a valid EFL Evas Object (Evas_Object). @@ -3656,6 +3746,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_evas_object(self, p_evas_object) + def audio_set_callbacks(self, play, pause, resume, flush, drain, opaque): '''Sets callbacks and private data for decoded audio. Use L{audio_set_format}() or L{audio_set_format_callbacks}() @@ -3672,6 +3763,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_set_callbacks(self, play, pause, resume, flush, drain, opaque) + def audio_set_volume_callback(self, set_volume): '''Set callbacks and private data for decoded audio. This only works in combination with L{audio_set_callbacks}(). @@ -3682,6 +3774,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_set_volume_callback(self, set_volume) + def audio_set_format_callbacks(self, setup, cleanup): '''Sets decoded audio format via callbacks. This only works in combination with L{audio_set_callbacks}(). @@ -3691,29 +3784,33 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_set_format_callbacks(self, setup, cleanup) + def audio_set_format(self, format, rate, channels): '''Sets a fixed decoded audio format. This only works in combination with L{audio_set_callbacks}(), and is mutually exclusive with L{audio_set_format_callbacks}(). - @param format: a four-characters string identifying the sample format (e.g. "S16N" or "FL32"). + @param format: a four-characters string identifying the sample format (e.g. "S16N" or "f32l"). @param rate: sample rate (expressed in Hz). @param channels: channels count. @version: LibVLC 2.0.0 or later. ''' return libvlc_audio_set_format(self, str_to_bytes(format), rate, channels) + def get_length(self): '''Get the current movie length (in ms). @return: the movie length (in ms), or -1 if there is no media. ''' return libvlc_media_player_get_length(self) + def get_time(self): '''Get the current movie time (in ms). @return: the movie time (in ms), or -1 if there is no media. ''' return libvlc_media_player_get_time(self) + def set_time(self, i_time): '''Set the movie time (in ms). This has no effect if no media is being played. Not all formats and protocols support this. @@ -3721,12 +3818,14 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_time(self, i_time) + def get_position(self): '''Get movie position as percentage between 0.0 and 1.0. @return: movie position, or -1. in case of error. ''' return libvlc_media_player_get_position(self) + def set_position(self, f_pos): '''Set movie position as percentage between 0.0 and 1.0. This has no effect if playback is not enabled. @@ -3735,30 +3834,35 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_position(self, f_pos) + def set_chapter(self, i_chapter): '''Set movie chapter (if applicable). @param i_chapter: chapter number to play. ''' return libvlc_media_player_set_chapter(self, i_chapter) + def get_chapter(self): '''Get movie chapter. @return: chapter number currently playing, or -1 if there is no media. ''' return libvlc_media_player_get_chapter(self) + def get_chapter_count(self): '''Get movie chapter count. @return: number of chapters in movie, or -1. ''' return libvlc_media_player_get_chapter_count(self) + def will_play(self): '''Is the player able to play. @return: boolean \libvlc_return_bool. ''' return libvlc_media_player_will_play(self) + def get_chapter_count_for_title(self, i_title): '''Get title chapter count. @param i_title: title. @@ -3766,34 +3870,40 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_get_chapter_count_for_title(self, i_title) + def set_title(self, i_title): '''Set movie title. @param i_title: title number to play. ''' return libvlc_media_player_set_title(self, i_title) + def get_title(self): '''Get movie title. @return: title number currently playing, or -1. ''' return libvlc_media_player_get_title(self) + def get_title_count(self): '''Get movie title count. @return: title number count, or -1. ''' return libvlc_media_player_get_title_count(self) + def previous_chapter(self): '''Set previous chapter (if applicable). ''' return libvlc_media_player_previous_chapter(self) + def next_chapter(self): '''Set next chapter (if applicable). ''' return libvlc_media_player_next_chapter(self) + def get_rate(self): '''Get the requested movie play rate. @warning: Depending on the underlying media, the requested rate may be @@ -3802,6 +3912,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_get_rate(self) + def set_rate(self, rate): '''Set movie play rate. @param rate: movie play rate to set. @@ -3809,30 +3920,35 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_rate(self, rate) + def get_state(self): '''Get current movie state. @return: the current state of the media player (playing, paused, ...) See L{State}. ''' return libvlc_media_player_get_state(self) + def has_vout(self): '''How many video outputs does this media player have? @return: the number of video outputs. ''' return libvlc_media_player_has_vout(self) + def is_seekable(self): '''Is this media player seekable? @return: true if the media player can seek \libvlc_return_bool. ''' return libvlc_media_player_is_seekable(self) + def can_pause(self): '''Can this media player be paused? @return: true if the media player can pause \libvlc_return_bool. ''' return libvlc_media_player_can_pause(self) + def program_scrambled(self): '''Check if the current program is scrambled. @return: true if the current program is scrambled \libvlc_return_bool. @@ -3840,11 +3956,13 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_program_scrambled(self) + def next_frame(self): '''Display the next frame (if supported). ''' return libvlc_media_player_next_frame(self) + def navigate(self, navigate): '''Navigate through DVD Menu. @param navigate: the Navigation mode. @@ -3852,6 +3970,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_navigate(self, navigate) + def set_video_title_display(self, position, timeout): '''Set if, and how, the video title will be shown when media is played. @param position: position at which to display the title, or libvlc_position_disable to prevent the title from being displayed. @@ -3860,6 +3979,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_video_title_display(self, position, timeout) + def add_slave(self, i_type, psz_uri, b_select): '''Add a slave to the current media player. @note: If the player is playing, the slave will be added directly. This call @@ -3872,6 +3992,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_add_slave(self, i_type, str_to_bytes(psz_uri), b_select) + def toggle_fullscreen(self): '''Toggle fullscreen status on non-embedded video outputs. @warning: The same limitations applies to this function @@ -3879,6 +4000,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_toggle_fullscreen(self) + def set_fullscreen(self, b_fullscreen): '''Enable or disable fullscreen. @warning: With most window managers, only a top-level windows can be in @@ -3891,12 +4013,14 @@ class MediaPlayer(_Ctype): ''' return libvlc_set_fullscreen(self, b_fullscreen) + def get_fullscreen(self): '''Get current fullscreen status. @return: the fullscreen status (boolean) \libvlc_return_bool. ''' return libvlc_get_fullscreen(self) + def video_set_key_input(self, on): '''Enable or disable key press events handling, according to the LibVLC hotkeys configuration. By default and for historical reasons, keyboard events are @@ -3910,6 +4034,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_key_input(self, on) + def video_set_mouse_input(self, on): '''Enable or disable mouse click events handling. By default, those events are handled. This is needed for DVD menus to work, as well as a few video @@ -3920,6 +4045,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_mouse_input(self, on) + def video_get_scale(self): '''Get the current video scaling factor. See also L{video_set_scale}(). @@ -3927,6 +4053,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_get_scale(self) + def video_set_scale(self, f_factor): '''Set the video scaling factor. That is the ratio of the number of pixels on screen to the number of pixels in the original decoded video in each @@ -3937,18 +4064,21 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_scale(self, f_factor) + def video_get_aspect_ratio(self): '''Get current video aspect ratio. @return: the video aspect ratio or None if unspecified (the result must be released with free() or L{free}()). ''' return libvlc_video_get_aspect_ratio(self) + def video_set_aspect_ratio(self, psz_aspect): '''Set new video aspect ratio. @param psz_aspect: new video aspect-ratio or None to reset to default @note Invalid aspect ratios are ignored. ''' return libvlc_video_set_aspect_ratio(self, str_to_bytes(psz_aspect)) + def video_update_viewpoint(self, p_viewpoint, b_absolute): '''Update the video viewpoint information. @note: It is safe to call this function before the media player is started. @@ -3959,18 +4089,21 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_update_viewpoint(self, p_viewpoint, b_absolute) + def video_get_spu(self): '''Get current video subtitle. @return: the video subtitle selected, or -1 if none. ''' return libvlc_video_get_spu(self) + def video_get_spu_count(self): '''Get the number of available video subtitles. @return: the number of available video subtitles. ''' return libvlc_video_get_spu_count(self) + def video_set_spu(self, i_spu): '''Set new video subtitle. @param i_spu: video subtitle track to select (i_id from track description). @@ -3978,6 +4111,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_spu(self, i_spu) + def video_get_spu_delay(self): '''Get the current subtitle delay. Positive values means subtitles are being displayed later, negative values earlier. @@ -3986,6 +4120,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_get_spu_delay(self) + def video_set_spu_delay(self, i_delay): '''Set the subtitle delay. This affects the timing of when the subtitle will be displayed. Positive values result in subtitles being displayed later, @@ -3997,18 +4132,21 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_spu_delay(self, i_delay) + def video_get_crop_geometry(self): '''Get current crop filter geometry. @return: the crop filter geometry or None if unset. ''' return libvlc_video_get_crop_geometry(self) + def video_set_crop_geometry(self, psz_geometry): '''Set new crop filter geometry. @param psz_geometry: new crop filter geometry (None to unset). ''' return libvlc_video_set_crop_geometry(self, str_to_bytes(psz_geometry)) + def video_get_teletext(self): '''Get current teletext page requested or 0 if it's disabled. Teletext is disabled by default, call L{video_set_teletext}() to enable @@ -4017,6 +4155,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_get_teletext(self) + def video_set_teletext(self, i_page): '''Set new teletext page to retrieve. This function can also be used to send a teletext key. @@ -4024,18 +4163,21 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_teletext(self, i_page) + def video_get_track_count(self): '''Get number of available video tracks. @return: the number of available video tracks (int). ''' return libvlc_video_get_track_count(self) + def video_get_track(self): '''Get current video track. @return: the video track ID (int) or -1 if no active input. ''' return libvlc_video_get_track(self) + def video_set_track(self, i_track): '''Set video track. @param i_track: the track ID (i_id field from track description). @@ -4043,6 +4185,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_track(self, i_track) + def video_take_snapshot(self, num, psz_filepath, i_width, i_height): '''Take a snapshot of the current video window. If i_width AND i_height is 0, original size is used. @@ -4055,24 +4198,28 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_take_snapshot(self, num, str_to_bytes(psz_filepath), i_width, i_height) + def video_set_deinterlace(self, psz_mode): '''Enable or disable deinterlace filter. @param psz_mode: type of deinterlace filter, None to disable. ''' return libvlc_video_set_deinterlace(self, str_to_bytes(psz_mode)) + def video_get_marquee_int(self, option): '''Get an integer marquee option value. @param option: marq option to get See libvlc_video_marquee_int_option_t. ''' return libvlc_video_get_marquee_int(self, option) + def video_get_marquee_string(self, option): '''Get a string marquee option value. @param option: marq option to get See libvlc_video_marquee_string_option_t. ''' return libvlc_video_get_marquee_string(self, option) + def video_set_marquee_int(self, option, i_val): '''Enable, disable or set an integer marquee option Setting libvlc_marquee_Enable has the side effect of enabling (arg !0) @@ -4082,6 +4229,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_marquee_int(self, option, i_val) + def video_set_marquee_string(self, option, psz_text): '''Set a marquee string option. @param option: marq option to set See libvlc_video_marquee_string_option_t. @@ -4089,12 +4237,14 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_marquee_string(self, option, str_to_bytes(psz_text)) + def video_get_logo_int(self, option): '''Get integer logo option. @param option: logo option to get, values of L{VideoLogoOption}. ''' return libvlc_video_get_logo_int(self, option) + def video_set_logo_int(self, option, value): '''Set logo option as integer. Options that take a different type value are ignored. @@ -4105,6 +4255,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_logo_int(self, option, value) + def video_set_logo_string(self, option, psz_value): '''Set logo option as string. Options that take a different type value are ignored. @@ -4113,6 +4264,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_logo_string(self, option, str_to_bytes(psz_value)) + def video_get_adjust_int(self, option): '''Get integer adjust option. @param option: adjust option to get, values of L{VideoAdjustOption}. @@ -4120,6 +4272,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_get_adjust_int(self, option) + def video_set_adjust_int(self, option, value): '''Set adjust option as integer. Options that take a different type value are ignored. @@ -4131,6 +4284,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_adjust_int(self, option, value) + def video_get_adjust_float(self, option): '''Get float adjust option. @param option: adjust option to get, values of L{VideoAdjustOption}. @@ -4138,6 +4292,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_get_adjust_float(self, option) + def video_set_adjust_float(self, option, value): '''Set adjust option as float. Options that take a different type value are ignored. @@ -4147,6 +4302,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_video_set_adjust_float(self, option, value) + def audio_output_set(self, psz_name): '''Selects an audio output module. @note: Any change will take be effect only after playback is stopped and @@ -4156,6 +4312,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_output_set(self, str_to_bytes(psz_name)) + def audio_output_device_enum(self): '''Gets a list of potential audio output devices, See L{audio_output_device_set}(). @@ -4170,6 +4327,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_output_device_enum(self) + def audio_output_device_set(self, module, device_id): '''Configures an explicit audio output device. If the module paramater is None, audio output will be moved to the device @@ -4197,6 +4355,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_output_device_set(self, str_to_bytes(module), str_to_bytes(device_id)) + def audio_output_device_get(self): '''Get the current audio output device identifier. This complements L{audio_output_device_set}(). @@ -4214,29 +4373,34 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_output_device_get(self) + def audio_toggle_mute(self): '''Toggle mute status. ''' return libvlc_audio_toggle_mute(self) + def audio_get_mute(self): '''Get current mute status. @return: the mute status (boolean) if defined, -1 if undefined/unapplicable. ''' return libvlc_audio_get_mute(self) + def audio_set_mute(self, status): '''Set mute status. @param status: If status is true then mute, otherwise unmute @warning This function does not always work. If there are no active audio playback stream, the mute status might not be available. If digital pass-through (S/PDIF, HDMI...) is in use, muting may be unapplicable. Also some audio output plugins do not support muting at all. @note To force silent playback, disable all audio tracks. This is more efficient and reliable than mute. ''' return libvlc_audio_set_mute(self, status) + def audio_get_volume(self): '''Get current software audio volume. @return: the software volume in percents (0 = mute, 100 = nominal / 0dB). ''' return libvlc_audio_get_volume(self) + def audio_set_volume(self, i_volume): '''Set current software audio volume. @param i_volume: the volume in percents (0 = mute, 100 = 0dB). @@ -4244,18 +4408,21 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_set_volume(self, i_volume) + def audio_get_track_count(self): '''Get number of available audio tracks. @return: the number of available audio tracks (int), or -1 if unavailable. ''' return libvlc_audio_get_track_count(self) + def audio_get_track(self): '''Get current audio track. @return: the audio track ID or -1 if no active input. ''' return libvlc_audio_get_track(self) + def audio_set_track(self, i_track): '''Set current audio track. @param i_track: the track ID (i_id field from track description). @@ -4263,12 +4430,14 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_set_track(self, i_track) + def audio_get_channel(self): '''Get current audio channel. @return: the audio channel See L{AudioOutputChannel}. ''' return libvlc_audio_get_channel(self) + def audio_set_channel(self, channel): '''Set current audio channel. @param channel: the audio channel, See L{AudioOutputChannel}. @@ -4276,6 +4445,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_set_channel(self, channel) + def audio_get_delay(self): '''Get current audio delay. @return: the audio delay (microseconds). @@ -4283,6 +4453,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_get_delay(self) + def audio_set_delay(self, i_delay): '''Set current audio delay. The audio delay will be reset to zero each time the media changes. @param i_delay: the audio delay (microseconds). @@ -4291,6 +4462,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_audio_set_delay(self, i_delay) + def set_equalizer(self, p_equalizer): '''Apply new equalizer settings to a media player. The equalizer is first created by invoking L{audio_equalizer_new}() or @@ -4313,6 +4485,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_equalizer(self, p_equalizer) + def get_role(self): '''Gets the media role. @return: the media player role (\ref libvlc_media_player_role_t). @@ -4320,6 +4493,7 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_get_role(self) + def set_role(self, role): '''Sets the media role. @param role: the media player role (\ref libvlc_media_player_role_t). @@ -4327,8 +4501,118 @@ class MediaPlayer(_Ctype): ''' return libvlc_media_player_set_role(self, role) +class Renderer(_Ctype): + '''N/A + ''' -# LibVLC __version__ functions # + def __new__(cls, ptr=_internal_guard): + '''(INTERNAL) ctypes wrapper constructor. + ''' + return _Constructor(cls, ptr) + + def hold(self): + '''Hold a renderer item, i.e. creates a new reference + This functions need to called from the libvlc_RendererDiscovererItemAdded + callback if the libvlc user wants to use this item after. (for display or + for passing it to the mediaplayer for example). + @return: the current item. + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_renderer_item_hold(self) + + + def release(self): + '''Releases a renderer item, i.e. decrements its reference counter. + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_renderer_item_release(self) + + + def name(self): + '''Get the human readable name of a renderer item. + @return: the name of the item (can't be None, must *not* be freed). + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_renderer_item_name(self) + + + def type(self): + '''Get the type (not translated) of a renderer item. For now, the type can only + be "chromecast" ("upnp", "airplay" may come later). + @return: the type of the item (can't be None, must *not* be freed). + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_renderer_item_type(self) + + + def icon_uri(self): + '''Get the icon uri of a renderer item. + @return: the uri of the item's icon (can be None, must *not* be freed). + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_renderer_item_icon_uri(self) + + + def flags(self): + '''Get the flags of a renderer item + See LIBVLC_RENDERER_CAN_AUDIO + See LIBVLC_RENDERER_CAN_VIDEO. + @return: bitwise flag: capabilities of the renderer, see. + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_renderer_item_flags(self) + +class RendererDiscoverer(_Ctype): + '''N/A + ''' + + def __new__(cls, ptr=_internal_guard): + '''(INTERNAL) ctypes wrapper constructor. + ''' + return _Constructor(cls, ptr) + + def release(self): + '''Release a renderer discoverer object. + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_renderer_discoverer_release(self) + + + def start(self): + '''Start renderer discovery + To stop it, call L{stop}() or + L{release}() directly. + See L{stop}(). + @return: -1 in case of error, 0 otherwise. + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_renderer_discoverer_start(self) + + + def stop(self): + '''Stop renderer discovery. + See L{start}(). + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_renderer_discoverer_stop(self) + + @memoize_parameterless + def event_manager(self): + '''Get the event manager of the renderer discoverer + The possible events to attach are @ref libvlc_RendererDiscovererItemAdded + and @ref libvlc_RendererDiscovererItemDeleted. + The @ref L{Renderer} struct passed to event callbacks is owned by + VLC, users should take care of holding/releasing this struct for their + internal usage. + See libvlc_event_t.u.renderer_discoverer_item_added.item + See libvlc_event_t.u.renderer_discoverer_item_removed.item. + @return: a valid event manager (can't fail). + @version: LibVLC 3.0.0 or later. + ''' + return libvlc_renderer_discoverer_event_manager(self) + + + # LibVLC __version__ functions # def libvlc_clearerr(): '''Clears the LibVLC error status for the current thread. This is optional. @@ -4337,10 +4621,9 @@ def libvlc_clearerr(): ''' f = _Cfunctions.get('libvlc_clearerr', None) or \ _Cfunction('libvlc_clearerr', (), None, - None) + None) return f() - def libvlc_vprinterr(fmt, ap): '''Sets the LibVLC error status and message for the current thread. Any previous error is overridden. @@ -4350,10 +4633,9 @@ def libvlc_vprinterr(fmt, ap): ''' f = _Cfunctions.get('libvlc_vprinterr', None) or \ _Cfunction('libvlc_vprinterr', ((1,), (1,),), None, - ctypes.c_char_p, ctypes.c_char_p, ctypes.c_void_p) + ctypes.c_char_p, ctypes.c_char_p, ctypes.c_void_p) return f(fmt, ap) - def libvlc_new(argc, argv): '''Create and initialize a libvlc instance. This functions accept a list of "command line" arguments similar to the @@ -4393,10 +4675,9 @@ def libvlc_new(argc, argv): ''' f = _Cfunctions.get('libvlc_new', None) or \ _Cfunction('libvlc_new', ((1,), (1,),), class_result(Instance), - ctypes.c_void_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p)) + ctypes.c_void_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p)) return f(argc, argv) - def libvlc_release(p_instance): '''Decrement the reference count of a libvlc instance, and destroy it if it reaches zero. @@ -4404,10 +4685,9 @@ def libvlc_release(p_instance): ''' f = _Cfunctions.get('libvlc_release', None) or \ _Cfunction('libvlc_release', ((1,),), None, - None, Instance) + None, Instance) return f(p_instance) - def libvlc_retain(p_instance): '''Increments the reference count of a libvlc instance. The initial reference count is 1 after L{libvlc_new}() returns. @@ -4415,10 +4695,9 @@ def libvlc_retain(p_instance): ''' f = _Cfunctions.get('libvlc_retain', None) or \ _Cfunction('libvlc_retain', ((1,),), None, - None, Instance) + None, Instance) return f(p_instance) - def libvlc_add_intf(p_instance, name): '''Try to start a user interface for the libvlc instance. @param p_instance: the instance. @@ -4427,10 +4706,9 @@ def libvlc_add_intf(p_instance, name): ''' f = _Cfunctions.get('libvlc_add_intf', None) or \ _Cfunction('libvlc_add_intf', ((1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p) + ctypes.c_int, Instance, ctypes.c_char_p) return f(p_instance, name) - def libvlc_set_user_agent(p_instance, name, http): '''Sets the application name. LibVLC passes this as the user agent string when a protocol requires it. @@ -4441,10 +4719,9 @@ def libvlc_set_user_agent(p_instance, name, http): ''' f = _Cfunctions.get('libvlc_set_user_agent', None) or \ _Cfunction('libvlc_set_user_agent', ((1,), (1,), (1,),), None, - None, Instance, ctypes.c_char_p, ctypes.c_char_p) + None, Instance, ctypes.c_char_p, ctypes.c_char_p) return f(p_instance, name, http) - def libvlc_set_app_id(p_instance, id, version, icon): '''Sets some meta-information about the application. See also L{libvlc_set_user_agent}(). @@ -4456,10 +4733,9 @@ def libvlc_set_app_id(p_instance, id, version, icon): ''' f = _Cfunctions.get('libvlc_set_app_id', None) or \ _Cfunction('libvlc_set_app_id', ((1,), (1,), (1,), (1,),), None, - None, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p) + None, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p) return f(p_instance, id, version, icon) - def libvlc_get_version(): '''Retrieve libvlc version. Example: "1.1.0-git The Luggage". @@ -4467,10 +4743,9 @@ def libvlc_get_version(): ''' f = _Cfunctions.get('libvlc_get_version', None) or \ _Cfunction('libvlc_get_version', (), None, - ctypes.c_char_p) + ctypes.c_char_p) return f() - def libvlc_get_compiler(): '''Retrieve libvlc compiler version. Example: "gcc version 4.2.3 (Ubuntu 4.2.3-2ubuntu6)". @@ -4478,10 +4753,9 @@ def libvlc_get_compiler(): ''' f = _Cfunctions.get('libvlc_get_compiler', None) or \ _Cfunction('libvlc_get_compiler', (), None, - ctypes.c_char_p) + ctypes.c_char_p) return f() - def libvlc_get_changeset(): '''Retrieve libvlc changeset. Example: "aa9bce0bc4". @@ -4489,10 +4763,9 @@ def libvlc_get_changeset(): ''' f = _Cfunctions.get('libvlc_get_changeset', None) or \ _Cfunction('libvlc_get_changeset', (), None, - ctypes.c_char_p) + ctypes.c_char_p) return f() - def libvlc_free(ptr): '''Frees an heap allocation returned by a LibVLC function. If you know you're using the same underlying C run-time as the LibVLC @@ -4501,10 +4774,9 @@ def libvlc_free(ptr): ''' f = _Cfunctions.get('libvlc_free', None) or \ _Cfunction('libvlc_free', ((1,),), None, - None, ctypes.c_void_p) + None, ctypes.c_void_p) return f(ptr) - def libvlc_event_attach(p_event_manager, i_event_type, f_callback, user_data): '''Register for an event notification. @param p_event_manager: the event manager to which you want to attach to. Generally it is obtained by vlc_my_object_event_manager() where my_object is the object you want to listen to. @@ -4515,10 +4787,9 @@ def libvlc_event_attach(p_event_manager, i_event_type, f_callback, user_data): ''' f = _Cfunctions.get('libvlc_event_attach', None) or \ _Cfunction('libvlc_event_attach', ((1,), (1,), (1,), (1,),), None, - ctypes.c_int, EventManager, ctypes.c_uint, Callback, ctypes.c_void_p) + ctypes.c_int, EventManager, ctypes.c_uint, Callback, ctypes.c_void_p) return f(p_event_manager, i_event_type, f_callback, user_data) - def libvlc_event_detach(p_event_manager, i_event_type, f_callback, p_user_data): '''Unregister an event notification. @param p_event_manager: the event manager. @@ -4528,20 +4799,18 @@ def libvlc_event_detach(p_event_manager, i_event_type, f_callback, p_user_data): ''' f = _Cfunctions.get('libvlc_event_detach', None) or \ _Cfunction('libvlc_event_detach', ((1,), (1,), (1,), (1,),), None, - None, EventManager, ctypes.c_uint, Callback, ctypes.c_void_p) + None, EventManager, ctypes.c_uint, Callback, ctypes.c_void_p) return f(p_event_manager, i_event_type, f_callback, p_user_data) - def libvlc_event_type_name(event_type): '''Get an event's type name. @param event_type: the desired event. ''' f = _Cfunctions.get('libvlc_event_type_name', None) or \ _Cfunction('libvlc_event_type_name', ((1,),), None, - ctypes.c_char_p, ctypes.c_uint) + ctypes.c_char_p, ctypes.c_uint) return f(event_type) - def libvlc_log_get_context(ctx): '''Gets log message debug infos. This function retrieves self-debug information about a log message: @@ -4556,11 +4825,9 @@ def libvlc_log_get_context(ctx): ''' f = _Cfunctions.get('libvlc_log_get_context', None) or \ _Cfunction('libvlc_log_get_context', ((1,), (2,), (2,), (2,),), None, - None, Log_ptr, ListPOINTER(ctypes.c_char_p), ListPOINTER(ctypes.c_char_p), - ctypes.POINTER(ctypes.c_uint)) + None, Log_ptr, ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_uint)) return f(ctx) - def libvlc_log_get_object(ctx, id): '''Gets log message info. This function retrieves meta-information about a log message: @@ -4579,11 +4846,9 @@ def libvlc_log_get_object(ctx, id): ''' f = _Cfunctions.get('libvlc_log_get_object', None) or \ _Cfunction('libvlc_log_get_object', ((1,), (2,), (2,), (1,),), None, - None, Log_ptr, ListPOINTER(ctypes.c_char_p), ListPOINTER(ctypes.c_char_p), - ctypes.POINTER(ctypes.c_uint)) + None, Log_ptr, ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_char_p), ctypes.POINTER(ctypes.c_uint)) return f(ctx, id) - def libvlc_log_unset(p_instance): '''Unsets the logging callback. This function deregisters the logging callback for a LibVLC instance. @@ -4596,10 +4861,9 @@ def libvlc_log_unset(p_instance): ''' f = _Cfunctions.get('libvlc_log_unset', None) or \ _Cfunction('libvlc_log_unset', ((1,),), None, - None, Instance) + None, Instance) return f(p_instance) - def libvlc_log_set(p_instance, cb, data): '''Sets the logging callback for a LibVLC instance. This function is thread-safe: it will wait for any pending callbacks @@ -4611,10 +4875,9 @@ def libvlc_log_set(p_instance, cb, data): ''' f = _Cfunctions.get('libvlc_log_set', None) or \ _Cfunction('libvlc_log_set', ((1,), (1,), (1,),), None, - None, Instance, LogCb, ctypes.c_void_p) + None, Instance, LogCb, ctypes.c_void_p) return f(p_instance, cb, data) - def libvlc_log_set_file(p_instance, stream): '''Sets up logging to a file. @param p_instance: libvlc instance. @@ -4623,20 +4886,18 @@ def libvlc_log_set_file(p_instance, stream): ''' f = _Cfunctions.get('libvlc_log_set_file', None) or \ _Cfunction('libvlc_log_set_file', ((1,), (1,),), None, - None, Instance, FILE_ptr) + None, Instance, FILE_ptr) return f(p_instance, stream) - def libvlc_module_description_list_release(p_list): '''Release a list of module descriptions. @param p_list: the list to be released. ''' f = _Cfunctions.get('libvlc_module_description_list_release', None) or \ _Cfunction('libvlc_module_description_list_release', ((1,),), None, - None, ctypes.POINTER(ModuleDescription)) + None, ctypes.POINTER(ModuleDescription)) return f(p_list) - def libvlc_audio_filter_list_get(p_instance): '''Returns a list of audio filters that are available. @param p_instance: libvlc instance. @@ -4644,10 +4905,9 @@ def libvlc_audio_filter_list_get(p_instance): ''' f = _Cfunctions.get('libvlc_audio_filter_list_get', None) or \ _Cfunction('libvlc_audio_filter_list_get', ((1,),), None, - ctypes.POINTER(ModuleDescription), Instance) + ctypes.POINTER(ModuleDescription), Instance) return f(p_instance) - def libvlc_video_filter_list_get(p_instance): '''Returns a list of video filters that are available. @param p_instance: libvlc instance. @@ -4655,10 +4915,9 @@ def libvlc_video_filter_list_get(p_instance): ''' f = _Cfunctions.get('libvlc_video_filter_list_get', None) or \ _Cfunction('libvlc_video_filter_list_get', ((1,),), None, - ctypes.POINTER(ModuleDescription), Instance) + ctypes.POINTER(ModuleDescription), Instance) return f(p_instance) - def libvlc_clock(): '''Return the current time as defined by LibVLC. The unit is the microsecond. Time increases monotonically (regardless of time zone changes and RTC @@ -4669,10 +4928,9 @@ def libvlc_clock(): ''' f = _Cfunctions.get('libvlc_clock', None) or \ _Cfunction('libvlc_clock', (), None, - ctypes.c_int64) + ctypes.c_int64) return f() - def libvlc_media_discoverer_new(p_inst, psz_name): '''Create a media discoverer object by name. After this object is created, you should attach to media_list events in @@ -4689,10 +4947,9 @@ def libvlc_media_discoverer_new(p_inst, psz_name): ''' f = _Cfunctions.get('libvlc_media_discoverer_new', None) or \ _Cfunction('libvlc_media_discoverer_new', ((1,), (1,),), class_result(MediaDiscoverer), - ctypes.c_void_p, Instance, ctypes.c_char_p) + ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_inst, psz_name) - def libvlc_media_discoverer_start(p_mdis): '''Start media discovery. To stop it, call L{libvlc_media_discoverer_stop}() or @@ -4704,10 +4961,9 @@ def libvlc_media_discoverer_start(p_mdis): ''' f = _Cfunctions.get('libvlc_media_discoverer_start', None) or \ _Cfunction('libvlc_media_discoverer_start', ((1,),), None, - ctypes.c_int, MediaDiscoverer) + ctypes.c_int, MediaDiscoverer) return f(p_mdis) - def libvlc_media_discoverer_stop(p_mdis): '''Stop media discovery. See L{libvlc_media_discoverer_start}. @@ -4716,10 +4972,9 @@ def libvlc_media_discoverer_stop(p_mdis): ''' f = _Cfunctions.get('libvlc_media_discoverer_stop', None) or \ _Cfunction('libvlc_media_discoverer_stop', ((1,),), None, - None, MediaDiscoverer) + None, MediaDiscoverer) return f(p_mdis) - def libvlc_media_discoverer_release(p_mdis): '''Release media discover object. If the reference count reaches 0, then the object will be released. @@ -4727,10 +4982,9 @@ def libvlc_media_discoverer_release(p_mdis): ''' f = _Cfunctions.get('libvlc_media_discoverer_release', None) or \ _Cfunction('libvlc_media_discoverer_release', ((1,),), None, - None, MediaDiscoverer) + None, MediaDiscoverer) return f(p_mdis) - def libvlc_media_discoverer_media_list(p_mdis): '''Get media service discover media list. @param p_mdis: media service discover object. @@ -4738,10 +4992,9 @@ def libvlc_media_discoverer_media_list(p_mdis): ''' f = _Cfunctions.get('libvlc_media_discoverer_media_list', None) or \ _Cfunction('libvlc_media_discoverer_media_list', ((1,),), class_result(MediaList), - ctypes.c_void_p, MediaDiscoverer) + ctypes.c_void_p, MediaDiscoverer) return f(p_mdis) - def libvlc_media_discoverer_is_running(p_mdis): '''Query if media service discover object is running. @param p_mdis: media service discover object. @@ -4749,10 +5002,9 @@ def libvlc_media_discoverer_is_running(p_mdis): ''' f = _Cfunctions.get('libvlc_media_discoverer_is_running', None) or \ _Cfunction('libvlc_media_discoverer_is_running', ((1,),), None, - ctypes.c_int, MediaDiscoverer) + ctypes.c_int, MediaDiscoverer) return f(p_mdis) - def libvlc_media_discoverer_list_get(p_inst, i_cat, ppp_services): '''Get media discoverer services by category. @param p_inst: libvlc instance. @@ -4763,11 +5015,9 @@ def libvlc_media_discoverer_list_get(p_inst, i_cat, ppp_services): ''' f = _Cfunctions.get('libvlc_media_discoverer_list_get', None) or \ _Cfunction('libvlc_media_discoverer_list_get', ((1,), (1,), (1,),), None, - ctypes.c_size_t, Instance, MediaDiscovererCategory, - ctypes.POINTER(ctypes.POINTER(MediaDiscovererDescription))) + ctypes.c_size_t, Instance, MediaDiscovererCategory, ctypes.POINTER(ctypes.POINTER(MediaDiscovererDescription))) return f(p_inst, i_cat, ppp_services) - def libvlc_media_discoverer_list_release(pp_services, i_count): '''Release an array of media discoverer services. @param pp_services: array to release. @@ -4776,30 +5026,27 @@ def libvlc_media_discoverer_list_release(pp_services, i_count): ''' f = _Cfunctions.get('libvlc_media_discoverer_list_release', None) or \ _Cfunction('libvlc_media_discoverer_list_release', ((1,), (1,),), None, - None, ctypes.POINTER(MediaDiscovererDescription), ctypes.c_size_t) + None, ctypes.POINTER(MediaDiscovererDescription), ctypes.c_size_t) return f(pp_services, i_count) - def libvlc_dialog_set_context(p_id, p_context): '''Associate an opaque pointer with the dialog id. @version: LibVLC 3.0.0 and later. ''' f = _Cfunctions.get('libvlc_dialog_set_context', None) or \ _Cfunction('libvlc_dialog_set_context', ((1,), (1,),), None, - None, ctypes.c_void_p, ctypes.c_void_p) + None, ctypes.c_void_p, ctypes.c_void_p) return f(p_id, p_context) - def libvlc_dialog_get_context(p_id): '''Return the opaque pointer associated with the dialog id. @version: LibVLC 3.0.0 and later. ''' f = _Cfunctions.get('libvlc_dialog_get_context', None) or \ _Cfunction('libvlc_dialog_get_context', ((1,),), None, - ctypes.c_void_p, ctypes.c_void_p) + ctypes.c_void_p, ctypes.c_void_p) return f(p_id) - def libvlc_dialog_post_login(p_id, psz_username, psz_password, b_store): '''Post a login answer After this call, p_id won't be valid anymore @@ -4813,10 +5060,9 @@ def libvlc_dialog_post_login(p_id, psz_username, psz_password, b_store): ''' f = _Cfunctions.get('libvlc_dialog_post_login', None) or \ _Cfunction('libvlc_dialog_post_login', ((1,), (1,), (1,), (1,),), None, - ctypes.c_int, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_bool) + ctypes.c_int, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_bool) return f(p_id, psz_username, psz_password, b_store) - def libvlc_dialog_post_action(p_id, i_action): '''Post a question answer After this call, p_id won't be valid anymore @@ -4828,10 +5074,9 @@ def libvlc_dialog_post_action(p_id, i_action): ''' f = _Cfunctions.get('libvlc_dialog_post_action', None) or \ _Cfunction('libvlc_dialog_post_action', ((1,), (1,),), None, - ctypes.c_int, ctypes.c_void_p, ctypes.c_int) + ctypes.c_int, ctypes.c_void_p, ctypes.c_int) return f(p_id, i_action) - def libvlc_dialog_dismiss(p_id): '''Dismiss a dialog After this call, p_id won't be valid anymore @@ -4842,10 +5087,9 @@ def libvlc_dialog_dismiss(p_id): ''' f = _Cfunctions.get('libvlc_dialog_dismiss', None) or \ _Cfunction('libvlc_dialog_dismiss', ((1,),), None, - ctypes.c_int, ctypes.c_void_p) + ctypes.c_int, ctypes.c_void_p) return f(p_id) - def libvlc_media_library_new(p_instance): '''Create an new Media Library object. @param p_instance: the libvlc instance. @@ -4853,10 +5097,9 @@ def libvlc_media_library_new(p_instance): ''' f = _Cfunctions.get('libvlc_media_library_new', None) or \ _Cfunction('libvlc_media_library_new', ((1,),), class_result(MediaLibrary), - ctypes.c_void_p, Instance) + ctypes.c_void_p, Instance) return f(p_instance) - def libvlc_media_library_release(p_mlib): '''Release media library object. This functions decrements the reference count of the media library object. If it reaches 0, @@ -4865,10 +5108,9 @@ def libvlc_media_library_release(p_mlib): ''' f = _Cfunctions.get('libvlc_media_library_release', None) or \ _Cfunction('libvlc_media_library_release', ((1,),), None, - None, MediaLibrary) + None, MediaLibrary) return f(p_mlib) - def libvlc_media_library_retain(p_mlib): '''Retain a reference to a media library object. This function will increment the reference counting for this object. Use @@ -4877,10 +5119,9 @@ def libvlc_media_library_retain(p_mlib): ''' f = _Cfunctions.get('libvlc_media_library_retain', None) or \ _Cfunction('libvlc_media_library_retain', ((1,),), None, - None, MediaLibrary) + None, MediaLibrary) return f(p_mlib) - def libvlc_media_library_load(p_mlib): '''Load media library. @param p_mlib: media library object. @@ -4888,10 +5129,9 @@ def libvlc_media_library_load(p_mlib): ''' f = _Cfunctions.get('libvlc_media_library_load', None) or \ _Cfunction('libvlc_media_library_load', ((1,),), None, - ctypes.c_int, MediaLibrary) + ctypes.c_int, MediaLibrary) return f(p_mlib) - def libvlc_media_library_media_list(p_mlib): '''Get media library subitems. @param p_mlib: media library object. @@ -4899,20 +5139,18 @@ def libvlc_media_library_media_list(p_mlib): ''' f = _Cfunctions.get('libvlc_media_library_media_list', None) or \ _Cfunction('libvlc_media_library_media_list', ((1,),), class_result(MediaList), - ctypes.c_void_p, MediaLibrary) + ctypes.c_void_p, MediaLibrary) return f(p_mlib) - def libvlc_vlm_release(p_instance): '''Release the vlm instance related to the given L{Instance}. @param p_instance: the instance. ''' f = _Cfunctions.get('libvlc_vlm_release', None) or \ _Cfunction('libvlc_vlm_release', ((1,),), None, - None, Instance) + None, Instance) return f(p_instance) - def libvlc_vlm_add_broadcast(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop): '''Add a broadcast, with one input. @param p_instance: the instance. @@ -4927,11 +5165,9 @@ def libvlc_vlm_add_broadcast(p_instance, psz_name, psz_input, psz_output, i_opti ''' f = _Cfunctions.get('libvlc_vlm_add_broadcast', None) or \ _Cfunction('libvlc_vlm_add_broadcast', ((1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, - ListPOINTER(ctypes.c_char_p), ctypes.c_int, ctypes.c_int) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p), ctypes.c_int, ctypes.c_int) return f(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop) - def libvlc_vlm_add_vod(p_instance, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux): '''Add a vod, with one input. @param p_instance: the instance. @@ -4945,11 +5181,9 @@ def libvlc_vlm_add_vod(p_instance, psz_name, psz_input, i_options, ppsz_options, ''' f = _Cfunctions.get('libvlc_vlm_add_vod', None) or \ _Cfunction('libvlc_vlm_add_vod', ((1,), (1,), (1,), (1,), (1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p), - ctypes.c_int, ctypes.c_char_p) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p), ctypes.c_int, ctypes.c_char_p) return f(p_instance, psz_name, psz_input, i_options, ppsz_options, b_enabled, psz_mux) - def libvlc_vlm_del_media(p_instance, psz_name): '''Delete a media (VOD or broadcast). @param p_instance: the instance. @@ -4958,10 +5192,9 @@ def libvlc_vlm_del_media(p_instance, psz_name): ''' f = _Cfunctions.get('libvlc_vlm_del_media', None) or \ _Cfunction('libvlc_vlm_del_media', ((1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p) + ctypes.c_int, Instance, ctypes.c_char_p) return f(p_instance, psz_name) - def libvlc_vlm_set_enabled(p_instance, psz_name, b_enabled): '''Enable or disable a media (VOD or broadcast). @param p_instance: the instance. @@ -4971,10 +5204,9 @@ def libvlc_vlm_set_enabled(p_instance, psz_name, b_enabled): ''' f = _Cfunctions.get('libvlc_vlm_set_enabled', None) or \ _Cfunction('libvlc_vlm_set_enabled', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, b_enabled) - def libvlc_vlm_set_output(p_instance, psz_name, psz_output): '''Set the output for a media. @param p_instance: the instance. @@ -4984,10 +5216,9 @@ def libvlc_vlm_set_output(p_instance, psz_name, psz_output): ''' f = _Cfunctions.get('libvlc_vlm_set_output', None) or \ _Cfunction('libvlc_vlm_set_output', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p) return f(p_instance, psz_name, psz_output) - def libvlc_vlm_set_input(p_instance, psz_name, psz_input): '''Set a media's input MRL. This will delete all existing inputs and add the specified one. @@ -4998,10 +5229,9 @@ def libvlc_vlm_set_input(p_instance, psz_name, psz_input): ''' f = _Cfunctions.get('libvlc_vlm_set_input', None) or \ _Cfunction('libvlc_vlm_set_input', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p) return f(p_instance, psz_name, psz_input) - def libvlc_vlm_add_input(p_instance, psz_name, psz_input): '''Add a media's input MRL. This will add the specified one. @param p_instance: the instance. @@ -5011,10 +5241,9 @@ def libvlc_vlm_add_input(p_instance, psz_name, psz_input): ''' f = _Cfunctions.get('libvlc_vlm_add_input', None) or \ _Cfunction('libvlc_vlm_add_input', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p) return f(p_instance, psz_name, psz_input) - def libvlc_vlm_set_loop(p_instance, psz_name, b_loop): '''Set a media's loop status. @param p_instance: the instance. @@ -5024,10 +5253,9 @@ def libvlc_vlm_set_loop(p_instance, psz_name, b_loop): ''' f = _Cfunctions.get('libvlc_vlm_set_loop', None) or \ _Cfunction('libvlc_vlm_set_loop', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, b_loop) - def libvlc_vlm_set_mux(p_instance, psz_name, psz_mux): '''Set a media's vod muxer. @param p_instance: the instance. @@ -5037,10 +5265,9 @@ def libvlc_vlm_set_mux(p_instance, psz_name, psz_mux): ''' f = _Cfunctions.get('libvlc_vlm_set_mux', None) or \ _Cfunction('libvlc_vlm_set_mux', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p) return f(p_instance, psz_name, psz_mux) - def libvlc_vlm_change_media(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop): '''Edit the parameters of a media. This will delete all existing inputs and add the specified one. @@ -5056,11 +5283,9 @@ def libvlc_vlm_change_media(p_instance, psz_name, psz_input, psz_output, i_optio ''' f = _Cfunctions.get('libvlc_vlm_change_media', None) or \ _Cfunction('libvlc_vlm_change_media', ((1,), (1,), (1,), (1,), (1,), (1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, - ListPOINTER(ctypes.c_char_p), ctypes.c_int, ctypes.c_int) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_int, ListPOINTER(ctypes.c_char_p), ctypes.c_int, ctypes.c_int) return f(p_instance, psz_name, psz_input, psz_output, i_options, ppsz_options, b_enabled, b_loop) - def libvlc_vlm_play_media(p_instance, psz_name): '''Play the named broadcast. @param p_instance: the instance. @@ -5069,10 +5294,9 @@ def libvlc_vlm_play_media(p_instance, psz_name): ''' f = _Cfunctions.get('libvlc_vlm_play_media', None) or \ _Cfunction('libvlc_vlm_play_media', ((1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p) + ctypes.c_int, Instance, ctypes.c_char_p) return f(p_instance, psz_name) - def libvlc_vlm_stop_media(p_instance, psz_name): '''Stop the named broadcast. @param p_instance: the instance. @@ -5081,10 +5305,9 @@ def libvlc_vlm_stop_media(p_instance, psz_name): ''' f = _Cfunctions.get('libvlc_vlm_stop_media', None) or \ _Cfunction('libvlc_vlm_stop_media', ((1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p) + ctypes.c_int, Instance, ctypes.c_char_p) return f(p_instance, psz_name) - def libvlc_vlm_pause_media(p_instance, psz_name): '''Pause the named broadcast. @param p_instance: the instance. @@ -5093,10 +5316,9 @@ def libvlc_vlm_pause_media(p_instance, psz_name): ''' f = _Cfunctions.get('libvlc_vlm_pause_media', None) or \ _Cfunction('libvlc_vlm_pause_media', ((1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p) + ctypes.c_int, Instance, ctypes.c_char_p) return f(p_instance, psz_name) - def libvlc_vlm_seek_media(p_instance, psz_name, f_percentage): '''Seek in the named broadcast. @param p_instance: the instance. @@ -5106,10 +5328,9 @@ def libvlc_vlm_seek_media(p_instance, psz_name, f_percentage): ''' f = _Cfunctions.get('libvlc_vlm_seek_media', None) or \ _Cfunction('libvlc_vlm_seek_media', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_float) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_float) return f(p_instance, psz_name, f_percentage) - def libvlc_vlm_show_media(p_instance, psz_name): '''Return information about the named media as a JSON string representation. @@ -5125,10 +5346,9 @@ def libvlc_vlm_show_media(p_instance, psz_name): ''' f = _Cfunctions.get('libvlc_vlm_show_media', None) or \ _Cfunction('libvlc_vlm_show_media', ((1,), (1,),), string_result, - ctypes.c_void_p, Instance, ctypes.c_char_p) + ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_instance, psz_name) - def libvlc_vlm_get_media_instance_position(p_instance, psz_name, i_instance): '''Get vlm_media instance position by name or instance id. @param p_instance: a libvlc instance. @@ -5138,10 +5358,9 @@ def libvlc_vlm_get_media_instance_position(p_instance, psz_name, i_instance): ''' f = _Cfunctions.get('libvlc_vlm_get_media_instance_position', None) or \ _Cfunction('libvlc_vlm_get_media_instance_position', ((1,), (1,), (1,),), None, - ctypes.c_float, Instance, ctypes.c_char_p, ctypes.c_int) + ctypes.c_float, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, i_instance) - def libvlc_vlm_get_media_instance_time(p_instance, psz_name, i_instance): '''Get vlm_media instance time by name or instance id. @param p_instance: a libvlc instance. @@ -5151,10 +5370,9 @@ def libvlc_vlm_get_media_instance_time(p_instance, psz_name, i_instance): ''' f = _Cfunctions.get('libvlc_vlm_get_media_instance_time', None) or \ _Cfunction('libvlc_vlm_get_media_instance_time', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, i_instance) - def libvlc_vlm_get_media_instance_length(p_instance, psz_name, i_instance): '''Get vlm_media instance length by name or instance id. @param p_instance: a libvlc instance. @@ -5164,10 +5382,9 @@ def libvlc_vlm_get_media_instance_length(p_instance, psz_name, i_instance): ''' f = _Cfunctions.get('libvlc_vlm_get_media_instance_length', None) or \ _Cfunction('libvlc_vlm_get_media_instance_length', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, i_instance) - def libvlc_vlm_get_media_instance_rate(p_instance, psz_name, i_instance): '''Get vlm_media instance playback rate by name or instance id. @param p_instance: a libvlc instance. @@ -5177,10 +5394,9 @@ def libvlc_vlm_get_media_instance_rate(p_instance, psz_name, i_instance): ''' f = _Cfunctions.get('libvlc_vlm_get_media_instance_rate', None) or \ _Cfunction('libvlc_vlm_get_media_instance_rate', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, i_instance) - def libvlc_vlm_get_media_instance_title(p_instance, psz_name, i_instance): '''Get vlm_media instance title number by name or instance id. @param p_instance: a libvlc instance. @@ -5191,10 +5407,9 @@ def libvlc_vlm_get_media_instance_title(p_instance, psz_name, i_instance): ''' f = _Cfunctions.get('libvlc_vlm_get_media_instance_title', None) or \ _Cfunction('libvlc_vlm_get_media_instance_title', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, i_instance) - def libvlc_vlm_get_media_instance_chapter(p_instance, psz_name, i_instance): '''Get vlm_media instance chapter number by name or instance id. @param p_instance: a libvlc instance. @@ -5205,10 +5420,9 @@ def libvlc_vlm_get_media_instance_chapter(p_instance, psz_name, i_instance): ''' f = _Cfunctions.get('libvlc_vlm_get_media_instance_chapter', None) or \ _Cfunction('libvlc_vlm_get_media_instance_chapter', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, i_instance) - def libvlc_vlm_get_media_instance_seekable(p_instance, psz_name, i_instance): '''Is libvlc instance seekable ? @param p_instance: a libvlc instance. @@ -5219,10 +5433,9 @@ def libvlc_vlm_get_media_instance_seekable(p_instance, psz_name, i_instance): ''' f = _Cfunctions.get('libvlc_vlm_get_media_instance_seekable', None) or \ _Cfunction('libvlc_vlm_get_media_instance_seekable', ((1,), (1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) + ctypes.c_int, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_name, i_instance) - def libvlc_vlm_get_event_manager(p_instance): '''Get libvlc_event_manager from a vlm media. The p_event_manager is immutable, so you don't have to hold the lock. @@ -5231,10 +5444,9 @@ def libvlc_vlm_get_event_manager(p_instance): ''' f = _Cfunctions.get('libvlc_vlm_get_event_manager', None) or \ _Cfunction('libvlc_vlm_get_event_manager', ((1,),), class_result(EventManager), - ctypes.c_void_p, Instance) + ctypes.c_void_p, Instance) return f(p_instance) - def libvlc_media_new_location(p_instance, psz_mrl): '''Create a media with a certain given media resource location, for instance a valid URL. @@ -5249,10 +5461,9 @@ def libvlc_media_new_location(p_instance, psz_mrl): ''' f = _Cfunctions.get('libvlc_media_new_location', None) or \ _Cfunction('libvlc_media_new_location', ((1,), (1,),), class_result(Media), - ctypes.c_void_p, Instance, ctypes.c_char_p) + ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_instance, psz_mrl) - def libvlc_media_new_path(p_instance, path): '''Create a media for a certain file path. See L{libvlc_media_release}. @@ -5262,10 +5473,9 @@ def libvlc_media_new_path(p_instance, path): ''' f = _Cfunctions.get('libvlc_media_new_path', None) or \ _Cfunction('libvlc_media_new_path', ((1,), (1,),), class_result(Media), - ctypes.c_void_p, Instance, ctypes.c_char_p) + ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_instance, path) - def libvlc_media_new_fd(p_instance, fd): '''Create a media for an already open file descriptor. The file descriptor shall be open for reading (or reading and writing). @@ -5287,10 +5497,9 @@ def libvlc_media_new_fd(p_instance, fd): ''' f = _Cfunctions.get('libvlc_media_new_fd', None) or \ _Cfunction('libvlc_media_new_fd', ((1,), (1,),), class_result(Media), - ctypes.c_void_p, Instance, ctypes.c_int) + ctypes.c_void_p, Instance, ctypes.c_int) return f(p_instance, fd) - def libvlc_media_new_callbacks(instance, open_cb, read_cb, seek_cb, close_cb, opaque): '''Create a media with custom callbacks to read the data from. @param instance: LibVLC instance. @@ -5304,10 +5513,9 @@ def libvlc_media_new_callbacks(instance, open_cb, read_cb, seek_cb, close_cb, op ''' f = _Cfunctions.get('libvlc_media_new_callbacks', None) or \ _Cfunction('libvlc_media_new_callbacks', ((1,), (1,), (1,), (1,), (1,), (1,),), class_result(Media), - ctypes.c_void_p, Instance, MediaOpenCb, MediaReadCb, MediaSeekCb, MediaCloseCb, ctypes.c_void_p) + ctypes.c_void_p, Instance, MediaOpenCb, MediaReadCb, MediaSeekCb, MediaCloseCb, ctypes.c_void_p) return f(instance, open_cb, read_cb, seek_cb, close_cb, opaque) - def libvlc_media_new_as_node(p_instance, psz_name): '''Create a media as an empty node with a given name. See L{libvlc_media_release}. @@ -5317,10 +5525,9 @@ def libvlc_media_new_as_node(p_instance, psz_name): ''' f = _Cfunctions.get('libvlc_media_new_as_node', None) or \ _Cfunction('libvlc_media_new_as_node', ((1,), (1,),), class_result(Media), - ctypes.c_void_p, Instance, ctypes.c_char_p) + ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_instance, psz_name) - def libvlc_media_add_option(p_md, psz_options): '''Add an option to the media. This option will be used to determine how the media_player will @@ -5338,10 +5545,9 @@ def libvlc_media_add_option(p_md, psz_options): ''' f = _Cfunctions.get('libvlc_media_add_option', None) or \ _Cfunction('libvlc_media_add_option', ((1,), (1,),), None, - None, Media, ctypes.c_char_p) + None, Media, ctypes.c_char_p) return f(p_md, psz_options) - def libvlc_media_add_option_flag(p_md, psz_options, i_flags): '''Add an option to the media with configurable flags. This option will be used to determine how the media_player will @@ -5358,10 +5564,9 @@ def libvlc_media_add_option_flag(p_md, psz_options, i_flags): ''' f = _Cfunctions.get('libvlc_media_add_option_flag', None) or \ _Cfunction('libvlc_media_add_option_flag', ((1,), (1,), (1,),), None, - None, Media, ctypes.c_char_p, ctypes.c_uint) + None, Media, ctypes.c_char_p, ctypes.c_uint) return f(p_md, psz_options, i_flags) - def libvlc_media_retain(p_md): '''Retain a reference to a media descriptor object (L{Media}). Use L{libvlc_media_release}() to decrement the reference count of a @@ -5370,10 +5575,9 @@ def libvlc_media_retain(p_md): ''' f = _Cfunctions.get('libvlc_media_retain', None) or \ _Cfunction('libvlc_media_retain', ((1,),), None, - None, Media) + None, Media) return f(p_md) - def libvlc_media_release(p_md): '''Decrement the reference count of a media descriptor object. If the reference count is 0, then L{libvlc_media_release}() will release the @@ -5384,10 +5588,9 @@ def libvlc_media_release(p_md): ''' f = _Cfunctions.get('libvlc_media_release', None) or \ _Cfunction('libvlc_media_release', ((1,),), None, - None, Media) + None, Media) return f(p_md) - def libvlc_media_get_mrl(p_md): '''Get the media resource locator (mrl) from a media descriptor object. @param p_md: a media descriptor object. @@ -5395,20 +5598,18 @@ def libvlc_media_get_mrl(p_md): ''' f = _Cfunctions.get('libvlc_media_get_mrl', None) or \ _Cfunction('libvlc_media_get_mrl', ((1,),), string_result, - ctypes.c_void_p, Media) + ctypes.c_void_p, Media) return f(p_md) - def libvlc_media_duplicate(p_md): '''Duplicate a media descriptor object. @param p_md: a media descriptor object. ''' f = _Cfunctions.get('libvlc_media_duplicate', None) or \ _Cfunction('libvlc_media_duplicate', ((1,),), class_result(Media), - ctypes.c_void_p, Media) + ctypes.c_void_p, Media) return f(p_md) - def libvlc_media_get_meta(p_md, e_meta): '''Read the meta of the media. If the media has not yet been parsed this will return None. @@ -5421,10 +5622,9 @@ def libvlc_media_get_meta(p_md, e_meta): ''' f = _Cfunctions.get('libvlc_media_get_meta', None) or \ _Cfunction('libvlc_media_get_meta', ((1,), (1,),), string_result, - ctypes.c_void_p, Media, Meta) + ctypes.c_void_p, Media, Meta) return f(p_md, e_meta) - def libvlc_media_set_meta(p_md, e_meta, psz_value): '''Set the meta of the media (this function will not save the meta, call L{libvlc_media_save_meta} in order to save the meta). @@ -5434,10 +5634,9 @@ def libvlc_media_set_meta(p_md, e_meta, psz_value): ''' f = _Cfunctions.get('libvlc_media_set_meta', None) or \ _Cfunction('libvlc_media_set_meta', ((1,), (1,), (1,),), None, - None, Media, Meta, ctypes.c_char_p) + None, Media, Meta, ctypes.c_char_p) return f(p_md, e_meta, psz_value) - def libvlc_media_save_meta(p_md): '''Save the meta previously set. @param p_md: the media desriptor. @@ -5445,10 +5644,9 @@ def libvlc_media_save_meta(p_md): ''' f = _Cfunctions.get('libvlc_media_save_meta', None) or \ _Cfunction('libvlc_media_save_meta', ((1,),), None, - ctypes.c_int, Media) + ctypes.c_int, Media) return f(p_md) - def libvlc_media_get_state(p_md): '''Get current state of media descriptor object. Possible media states are libvlc_NothingSpecial=0, libvlc_Opening, libvlc_Playing, libvlc_Paused, @@ -5459,10 +5657,9 @@ def libvlc_media_get_state(p_md): ''' f = _Cfunctions.get('libvlc_media_get_state', None) or \ _Cfunction('libvlc_media_get_state', ((1,),), None, - State, Media) + State, Media) return f(p_md) - def libvlc_media_get_stats(p_md, p_stats): '''Get the current statistics about the media. @param p_md:: media descriptor object. @@ -5471,10 +5668,9 @@ def libvlc_media_get_stats(p_md, p_stats): ''' f = _Cfunctions.get('libvlc_media_get_stats', None) or \ _Cfunction('libvlc_media_get_stats', ((1,), (1,),), None, - ctypes.c_int, Media, ctypes.POINTER(MediaStats)) + ctypes.c_int, Media, ctypes.POINTER(MediaStats)) return f(p_md, p_stats) - def libvlc_media_subitems(p_md): '''Get subitems of media descriptor object. This will increment the reference count of supplied media descriptor object. Use @@ -5484,10 +5680,9 @@ def libvlc_media_subitems(p_md): ''' f = _Cfunctions.get('libvlc_media_subitems', None) or \ _Cfunction('libvlc_media_subitems', ((1,),), class_result(MediaList), - ctypes.c_void_p, Media) + ctypes.c_void_p, Media) return f(p_md) - def libvlc_media_event_manager(p_md): '''Get event manager from media descriptor object. NOTE: this function doesn't increment reference counting. @@ -5496,10 +5691,9 @@ def libvlc_media_event_manager(p_md): ''' f = _Cfunctions.get('libvlc_media_event_manager', None) or \ _Cfunction('libvlc_media_event_manager', ((1,),), class_result(EventManager), - ctypes.c_void_p, Media) + ctypes.c_void_p, Media) return f(p_md) - def libvlc_media_get_duration(p_md): '''Get duration (in ms) of media descriptor object item. @param p_md: media descriptor object. @@ -5507,10 +5701,9 @@ def libvlc_media_get_duration(p_md): ''' f = _Cfunctions.get('libvlc_media_get_duration', None) or \ _Cfunction('libvlc_media_get_duration', ((1,),), None, - ctypes.c_longlong, Media) + ctypes.c_longlong, Media) return f(p_md) - def libvlc_media_parse_with_options(p_md, parse_flag, timeout): '''Parse the media asynchronously with options. This fetches (local or network) art, meta data and/or tracks information. @@ -5535,10 +5728,9 @@ def libvlc_media_parse_with_options(p_md, parse_flag, timeout): ''' f = _Cfunctions.get('libvlc_media_parse_with_options', None) or \ _Cfunction('libvlc_media_parse_with_options', ((1,), (1,), (1,),), None, - ctypes.c_int, Media, MediaParseFlag, ctypes.c_int) + ctypes.c_int, Media, MediaParseFlag, ctypes.c_int) return f(p_md, parse_flag, timeout) - def libvlc_media_parse_stop(p_md): '''Stop the parsing of the media When the media parsing is stopped, the libvlc_MediaParsedChanged event will @@ -5549,10 +5741,9 @@ def libvlc_media_parse_stop(p_md): ''' f = _Cfunctions.get('libvlc_media_parse_stop', None) or \ _Cfunction('libvlc_media_parse_stop', ((1,),), None, - None, Media) + None, Media) return f(p_md) - def libvlc_media_get_parsed_status(p_md): '''Get Parsed status for media descriptor object. See libvlc_MediaParsedChanged @@ -5563,10 +5754,9 @@ def libvlc_media_get_parsed_status(p_md): ''' f = _Cfunctions.get('libvlc_media_get_parsed_status', None) or \ _Cfunction('libvlc_media_get_parsed_status', ((1,),), None, - MediaParsedStatus, Media) + MediaParsedStatus, Media) return f(p_md) - def libvlc_media_set_user_data(p_md, p_new_user_data): '''Sets media descriptor's user_data. user_data is specialized data accessed by the host application, VLC.framework uses it as a pointer to @@ -5576,10 +5766,9 @@ def libvlc_media_set_user_data(p_md, p_new_user_data): ''' f = _Cfunctions.get('libvlc_media_set_user_data', None) or \ _Cfunction('libvlc_media_set_user_data', ((1,), (1,),), None, - None, Media, ctypes.c_void_p) + None, Media, ctypes.c_void_p) return f(p_md, p_new_user_data) - def libvlc_media_get_user_data(p_md): '''Get media descriptor's user_data. user_data is specialized data accessed by the host application, VLC.framework uses it as a pointer to @@ -5588,10 +5777,9 @@ def libvlc_media_get_user_data(p_md): ''' f = _Cfunctions.get('libvlc_media_get_user_data', None) or \ _Cfunction('libvlc_media_get_user_data', ((1,),), None, - ctypes.c_void_p, Media) + ctypes.c_void_p, Media) return f(p_md) - def libvlc_media_tracks_get(p_md, tracks): '''Get media descriptor's elementary streams description Note, you need to call L{libvlc_media_parse}() or play the media at least once @@ -5604,10 +5792,9 @@ def libvlc_media_tracks_get(p_md, tracks): ''' f = _Cfunctions.get('libvlc_media_tracks_get', None) or \ _Cfunction('libvlc_media_tracks_get', ((1,), (1,),), None, - ctypes.c_uint, Media, ctypes.POINTER(ctypes.POINTER(MediaTrack))) + ctypes.c_uint, Media, ctypes.POINTER(ctypes.POINTER(MediaTrack))) return f(p_md, tracks) - def libvlc_media_get_codec_description(i_type, i_codec): '''Get codec description from media elementary stream. @param i_type: i_type from L{MediaTrack}. @@ -5617,10 +5804,9 @@ def libvlc_media_get_codec_description(i_type, i_codec): ''' f = _Cfunctions.get('libvlc_media_get_codec_description', None) or \ _Cfunction('libvlc_media_get_codec_description', ((1,), (1,),), None, - ctypes.c_char_p, TrackType, ctypes.c_uint32) + ctypes.c_char_p, TrackType, ctypes.c_uint32) return f(i_type, i_codec) - def libvlc_media_tracks_release(p_tracks, i_count): '''Release media descriptor's elementary streams description array. @param p_tracks: tracks info array to release. @@ -5629,10 +5815,9 @@ def libvlc_media_tracks_release(p_tracks, i_count): ''' f = _Cfunctions.get('libvlc_media_tracks_release', None) or \ _Cfunction('libvlc_media_tracks_release', ((1,), (1,),), None, - None, ctypes.POINTER(MediaTrack), ctypes.c_uint) + None, ctypes.POINTER(MediaTrack), ctypes.c_uint) return f(p_tracks, i_count) - def libvlc_media_get_type(p_md): '''Get the media type of the media descriptor object. @param p_md: media descriptor object. @@ -5641,10 +5826,9 @@ def libvlc_media_get_type(p_md): ''' f = _Cfunctions.get('libvlc_media_get_type', None) or \ _Cfunction('libvlc_media_get_type', ((1,),), None, - MediaType, Media) + MediaType, Media) return f(p_md) - def libvlc_media_slaves_add(p_md, i_type, i_priority, psz_uri): '''Add a slave to the current media. A slave is an external input source that may contains an additional subtitle @@ -5661,10 +5845,9 @@ def libvlc_media_slaves_add(p_md, i_type, i_priority, psz_uri): ''' f = _Cfunctions.get('libvlc_media_slaves_add', None) or \ _Cfunction('libvlc_media_slaves_add', ((1,), (1,), (1,), (1,),), None, - ctypes.c_int, Media, MediaSlaveType, ctypes.c_int, ctypes.c_char_p) + ctypes.c_int, Media, MediaSlaveType, ctypes.c_int, ctypes.c_char_p) return f(p_md, i_type, i_priority, psz_uri) - def libvlc_media_slaves_clear(p_md): '''Clear all slaves previously added by L{libvlc_media_slaves_add}() or internally. @@ -5673,10 +5856,9 @@ def libvlc_media_slaves_clear(p_md): ''' f = _Cfunctions.get('libvlc_media_slaves_clear', None) or \ _Cfunction('libvlc_media_slaves_clear', ((1,),), None, - None, Media) + None, Media) return f(p_md) - def libvlc_media_slaves_get(p_md, ppp_slaves): '''Get a media descriptor's slave list The list will contain slaves parsed by VLC or previously added by @@ -5689,10 +5871,9 @@ def libvlc_media_slaves_get(p_md, ppp_slaves): ''' f = _Cfunctions.get('libvlc_media_slaves_get', None) or \ _Cfunction('libvlc_media_slaves_get', ((1,), (1,),), None, - ctypes.c_int, Media, ctypes.POINTER(ctypes.POINTER(MediaSlave))) + ctypes.c_int, Media, ctypes.POINTER(ctypes.POINTER(MediaSlave))) return f(p_md, ppp_slaves) - def libvlc_media_slaves_release(pp_slaves, i_count): '''Release a media descriptor's slave list. @param pp_slaves: slave array to release. @@ -5701,10 +5882,9 @@ def libvlc_media_slaves_release(pp_slaves, i_count): ''' f = _Cfunctions.get('libvlc_media_slaves_release', None) or \ _Cfunction('libvlc_media_slaves_release', ((1,), (1,),), None, - None, ctypes.POINTER(MediaSlave), ctypes.c_int) + None, ctypes.POINTER(MediaSlave), ctypes.c_int) return f(pp_slaves, i_count) - def libvlc_renderer_item_hold(p_item): '''Hold a renderer item, i.e. creates a new reference This functions need to called from the libvlc_RendererDiscovererItemAdded @@ -5714,21 +5894,19 @@ def libvlc_renderer_item_hold(p_item): @version: LibVLC 3.0.0 or later. ''' f = _Cfunctions.get('libvlc_renderer_item_hold', None) or \ - _Cfunction('libvlc_renderer_item_hold', ((1,),), None, - ctypes.c_void_p, ctypes.c_void_p) + _Cfunction('libvlc_renderer_item_hold', ((1,),), class_result(Renderer), + ctypes.c_void_p, Renderer) return f(p_item) - def libvlc_renderer_item_release(p_item): '''Releases a renderer item, i.e. decrements its reference counter. @version: LibVLC 3.0.0 or later. ''' f = _Cfunctions.get('libvlc_renderer_item_release', None) or \ _Cfunction('libvlc_renderer_item_release', ((1,),), None, - None, ctypes.c_void_p) + None, Renderer) return f(p_item) - def libvlc_renderer_item_name(p_item): '''Get the human readable name of a renderer item. @return: the name of the item (can't be None, must *not* be freed). @@ -5736,10 +5914,9 @@ def libvlc_renderer_item_name(p_item): ''' f = _Cfunctions.get('libvlc_renderer_item_name', None) or \ _Cfunction('libvlc_renderer_item_name', ((1,),), None, - ctypes.c_char_p, ctypes.c_void_p) + ctypes.c_char_p, Renderer) return f(p_item) - def libvlc_renderer_item_type(p_item): '''Get the type (not translated) of a renderer item. For now, the type can only be "chromecast" ("upnp", "airplay" may come later). @@ -5748,10 +5925,9 @@ def libvlc_renderer_item_type(p_item): ''' f = _Cfunctions.get('libvlc_renderer_item_type', None) or \ _Cfunction('libvlc_renderer_item_type', ((1,),), None, - ctypes.c_char_p, ctypes.c_void_p) + ctypes.c_char_p, Renderer) return f(p_item) - def libvlc_renderer_item_icon_uri(p_item): '''Get the icon uri of a renderer item. @return: the uri of the item's icon (can be None, must *not* be freed). @@ -5759,10 +5935,9 @@ def libvlc_renderer_item_icon_uri(p_item): ''' f = _Cfunctions.get('libvlc_renderer_item_icon_uri', None) or \ _Cfunction('libvlc_renderer_item_icon_uri', ((1,),), None, - ctypes.c_char_p, ctypes.c_void_p) + ctypes.c_char_p, Renderer) return f(p_item) - def libvlc_renderer_item_flags(p_item): '''Get the flags of a renderer item See LIBVLC_RENDERER_CAN_AUDIO @@ -5772,10 +5947,9 @@ def libvlc_renderer_item_flags(p_item): ''' f = _Cfunctions.get('libvlc_renderer_item_flags', None) or \ _Cfunction('libvlc_renderer_item_flags', ((1,),), None, - ctypes.c_int, ctypes.c_void_p) + ctypes.c_int, Renderer) return f(p_item) - def libvlc_renderer_discoverer_new(p_inst, psz_name): '''Create a renderer discoverer object by name After this object is created, you should attach to events in order to be @@ -5790,11 +5964,10 @@ def libvlc_renderer_discoverer_new(p_inst, psz_name): @version: LibVLC 3.0.0 or later. ''' f = _Cfunctions.get('libvlc_renderer_discoverer_new', None) or \ - _Cfunction('libvlc_renderer_discoverer_new', ((1,), (1,),), None, - ctypes.c_void_p, Instance, ctypes.c_char_p) + _Cfunction('libvlc_renderer_discoverer_new', ((1,), (1,),), class_result(RendererDiscoverer), + ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_inst, psz_name) - def libvlc_renderer_discoverer_release(p_rd): '''Release a renderer discoverer object. @param p_rd: renderer discoverer object. @@ -5802,10 +5975,9 @@ def libvlc_renderer_discoverer_release(p_rd): ''' f = _Cfunctions.get('libvlc_renderer_discoverer_release', None) or \ _Cfunction('libvlc_renderer_discoverer_release', ((1,),), None, - None, ctypes.c_void_p) + None, RendererDiscoverer) return f(p_rd) - def libvlc_renderer_discoverer_start(p_rd): '''Start renderer discovery To stop it, call L{libvlc_renderer_discoverer_stop}() or @@ -5817,10 +5989,9 @@ def libvlc_renderer_discoverer_start(p_rd): ''' f = _Cfunctions.get('libvlc_renderer_discoverer_start', None) or \ _Cfunction('libvlc_renderer_discoverer_start', ((1,),), None, - ctypes.c_int, ctypes.c_void_p) + ctypes.c_int, RendererDiscoverer) return f(p_rd) - def libvlc_renderer_discoverer_stop(p_rd): '''Stop renderer discovery. See L{libvlc_renderer_discoverer_start}(). @@ -5829,15 +6000,14 @@ def libvlc_renderer_discoverer_stop(p_rd): ''' f = _Cfunctions.get('libvlc_renderer_discoverer_stop', None) or \ _Cfunction('libvlc_renderer_discoverer_stop', ((1,),), None, - None, ctypes.c_void_p) + None, RendererDiscoverer) return f(p_rd) - def libvlc_renderer_discoverer_event_manager(p_rd): '''Get the event manager of the renderer discoverer The possible events to attach are @ref libvlc_RendererDiscovererItemAdded and @ref libvlc_RendererDiscovererItemDeleted. - The @ref libvlc_renderer_item_t struct passed to event callbacks is owned by + The @ref L{Renderer} struct passed to event callbacks is owned by VLC, users should take care of holding/releasing this struct for their internal usage. See libvlc_event_t.u.renderer_discoverer_item_added.item @@ -5847,10 +6017,9 @@ def libvlc_renderer_discoverer_event_manager(p_rd): ''' f = _Cfunctions.get('libvlc_renderer_discoverer_event_manager', None) or \ _Cfunction('libvlc_renderer_discoverer_event_manager', ((1,),), class_result(EventManager), - ctypes.c_void_p, ctypes.c_void_p) + ctypes.c_void_p, RendererDiscoverer) return f(p_rd) - def libvlc_renderer_discoverer_list_get(p_inst, ppp_services): '''Get media discoverer services See libvlc_renderer_list_release(). @@ -5861,10 +6030,9 @@ def libvlc_renderer_discoverer_list_get(p_inst, ppp_services): ''' f = _Cfunctions.get('libvlc_renderer_discoverer_list_get', None) or \ _Cfunction('libvlc_renderer_discoverer_list_get', ((1,), (1,),), None, - ctypes.c_size_t, Instance, ctypes.POINTER(ctypes.POINTER(RDDescription))) + ctypes.c_size_t, Instance, ctypes.POINTER(ctypes.POINTER(RDDescription))) return f(p_inst, ppp_services) - def libvlc_renderer_discoverer_list_release(pp_services, i_count): '''Release an array of media discoverer services See L{libvlc_renderer_discoverer_list_get}(). @@ -5874,10 +6042,9 @@ def libvlc_renderer_discoverer_list_release(pp_services, i_count): ''' f = _Cfunctions.get('libvlc_renderer_discoverer_list_release', None) or \ _Cfunction('libvlc_renderer_discoverer_list_release', ((1,), (1,),), None, - None, ctypes.POINTER(RDDescription), ctypes.c_size_t) + None, ctypes.POINTER(RDDescription), ctypes.c_size_t) return f(pp_services, i_count) - def libvlc_media_list_new(p_instance): '''Create an empty media list. @param p_instance: libvlc instance. @@ -5885,30 +6052,27 @@ def libvlc_media_list_new(p_instance): ''' f = _Cfunctions.get('libvlc_media_list_new', None) or \ _Cfunction('libvlc_media_list_new', ((1,),), class_result(MediaList), - ctypes.c_void_p, Instance) + ctypes.c_void_p, Instance) return f(p_instance) - def libvlc_media_list_release(p_ml): '''Release media list created with L{libvlc_media_list_new}(). @param p_ml: a media list created with L{libvlc_media_list_new}(). ''' f = _Cfunctions.get('libvlc_media_list_release', None) or \ _Cfunction('libvlc_media_list_release', ((1,),), None, - None, MediaList) + None, MediaList) return f(p_ml) - def libvlc_media_list_retain(p_ml): '''Retain reference to a media list. @param p_ml: a media list created with L{libvlc_media_list_new}(). ''' f = _Cfunctions.get('libvlc_media_list_retain', None) or \ _Cfunction('libvlc_media_list_retain', ((1,),), None, - None, MediaList) + None, MediaList) return f(p_ml) - def libvlc_media_list_set_media(p_ml, p_md): '''Associate media instance with this media list instance. If another media instance was present it will be released. @@ -5918,10 +6082,9 @@ def libvlc_media_list_set_media(p_ml, p_md): ''' f = _Cfunctions.get('libvlc_media_list_set_media', None) or \ _Cfunction('libvlc_media_list_set_media', ((1,), (1,),), None, - None, MediaList, Media) + None, MediaList, Media) return f(p_ml, p_md) - def libvlc_media_list_media(p_ml): '''Get media instance from this media list instance. This action will increase the refcount on the media instance. @@ -5931,10 +6094,9 @@ def libvlc_media_list_media(p_ml): ''' f = _Cfunctions.get('libvlc_media_list_media', None) or \ _Cfunction('libvlc_media_list_media', ((1,),), class_result(Media), - ctypes.c_void_p, MediaList) + ctypes.c_void_p, MediaList) return f(p_ml) - def libvlc_media_list_add_media(p_ml, p_md): '''Add media instance to media list The L{libvlc_media_list_lock} should be held upon entering this function. @@ -5944,10 +6106,9 @@ def libvlc_media_list_add_media(p_ml, p_md): ''' f = _Cfunctions.get('libvlc_media_list_add_media', None) or \ _Cfunction('libvlc_media_list_add_media', ((1,), (1,),), None, - ctypes.c_int, MediaList, Media) + ctypes.c_int, MediaList, Media) return f(p_ml, p_md) - def libvlc_media_list_insert_media(p_ml, p_md, i_pos): '''Insert media instance in media list on a position The L{libvlc_media_list_lock} should be held upon entering this function. @@ -5958,10 +6119,9 @@ def libvlc_media_list_insert_media(p_ml, p_md, i_pos): ''' f = _Cfunctions.get('libvlc_media_list_insert_media', None) or \ _Cfunction('libvlc_media_list_insert_media', ((1,), (1,), (1,),), None, - ctypes.c_int, MediaList, Media, ctypes.c_int) + ctypes.c_int, MediaList, Media, ctypes.c_int) return f(p_ml, p_md, i_pos) - def libvlc_media_list_remove_index(p_ml, i_pos): '''Remove media instance from media list on a position The L{libvlc_media_list_lock} should be held upon entering this function. @@ -5971,10 +6131,9 @@ def libvlc_media_list_remove_index(p_ml, i_pos): ''' f = _Cfunctions.get('libvlc_media_list_remove_index', None) or \ _Cfunction('libvlc_media_list_remove_index', ((1,), (1,),), None, - ctypes.c_int, MediaList, ctypes.c_int) + ctypes.c_int, MediaList, ctypes.c_int) return f(p_ml, i_pos) - def libvlc_media_list_count(p_ml): '''Get count on media list items The L{libvlc_media_list_lock} should be held upon entering this function. @@ -5983,10 +6142,9 @@ def libvlc_media_list_count(p_ml): ''' f = _Cfunctions.get('libvlc_media_list_count', None) or \ _Cfunction('libvlc_media_list_count', ((1,),), None, - ctypes.c_int, MediaList) + ctypes.c_int, MediaList) return f(p_ml) - def libvlc_media_list_item_at_index(p_ml, i_pos): '''List media instance in media list at a position The L{libvlc_media_list_lock} should be held upon entering this function. @@ -5996,10 +6154,9 @@ def libvlc_media_list_item_at_index(p_ml, i_pos): ''' f = _Cfunctions.get('libvlc_media_list_item_at_index', None) or \ _Cfunction('libvlc_media_list_item_at_index', ((1,), (1,),), class_result(Media), - ctypes.c_void_p, MediaList, ctypes.c_int) + ctypes.c_void_p, MediaList, ctypes.c_int) return f(p_ml, i_pos) - def libvlc_media_list_index_of_item(p_ml, p_md): '''Find index position of List media instance in media list. Warning: the function will return the first matched position. @@ -6010,10 +6167,9 @@ def libvlc_media_list_index_of_item(p_ml, p_md): ''' f = _Cfunctions.get('libvlc_media_list_index_of_item', None) or \ _Cfunction('libvlc_media_list_index_of_item', ((1,), (1,),), None, - ctypes.c_int, MediaList, Media) + ctypes.c_int, MediaList, Media) return f(p_ml, p_md) - def libvlc_media_list_is_readonly(p_ml): '''This indicates if this media list is read-only from a user point of view. @param p_ml: media list instance. @@ -6021,20 +6177,18 @@ def libvlc_media_list_is_readonly(p_ml): ''' f = _Cfunctions.get('libvlc_media_list_is_readonly', None) or \ _Cfunction('libvlc_media_list_is_readonly', ((1,),), None, - ctypes.c_int, MediaList) + ctypes.c_int, MediaList) return f(p_ml) - def libvlc_media_list_lock(p_ml): '''Get lock on media list items. @param p_ml: a media list instance. ''' f = _Cfunctions.get('libvlc_media_list_lock', None) or \ _Cfunction('libvlc_media_list_lock', ((1,),), None, - None, MediaList) + None, MediaList) return f(p_ml) - def libvlc_media_list_unlock(p_ml): '''Release lock on media list items The L{libvlc_media_list_lock} should be held upon entering this function. @@ -6042,10 +6196,9 @@ def libvlc_media_list_unlock(p_ml): ''' f = _Cfunctions.get('libvlc_media_list_unlock', None) or \ _Cfunction('libvlc_media_list_unlock', ((1,),), None, - None, MediaList) + None, MediaList) return f(p_ml) - def libvlc_media_list_event_manager(p_ml): '''Get libvlc_event_manager from this media list instance. The p_event_manager is immutable, so you don't have to hold the lock. @@ -6054,10 +6207,9 @@ def libvlc_media_list_event_manager(p_ml): ''' f = _Cfunctions.get('libvlc_media_list_event_manager', None) or \ _Cfunction('libvlc_media_list_event_manager', ((1,),), class_result(EventManager), - ctypes.c_void_p, MediaList) + ctypes.c_void_p, MediaList) return f(p_ml) - def libvlc_media_player_get_fps(p_mi): '''Get movie fps rate This function is provided for backward compatibility. It cannot deal with @@ -6069,37 +6221,33 @@ def libvlc_media_player_get_fps(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_fps', None) or \ _Cfunction('libvlc_media_player_get_fps', ((1,),), None, - ctypes.c_float, MediaPlayer) + ctypes.c_float, MediaPlayer) return f(p_mi) - def libvlc_media_player_set_agl(p_mi, drawable): '''\deprecated Use L{libvlc_media_player_set_nsobject}() instead. ''' f = _Cfunctions.get('libvlc_media_player_set_agl', None) or \ _Cfunction('libvlc_media_player_set_agl', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_uint32) + None, MediaPlayer, ctypes.c_uint32) return f(p_mi, drawable) - def libvlc_media_player_get_agl(p_mi): '''\deprecated Use L{libvlc_media_player_get_nsobject}() instead. ''' f = _Cfunctions.get('libvlc_media_player_get_agl', None) or \ _Cfunction('libvlc_media_player_get_agl', ((1,),), None, - ctypes.c_uint32, MediaPlayer) + ctypes.c_uint32, MediaPlayer) return f(p_mi) - def libvlc_track_description_release(p_track_description): '''\deprecated Use L{libvlc_track_description_list_release}() instead. ''' f = _Cfunctions.get('libvlc_track_description_release', None) or \ _Cfunction('libvlc_track_description_release', ((1,),), None, - None, ctypes.POINTER(TrackDescription)) + None, ctypes.POINTER(TrackDescription)) return f(p_track_description) - def libvlc_video_get_height(p_mi): '''Get current video height. \deprecated Use L{libvlc_video_get_size}() instead. @@ -6108,10 +6256,9 @@ def libvlc_video_get_height(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_height', None) or \ _Cfunction('libvlc_video_get_height', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_video_get_width(p_mi): '''Get current video width. \deprecated Use L{libvlc_video_get_size}() instead. @@ -6120,10 +6267,9 @@ def libvlc_video_get_width(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_width', None) or \ _Cfunction('libvlc_video_get_width', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_video_get_title_description(p_mi): '''Get the description of available titles. @param p_mi: the media player. @@ -6131,10 +6277,9 @@ def libvlc_video_get_title_description(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_title_description', None) or \ _Cfunction('libvlc_video_get_title_description', ((1,),), None, - ctypes.POINTER(TrackDescription), MediaPlayer) + ctypes.POINTER(TrackDescription), MediaPlayer) return f(p_mi) - def libvlc_video_get_chapter_description(p_mi, i_title): '''Get the description of available chapters for specific title. @param p_mi: the media player. @@ -6143,10 +6288,9 @@ def libvlc_video_get_chapter_description(p_mi, i_title): ''' f = _Cfunctions.get('libvlc_video_get_chapter_description', None) or \ _Cfunction('libvlc_video_get_chapter_description', ((1,), (1,),), None, - ctypes.POINTER(TrackDescription), MediaPlayer, ctypes.c_int) + ctypes.POINTER(TrackDescription), MediaPlayer, ctypes.c_int) return f(p_mi, i_title) - def libvlc_video_set_subtitle_file(p_mi, psz_subtitle): '''Set new video subtitle file. \deprecated Use L{libvlc_media_player_add_slave}() instead. @@ -6156,10 +6300,9 @@ def libvlc_video_set_subtitle_file(p_mi, psz_subtitle): ''' f = _Cfunctions.get('libvlc_video_set_subtitle_file', None) or \ _Cfunction('libvlc_video_set_subtitle_file', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_char_p) + ctypes.c_int, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_subtitle) - def libvlc_toggle_teletext(p_mi): '''Toggle teletext transparent status on video output. \deprecated use L{libvlc_video_set_teletext}() instead. @@ -6167,10 +6310,9 @@ def libvlc_toggle_teletext(p_mi): ''' f = _Cfunctions.get('libvlc_toggle_teletext', None) or \ _Cfunction('libvlc_toggle_teletext', ((1,),), None, - None, MediaPlayer) + None, MediaPlayer) return f(p_mi) - def libvlc_audio_output_device_count(p_instance, psz_audio_output): '''Backward compatibility stub. Do not use in new code. \deprecated Use L{libvlc_audio_output_device_list_get}() instead. @@ -6178,10 +6320,9 @@ def libvlc_audio_output_device_count(p_instance, psz_audio_output): ''' f = _Cfunctions.get('libvlc_audio_output_device_count', None) or \ _Cfunction('libvlc_audio_output_device_count', ((1,), (1,),), None, - ctypes.c_int, Instance, ctypes.c_char_p) + ctypes.c_int, Instance, ctypes.c_char_p) return f(p_instance, psz_audio_output) - def libvlc_audio_output_device_longname(p_instance, psz_output, i_device): '''Backward compatibility stub. Do not use in new code. \deprecated Use L{libvlc_audio_output_device_list_get}() instead. @@ -6189,10 +6330,9 @@ def libvlc_audio_output_device_longname(p_instance, psz_output, i_device): ''' f = _Cfunctions.get('libvlc_audio_output_device_longname', None) or \ _Cfunction('libvlc_audio_output_device_longname', ((1,), (1,), (1,),), string_result, - ctypes.c_void_p, Instance, ctypes.c_char_p, ctypes.c_int) + ctypes.c_void_p, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_output, i_device) - def libvlc_audio_output_device_id(p_instance, psz_audio_output, i_device): '''Backward compatibility stub. Do not use in new code. \deprecated Use L{libvlc_audio_output_device_list_get}() instead. @@ -6200,10 +6340,9 @@ def libvlc_audio_output_device_id(p_instance, psz_audio_output, i_device): ''' f = _Cfunctions.get('libvlc_audio_output_device_id', None) or \ _Cfunction('libvlc_audio_output_device_id', ((1,), (1,), (1,),), string_result, - ctypes.c_void_p, Instance, ctypes.c_char_p, ctypes.c_int) + ctypes.c_void_p, Instance, ctypes.c_char_p, ctypes.c_int) return f(p_instance, psz_audio_output, i_device) - def libvlc_media_parse(p_md): '''Parse a media. This fetches (local) art, meta data and tracks information. @@ -6217,10 +6356,9 @@ def libvlc_media_parse(p_md): ''' f = _Cfunctions.get('libvlc_media_parse', None) or \ _Cfunction('libvlc_media_parse', ((1,),), None, - None, Media) + None, Media) return f(p_md) - def libvlc_media_parse_async(p_md): '''Parse a media. This fetches (local) art, meta data and tracks information. @@ -6239,10 +6377,9 @@ def libvlc_media_parse_async(p_md): ''' f = _Cfunctions.get('libvlc_media_parse_async', None) or \ _Cfunction('libvlc_media_parse_async', ((1,),), None, - None, Media) + None, Media) return f(p_md) - def libvlc_media_is_parsed(p_md): '''Return true is the media descriptor object is parsed \deprecated This can return true in case of failure. @@ -6253,10 +6390,9 @@ def libvlc_media_is_parsed(p_md): ''' f = _Cfunctions.get('libvlc_media_is_parsed', None) or \ _Cfunction('libvlc_media_is_parsed', ((1,),), None, - ctypes.c_int, Media) + ctypes.c_int, Media) return f(p_md) - def libvlc_media_get_tracks_info(p_md): '''Get media descriptor's elementary streams description Note, you need to call L{libvlc_media_parse}() or play the media at least once @@ -6269,19 +6405,17 @@ def libvlc_media_get_tracks_info(p_md): ''' f = _Cfunctions.get('libvlc_media_get_tracks_info', None) or \ _Cfunction('libvlc_media_get_tracks_info', ((1,), (2,),), None, - ctypes.c_int, Media, ctypes.POINTER(ctypes.c_void_p)) + ctypes.c_int, Media, ctypes.POINTER(ctypes.c_void_p)) return f(p_md) - def libvlc_media_discoverer_new_from_name(p_inst, psz_name): '''\deprecated Use L{libvlc_media_discoverer_new}() and L{libvlc_media_discoverer_start}(). ''' f = _Cfunctions.get('libvlc_media_discoverer_new_from_name', None) or \ _Cfunction('libvlc_media_discoverer_new_from_name', ((1,), (1,),), class_result(MediaDiscoverer), - ctypes.c_void_p, Instance, ctypes.c_char_p) + ctypes.c_void_p, Instance, ctypes.c_char_p) return f(p_inst, psz_name) - def libvlc_media_discoverer_localized_name(p_mdis): '''Get media service discover object its localized name. \deprecated Useless, use L{libvlc_media_discoverer_list_get}() to get the @@ -6291,10 +6425,9 @@ def libvlc_media_discoverer_localized_name(p_mdis): ''' f = _Cfunctions.get('libvlc_media_discoverer_localized_name', None) or \ _Cfunction('libvlc_media_discoverer_localized_name', ((1,),), string_result, - ctypes.c_void_p, MediaDiscoverer) + ctypes.c_void_p, MediaDiscoverer) return f(p_mdis) - def libvlc_media_discoverer_event_manager(p_mdis): '''Get event manager from media service discover object. \deprecated Useless, media_discoverer events are only triggered when calling @@ -6304,10 +6437,9 @@ def libvlc_media_discoverer_event_manager(p_mdis): ''' f = _Cfunctions.get('libvlc_media_discoverer_event_manager', None) or \ _Cfunction('libvlc_media_discoverer_event_manager', ((1,),), class_result(EventManager), - ctypes.c_void_p, MediaDiscoverer) + ctypes.c_void_p, MediaDiscoverer) return f(p_mdis) - def libvlc_wait(p_instance): '''Waits until an interface causes the instance to exit. You should start at least one interface first, using L{libvlc_add_intf}(). @@ -6315,10 +6447,9 @@ def libvlc_wait(p_instance): ''' f = _Cfunctions.get('libvlc_wait', None) or \ _Cfunction('libvlc_wait', ((1,),), None, - None, Instance) + None, Instance) return f(p_instance) - def libvlc_get_log_verbosity(p_instance): '''Always returns minus one. This function is only provided for backward compatibility. @@ -6327,10 +6458,9 @@ def libvlc_get_log_verbosity(p_instance): ''' f = _Cfunctions.get('libvlc_get_log_verbosity', None) or \ _Cfunction('libvlc_get_log_verbosity', ((1,),), None, - ctypes.c_uint, Instance) + ctypes.c_uint, Instance) return f(p_instance) - def libvlc_set_log_verbosity(p_instance, level): '''This function does nothing. It is only provided for backward compatibility. @@ -6339,10 +6469,9 @@ def libvlc_set_log_verbosity(p_instance, level): ''' f = _Cfunctions.get('libvlc_set_log_verbosity', None) or \ _Cfunction('libvlc_set_log_verbosity', ((1,), (1,),), None, - None, Instance, ctypes.c_uint) + None, Instance, ctypes.c_uint) return f(p_instance, level) - def libvlc_log_open(p_instance): '''This function does nothing useful. It is only provided for backward compatibility. @@ -6351,20 +6480,18 @@ def libvlc_log_open(p_instance): ''' f = _Cfunctions.get('libvlc_log_open', None) or \ _Cfunction('libvlc_log_open', ((1,),), None, - Log_ptr, Instance) + Log_ptr, Instance) return f(p_instance) - def libvlc_log_close(p_log): '''Frees memory allocated by L{libvlc_log_open}(). @param p_log: libvlc log instance or None. ''' f = _Cfunctions.get('libvlc_log_close', None) or \ _Cfunction('libvlc_log_close', ((1,),), None, - None, Log_ptr) + None, Log_ptr) return f(p_log) - def libvlc_log_count(p_log): '''Always returns zero. This function is only provided for backward compatibility. @@ -6373,10 +6500,9 @@ def libvlc_log_count(p_log): ''' f = _Cfunctions.get('libvlc_log_count', None) or \ _Cfunction('libvlc_log_count', ((1,),), None, - ctypes.c_uint, Log_ptr) + ctypes.c_uint, Log_ptr) return f(p_log) - def libvlc_log_clear(p_log): '''This function does nothing. It is only provided for backward compatibility. @@ -6384,10 +6510,9 @@ def libvlc_log_clear(p_log): ''' f = _Cfunctions.get('libvlc_log_clear', None) or \ _Cfunction('libvlc_log_clear', ((1,),), None, - None, Log_ptr) + None, Log_ptr) return f(p_log) - def libvlc_log_get_iterator(p_log): '''This function does nothing useful. It is only provided for backward compatibility. @@ -6396,20 +6521,18 @@ def libvlc_log_get_iterator(p_log): ''' f = _Cfunctions.get('libvlc_log_get_iterator', None) or \ _Cfunction('libvlc_log_get_iterator', ((1,),), class_result(LogIterator), - ctypes.c_void_p, Log_ptr) + ctypes.c_void_p, Log_ptr) return f(p_log) - def libvlc_log_iterator_free(p_iter): '''Frees memory allocated by L{libvlc_log_get_iterator}(). @param p_iter: libvlc log iterator or None. ''' f = _Cfunctions.get('libvlc_log_iterator_free', None) or \ _Cfunction('libvlc_log_iterator_free', ((1,),), None, - None, LogIterator) + None, LogIterator) return f(p_iter) - def libvlc_log_iterator_has_next(p_iter): '''Always returns zero. This function is only provided for backward compatibility. @@ -6418,10 +6541,9 @@ def libvlc_log_iterator_has_next(p_iter): ''' f = _Cfunctions.get('libvlc_log_iterator_has_next', None) or \ _Cfunction('libvlc_log_iterator_has_next', ((1,),), None, - ctypes.c_int, LogIterator) + ctypes.c_int, LogIterator) return f(p_iter) - def libvlc_log_iterator_next(p_iter, p_buf): '''Always returns None. This function is only provided for backward compatibility. @@ -6431,10 +6553,9 @@ def libvlc_log_iterator_next(p_iter, p_buf): ''' f = _Cfunctions.get('libvlc_log_iterator_next', None) or \ _Cfunction('libvlc_log_iterator_next', ((1,), (1,),), None, - ctypes.POINTER(LogMessage), LogIterator, ctypes.POINTER(LogMessage)) + ctypes.POINTER(LogMessage), LogIterator, ctypes.POINTER(LogMessage)) return f(p_iter, p_buf) - def libvlc_playlist_play(p_instance, i_id, i_options, ppsz_options): '''Start playing (if there is any item in the playlist). Additionnal playlist item options can be specified for addition to the @@ -6446,10 +6567,9 @@ def libvlc_playlist_play(p_instance, i_id, i_options, ppsz_options): ''' f = _Cfunctions.get('libvlc_playlist_play', None) or \ _Cfunction('libvlc_playlist_play', ((1,), (1,), (1,), (1,),), None, - None, Instance, ctypes.c_int, ctypes.c_int, ListPOINTER(ctypes.c_char_p)) + None, Instance, ctypes.c_int, ctypes.c_int, ListPOINTER(ctypes.c_char_p)) return f(p_instance, i_id, i_options, ppsz_options) - def libvlc_media_player_new(p_libvlc_instance): '''Create an empty Media Player object. @param p_libvlc_instance: the libvlc instance in which the Media Player should be created. @@ -6457,10 +6577,9 @@ def libvlc_media_player_new(p_libvlc_instance): ''' f = _Cfunctions.get('libvlc_media_player_new', None) or \ _Cfunction('libvlc_media_player_new', ((1,),), class_result(MediaPlayer), - ctypes.c_void_p, Instance) + ctypes.c_void_p, Instance) return f(p_libvlc_instance) - def libvlc_media_player_new_from_media(p_md): '''Create a Media Player object from a Media. @param p_md: the media. Afterwards the p_md can be safely destroyed. @@ -6468,10 +6587,9 @@ def libvlc_media_player_new_from_media(p_md): ''' f = _Cfunctions.get('libvlc_media_player_new_from_media', None) or \ _Cfunction('libvlc_media_player_new_from_media', ((1,),), class_result(MediaPlayer), - ctypes.c_void_p, Media) + ctypes.c_void_p, Media) return f(p_md) - def libvlc_media_player_release(p_mi): '''Release a media_player after use Decrement the reference count of a media player object. If the @@ -6482,10 +6600,9 @@ def libvlc_media_player_release(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_release', None) or \ _Cfunction('libvlc_media_player_release', ((1,),), None, - None, MediaPlayer) + None, MediaPlayer) return f(p_mi) - def libvlc_media_player_retain(p_mi): '''Retain a reference to a media player object. Use L{libvlc_media_player_release}() to decrement reference count. @@ -6493,10 +6610,9 @@ def libvlc_media_player_retain(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_retain', None) or \ _Cfunction('libvlc_media_player_retain', ((1,),), None, - None, MediaPlayer) + None, MediaPlayer) return f(p_mi) - def libvlc_media_player_set_media(p_mi, p_md): '''Set the media that will be used by the media_player. If any, previous md will be released. @@ -6505,10 +6621,9 @@ def libvlc_media_player_set_media(p_mi, p_md): ''' f = _Cfunctions.get('libvlc_media_player_set_media', None) or \ _Cfunction('libvlc_media_player_set_media', ((1,), (1,),), None, - None, MediaPlayer, Media) + None, MediaPlayer, Media) return f(p_mi, p_md) - def libvlc_media_player_get_media(p_mi): '''Get the media used by the media_player. @param p_mi: the Media Player. @@ -6516,10 +6631,9 @@ def libvlc_media_player_get_media(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_media', None) or \ _Cfunction('libvlc_media_player_get_media', ((1,),), class_result(Media), - ctypes.c_void_p, MediaPlayer) + ctypes.c_void_p, MediaPlayer) return f(p_mi) - def libvlc_media_player_event_manager(p_mi): '''Get the Event Manager from which the media player send event. @param p_mi: the Media Player. @@ -6527,10 +6641,9 @@ def libvlc_media_player_event_manager(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_event_manager', None) or \ _Cfunction('libvlc_media_player_event_manager', ((1,),), class_result(EventManager), - ctypes.c_void_p, MediaPlayer) + ctypes.c_void_p, MediaPlayer) return f(p_mi) - def libvlc_media_player_is_playing(p_mi): '''is_playing. @param p_mi: the Media Player. @@ -6538,10 +6651,9 @@ def libvlc_media_player_is_playing(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_is_playing', None) or \ _Cfunction('libvlc_media_player_is_playing', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_media_player_play(p_mi): '''Play. @param p_mi: the Media Player. @@ -6549,10 +6661,9 @@ def libvlc_media_player_play(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_play', None) or \ _Cfunction('libvlc_media_player_play', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_media_player_set_pause(mp, do_pause): '''Pause or resume (no effect if there is no media). @param mp: the Media Player. @@ -6561,30 +6672,27 @@ def libvlc_media_player_set_pause(mp, do_pause): ''' f = _Cfunctions.get('libvlc_media_player_set_pause', None) or \ _Cfunction('libvlc_media_player_set_pause', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_int) + None, MediaPlayer, ctypes.c_int) return f(mp, do_pause) - def libvlc_media_player_pause(p_mi): '''Toggle pause (no effect if there is no media). @param p_mi: the Media Player. ''' f = _Cfunctions.get('libvlc_media_player_pause', None) or \ _Cfunction('libvlc_media_player_pause', ((1,),), None, - None, MediaPlayer) + None, MediaPlayer) return f(p_mi) - def libvlc_media_player_stop(p_mi): '''Stop (no effect if there is no media). @param p_mi: the Media Player. ''' f = _Cfunctions.get('libvlc_media_player_stop', None) or \ _Cfunction('libvlc_media_player_stop', ((1,),), None, - None, MediaPlayer) + None, MediaPlayer) return f(p_mi) - def libvlc_media_player_set_renderer(p_mi, p_item): '''Set a renderer to the media player @note: must be called before the first call of L{libvlc_media_player_play}() to @@ -6597,10 +6705,9 @@ def libvlc_media_player_set_renderer(p_mi, p_item): ''' f = _Cfunctions.get('libvlc_media_player_set_renderer', None) or \ _Cfunction('libvlc_media_player_set_renderer', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_void_p) + ctypes.c_int, MediaPlayer, Renderer) return f(p_mi, p_item) - def libvlc_video_set_callbacks(mp, lock, unlock, display, opaque): '''Set callbacks and private data to render decoded video to a custom area in memory. @@ -6635,10 +6742,9 @@ def libvlc_video_set_callbacks(mp, lock, unlock, display, opaque): ''' f = _Cfunctions.get('libvlc_video_set_callbacks', None) or \ _Cfunction('libvlc_video_set_callbacks', ((1,), (1,), (1,), (1,), (1,),), None, - None, MediaPlayer, VideoLockCb, VideoUnlockCb, VideoDisplayCb, ctypes.c_void_p) + None, MediaPlayer, VideoLockCb, VideoUnlockCb, VideoDisplayCb, ctypes.c_void_p) return f(mp, lock, unlock, display, opaque) - def libvlc_video_set_format(mp, chroma, width, height, pitch): '''Set decoded video chroma and dimensions. This only works in combination with L{libvlc_video_set_callbacks}(), @@ -6653,10 +6759,9 @@ def libvlc_video_set_format(mp, chroma, width, height, pitch): ''' f = _Cfunctions.get('libvlc_video_set_format', None) or \ _Cfunction('libvlc_video_set_format', ((1,), (1,), (1,), (1,), (1,),), None, - None, MediaPlayer, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint) + None, MediaPlayer, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint, ctypes.c_uint) return f(mp, chroma, width, height, pitch) - def libvlc_video_set_format_callbacks(mp, setup, cleanup): '''Set decoded video chroma and dimensions. This only works in combination with L{libvlc_video_set_callbacks}(). @@ -6667,10 +6772,9 @@ def libvlc_video_set_format_callbacks(mp, setup, cleanup): ''' f = _Cfunctions.get('libvlc_video_set_format_callbacks', None) or \ _Cfunction('libvlc_video_set_format_callbacks', ((1,), (1,), (1,),), None, - None, MediaPlayer, VideoFormatCb, VideoCleanupCb) + None, MediaPlayer, VideoFormatCb, VideoCleanupCb) return f(mp, setup, cleanup) - def libvlc_media_player_set_nsobject(p_mi, drawable): '''Set the NSView handler where the media player should render its video output. Use the vout called "macosx". @@ -6699,10 +6803,9 @@ def libvlc_media_player_set_nsobject(p_mi, drawable): ''' f = _Cfunctions.get('libvlc_media_player_set_nsobject', None) or \ _Cfunction('libvlc_media_player_set_nsobject', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_void_p) + None, MediaPlayer, ctypes.c_void_p) return f(p_mi, drawable) - def libvlc_media_player_get_nsobject(p_mi): '''Get the NSView handler previously set with L{libvlc_media_player_set_nsobject}(). @param p_mi: the Media Player. @@ -6710,10 +6813,9 @@ def libvlc_media_player_get_nsobject(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_nsobject', None) or \ _Cfunction('libvlc_media_player_get_nsobject', ((1,),), None, - ctypes.c_void_p, MediaPlayer) + ctypes.c_void_p, MediaPlayer) return f(p_mi) - def libvlc_media_player_set_xwindow(p_mi, drawable): '''Set an X Window System drawable where the media player should render its video output. The call takes effect when the playback starts. If it is @@ -6737,10 +6839,9 @@ def libvlc_media_player_set_xwindow(p_mi, drawable): ''' f = _Cfunctions.get('libvlc_media_player_set_xwindow', None) or \ _Cfunction('libvlc_media_player_set_xwindow', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_uint32) + None, MediaPlayer, ctypes.c_uint32) return f(p_mi, drawable) - def libvlc_media_player_get_xwindow(p_mi): '''Get the X Window System window identifier previously set with L{libvlc_media_player_set_xwindow}(). Note that this will return the identifier @@ -6751,10 +6852,9 @@ def libvlc_media_player_get_xwindow(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_xwindow', None) or \ _Cfunction('libvlc_media_player_get_xwindow', ((1,),), None, - ctypes.c_uint32, MediaPlayer) + ctypes.c_uint32, MediaPlayer) return f(p_mi) - def libvlc_media_player_set_hwnd(p_mi, drawable): '''Set a Win32/Win64 API window handle (HWND) where the media player should render its video output. If LibVLC was built without Win32/Win64 API output @@ -6764,10 +6864,9 @@ def libvlc_media_player_set_hwnd(p_mi, drawable): ''' f = _Cfunctions.get('libvlc_media_player_set_hwnd', None) or \ _Cfunction('libvlc_media_player_set_hwnd', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_void_p) + None, MediaPlayer, ctypes.c_void_p) return f(p_mi, drawable) - def libvlc_media_player_get_hwnd(p_mi): '''Get the Windows API window handle (HWND) previously set with L{libvlc_media_player_set_hwnd}(). The handle will be returned even if LibVLC @@ -6777,10 +6876,9 @@ def libvlc_media_player_get_hwnd(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_hwnd', None) or \ _Cfunction('libvlc_media_player_get_hwnd', ((1,),), None, - ctypes.c_void_p, MediaPlayer) + ctypes.c_void_p, MediaPlayer) return f(p_mi) - def libvlc_media_player_set_android_context(p_mi, p_awindow_handler): '''Set the android context. @param p_mi: the media player. @@ -6789,10 +6887,9 @@ def libvlc_media_player_set_android_context(p_mi, p_awindow_handler): ''' f = _Cfunctions.get('libvlc_media_player_set_android_context', None) or \ _Cfunction('libvlc_media_player_set_android_context', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_void_p) + None, MediaPlayer, ctypes.c_void_p) return f(p_mi, p_awindow_handler) - def libvlc_media_player_set_evas_object(p_mi, p_evas_object): '''Set the EFL Evas Object. @param p_mi: the media player. @@ -6802,10 +6899,9 @@ def libvlc_media_player_set_evas_object(p_mi, p_evas_object): ''' f = _Cfunctions.get('libvlc_media_player_set_evas_object', None) or \ _Cfunction('libvlc_media_player_set_evas_object', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_void_p) + ctypes.c_int, MediaPlayer, ctypes.c_void_p) return f(p_mi, p_evas_object) - def libvlc_audio_set_callbacks(mp, play, pause, resume, flush, drain, opaque): '''Sets callbacks and private data for decoded audio. Use L{libvlc_audio_set_format}() or L{libvlc_audio_set_format_callbacks}() @@ -6823,11 +6919,9 @@ def libvlc_audio_set_callbacks(mp, play, pause, resume, flush, drain, opaque): ''' f = _Cfunctions.get('libvlc_audio_set_callbacks', None) or \ _Cfunction('libvlc_audio_set_callbacks', ((1,), (1,), (1,), (1,), (1,), (1,), (1,),), None, - None, MediaPlayer, AudioPlayCb, AudioPauseCb, AudioResumeCb, AudioFlushCb, AudioDrainCb, - ctypes.c_void_p) + None, MediaPlayer, AudioPlayCb, AudioPauseCb, AudioResumeCb, AudioFlushCb, AudioDrainCb, ctypes.c_void_p) return f(mp, play, pause, resume, flush, drain, opaque) - def libvlc_audio_set_volume_callback(mp, set_volume): '''Set callbacks and private data for decoded audio. This only works in combination with L{libvlc_audio_set_callbacks}(). @@ -6839,10 +6933,9 @@ def libvlc_audio_set_volume_callback(mp, set_volume): ''' f = _Cfunctions.get('libvlc_audio_set_volume_callback', None) or \ _Cfunction('libvlc_audio_set_volume_callback', ((1,), (1,),), None, - None, MediaPlayer, AudioSetVolumeCb) + None, MediaPlayer, AudioSetVolumeCb) return f(mp, set_volume) - def libvlc_audio_set_format_callbacks(mp, setup, cleanup): '''Sets decoded audio format via callbacks. This only works in combination with L{libvlc_audio_set_callbacks}(). @@ -6853,26 +6946,24 @@ def libvlc_audio_set_format_callbacks(mp, setup, cleanup): ''' f = _Cfunctions.get('libvlc_audio_set_format_callbacks', None) or \ _Cfunction('libvlc_audio_set_format_callbacks', ((1,), (1,), (1,),), None, - None, MediaPlayer, AudioSetupCb, AudioCleanupCb) + None, MediaPlayer, AudioSetupCb, AudioCleanupCb) return f(mp, setup, cleanup) - def libvlc_audio_set_format(mp, format, rate, channels): '''Sets a fixed decoded audio format. This only works in combination with L{libvlc_audio_set_callbacks}(), and is mutually exclusive with L{libvlc_audio_set_format_callbacks}(). @param mp: the media player. - @param format: a four-characters string identifying the sample format (e.g. "S16N" or "FL32"). + @param format: a four-characters string identifying the sample format (e.g. "S16N" or "f32l"). @param rate: sample rate (expressed in Hz). @param channels: channels count. @version: LibVLC 2.0.0 or later. ''' f = _Cfunctions.get('libvlc_audio_set_format', None) or \ _Cfunction('libvlc_audio_set_format', ((1,), (1,), (1,), (1,),), None, - None, MediaPlayer, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint) + None, MediaPlayer, ctypes.c_char_p, ctypes.c_uint, ctypes.c_uint) return f(mp, format, rate, channels) - def libvlc_media_player_get_length(p_mi): '''Get the current movie length (in ms). @param p_mi: the Media Player. @@ -6880,10 +6971,9 @@ def libvlc_media_player_get_length(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_length', None) or \ _Cfunction('libvlc_media_player_get_length', ((1,),), None, - ctypes.c_longlong, MediaPlayer) + ctypes.c_longlong, MediaPlayer) return f(p_mi) - def libvlc_media_player_get_time(p_mi): '''Get the current movie time (in ms). @param p_mi: the Media Player. @@ -6891,10 +6981,9 @@ def libvlc_media_player_get_time(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_time', None) or \ _Cfunction('libvlc_media_player_get_time', ((1,),), None, - ctypes.c_longlong, MediaPlayer) + ctypes.c_longlong, MediaPlayer) return f(p_mi) - def libvlc_media_player_set_time(p_mi, i_time): '''Set the movie time (in ms). This has no effect if no media is being played. Not all formats and protocols support this. @@ -6903,10 +6992,9 @@ def libvlc_media_player_set_time(p_mi, i_time): ''' f = _Cfunctions.get('libvlc_media_player_set_time', None) or \ _Cfunction('libvlc_media_player_set_time', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_longlong) + None, MediaPlayer, ctypes.c_longlong) return f(p_mi, i_time) - def libvlc_media_player_get_position(p_mi): '''Get movie position as percentage between 0.0 and 1.0. @param p_mi: the Media Player. @@ -6914,10 +7002,9 @@ def libvlc_media_player_get_position(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_position', None) or \ _Cfunction('libvlc_media_player_get_position', ((1,),), None, - ctypes.c_float, MediaPlayer) + ctypes.c_float, MediaPlayer) return f(p_mi) - def libvlc_media_player_set_position(p_mi, f_pos): '''Set movie position as percentage between 0.0 and 1.0. This has no effect if playback is not enabled. @@ -6927,10 +7014,9 @@ def libvlc_media_player_set_position(p_mi, f_pos): ''' f = _Cfunctions.get('libvlc_media_player_set_position', None) or \ _Cfunction('libvlc_media_player_set_position', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_float) + None, MediaPlayer, ctypes.c_float) return f(p_mi, f_pos) - def libvlc_media_player_set_chapter(p_mi, i_chapter): '''Set movie chapter (if applicable). @param p_mi: the Media Player. @@ -6938,10 +7024,9 @@ def libvlc_media_player_set_chapter(p_mi, i_chapter): ''' f = _Cfunctions.get('libvlc_media_player_set_chapter', None) or \ _Cfunction('libvlc_media_player_set_chapter', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_int) + None, MediaPlayer, ctypes.c_int) return f(p_mi, i_chapter) - def libvlc_media_player_get_chapter(p_mi): '''Get movie chapter. @param p_mi: the Media Player. @@ -6949,10 +7034,9 @@ def libvlc_media_player_get_chapter(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_chapter', None) or \ _Cfunction('libvlc_media_player_get_chapter', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_media_player_get_chapter_count(p_mi): '''Get movie chapter count. @param p_mi: the Media Player. @@ -6960,10 +7044,9 @@ def libvlc_media_player_get_chapter_count(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_chapter_count', None) or \ _Cfunction('libvlc_media_player_get_chapter_count', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_media_player_will_play(p_mi): '''Is the player able to play. @param p_mi: the Media Player. @@ -6971,10 +7054,9 @@ def libvlc_media_player_will_play(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_will_play', None) or \ _Cfunction('libvlc_media_player_will_play', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_media_player_get_chapter_count_for_title(p_mi, i_title): '''Get title chapter count. @param p_mi: the Media Player. @@ -6983,10 +7065,9 @@ def libvlc_media_player_get_chapter_count_for_title(p_mi, i_title): ''' f = _Cfunctions.get('libvlc_media_player_get_chapter_count_for_title', None) or \ _Cfunction('libvlc_media_player_get_chapter_count_for_title', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_int) + ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, i_title) - def libvlc_media_player_set_title(p_mi, i_title): '''Set movie title. @param p_mi: the Media Player. @@ -6994,10 +7075,9 @@ def libvlc_media_player_set_title(p_mi, i_title): ''' f = _Cfunctions.get('libvlc_media_player_set_title', None) or \ _Cfunction('libvlc_media_player_set_title', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_int) + None, MediaPlayer, ctypes.c_int) return f(p_mi, i_title) - def libvlc_media_player_get_title(p_mi): '''Get movie title. @param p_mi: the Media Player. @@ -7005,10 +7085,9 @@ def libvlc_media_player_get_title(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_title', None) or \ _Cfunction('libvlc_media_player_get_title', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_media_player_get_title_count(p_mi): '''Get movie title count. @param p_mi: the Media Player. @@ -7016,30 +7095,27 @@ def libvlc_media_player_get_title_count(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_title_count', None) or \ _Cfunction('libvlc_media_player_get_title_count', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_media_player_previous_chapter(p_mi): '''Set previous chapter (if applicable). @param p_mi: the Media Player. ''' f = _Cfunctions.get('libvlc_media_player_previous_chapter', None) or \ _Cfunction('libvlc_media_player_previous_chapter', ((1,),), None, - None, MediaPlayer) + None, MediaPlayer) return f(p_mi) - def libvlc_media_player_next_chapter(p_mi): '''Set next chapter (if applicable). @param p_mi: the Media Player. ''' f = _Cfunctions.get('libvlc_media_player_next_chapter', None) or \ _Cfunction('libvlc_media_player_next_chapter', ((1,),), None, - None, MediaPlayer) + None, MediaPlayer) return f(p_mi) - def libvlc_media_player_get_rate(p_mi): '''Get the requested movie play rate. @warning: Depending on the underlying media, the requested rate may be @@ -7049,10 +7125,9 @@ def libvlc_media_player_get_rate(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_rate', None) or \ _Cfunction('libvlc_media_player_get_rate', ((1,),), None, - ctypes.c_float, MediaPlayer) + ctypes.c_float, MediaPlayer) return f(p_mi) - def libvlc_media_player_set_rate(p_mi, rate): '''Set movie play rate. @param p_mi: the Media Player. @@ -7061,10 +7136,9 @@ def libvlc_media_player_set_rate(p_mi, rate): ''' f = _Cfunctions.get('libvlc_media_player_set_rate', None) or \ _Cfunction('libvlc_media_player_set_rate', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_float) + ctypes.c_int, MediaPlayer, ctypes.c_float) return f(p_mi, rate) - def libvlc_media_player_get_state(p_mi): '''Get current movie state. @param p_mi: the Media Player. @@ -7072,10 +7146,9 @@ def libvlc_media_player_get_state(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_state', None) or \ _Cfunction('libvlc_media_player_get_state', ((1,),), None, - State, MediaPlayer) + State, MediaPlayer) return f(p_mi) - def libvlc_media_player_has_vout(p_mi): '''How many video outputs does this media player have? @param p_mi: the media player. @@ -7083,10 +7156,9 @@ def libvlc_media_player_has_vout(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_has_vout', None) or \ _Cfunction('libvlc_media_player_has_vout', ((1,),), None, - ctypes.c_uint, MediaPlayer) + ctypes.c_uint, MediaPlayer) return f(p_mi) - def libvlc_media_player_is_seekable(p_mi): '''Is this media player seekable? @param p_mi: the media player. @@ -7094,10 +7166,9 @@ def libvlc_media_player_is_seekable(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_is_seekable', None) or \ _Cfunction('libvlc_media_player_is_seekable', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_media_player_can_pause(p_mi): '''Can this media player be paused? @param p_mi: the media player. @@ -7105,10 +7176,9 @@ def libvlc_media_player_can_pause(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_can_pause', None) or \ _Cfunction('libvlc_media_player_can_pause', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_media_player_program_scrambled(p_mi): '''Check if the current program is scrambled. @param p_mi: the media player. @@ -7117,20 +7187,18 @@ def libvlc_media_player_program_scrambled(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_program_scrambled', None) or \ _Cfunction('libvlc_media_player_program_scrambled', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_media_player_next_frame(p_mi): '''Display the next frame (if supported). @param p_mi: the media player. ''' f = _Cfunctions.get('libvlc_media_player_next_frame', None) or \ _Cfunction('libvlc_media_player_next_frame', ((1,),), None, - None, MediaPlayer) + None, MediaPlayer) return f(p_mi) - def libvlc_media_player_navigate(p_mi, navigate): '''Navigate through DVD Menu. @param p_mi: the Media Player. @@ -7139,10 +7207,9 @@ def libvlc_media_player_navigate(p_mi, navigate): ''' f = _Cfunctions.get('libvlc_media_player_navigate', None) or \ _Cfunction('libvlc_media_player_navigate', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_uint) + None, MediaPlayer, ctypes.c_uint) return f(p_mi, navigate) - def libvlc_media_player_set_video_title_display(p_mi, position, timeout): '''Set if, and how, the video title will be shown when media is played. @param p_mi: the media player. @@ -7152,10 +7219,9 @@ def libvlc_media_player_set_video_title_display(p_mi, position, timeout): ''' f = _Cfunctions.get('libvlc_media_player_set_video_title_display', None) or \ _Cfunction('libvlc_media_player_set_video_title_display', ((1,), (1,), (1,),), None, - None, MediaPlayer, Position, ctypes.c_int) + None, MediaPlayer, Position, ctypes.c_int) return f(p_mi, position, timeout) - def libvlc_media_player_add_slave(p_mi, i_type, psz_uri, b_select): '''Add a slave to the current media player. @note: If the player is playing, the slave will be added directly. This call @@ -7169,20 +7235,18 @@ def libvlc_media_player_add_slave(p_mi, i_type, psz_uri, b_select): ''' f = _Cfunctions.get('libvlc_media_player_add_slave', None) or \ _Cfunction('libvlc_media_player_add_slave', ((1,), (1,), (1,), (1,),), None, - ctypes.c_int, MediaPlayer, MediaSlaveType, ctypes.c_char_p, ctypes.c_bool) + ctypes.c_int, MediaPlayer, MediaSlaveType, ctypes.c_char_p, ctypes.c_bool) return f(p_mi, i_type, psz_uri, b_select) - def libvlc_track_description_list_release(p_track_description): '''Release (free) L{TrackDescription}. @param p_track_description: the structure to release. ''' f = _Cfunctions.get('libvlc_track_description_list_release', None) or \ _Cfunction('libvlc_track_description_list_release', ((1,),), None, - None, ctypes.POINTER(TrackDescription)) + None, ctypes.POINTER(TrackDescription)) return f(p_track_description) - def libvlc_toggle_fullscreen(p_mi): '''Toggle fullscreen status on non-embedded video outputs. @warning: The same limitations applies to this function @@ -7191,10 +7255,9 @@ def libvlc_toggle_fullscreen(p_mi): ''' f = _Cfunctions.get('libvlc_toggle_fullscreen', None) or \ _Cfunction('libvlc_toggle_fullscreen', ((1,),), None, - None, MediaPlayer) + None, MediaPlayer) return f(p_mi) - def libvlc_set_fullscreen(p_mi, b_fullscreen): '''Enable or disable fullscreen. @warning: With most window managers, only a top-level windows can be in @@ -7208,10 +7271,9 @@ def libvlc_set_fullscreen(p_mi, b_fullscreen): ''' f = _Cfunctions.get('libvlc_set_fullscreen', None) or \ _Cfunction('libvlc_set_fullscreen', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_int) + None, MediaPlayer, ctypes.c_int) return f(p_mi, b_fullscreen) - def libvlc_get_fullscreen(p_mi): '''Get current fullscreen status. @param p_mi: the media player. @@ -7219,10 +7281,9 @@ def libvlc_get_fullscreen(p_mi): ''' f = _Cfunctions.get('libvlc_get_fullscreen', None) or \ _Cfunction('libvlc_get_fullscreen', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_video_set_key_input(p_mi, on): '''Enable or disable key press events handling, according to the LibVLC hotkeys configuration. By default and for historical reasons, keyboard events are @@ -7237,10 +7298,9 @@ def libvlc_video_set_key_input(p_mi, on): ''' f = _Cfunctions.get('libvlc_video_set_key_input', None) or \ _Cfunction('libvlc_video_set_key_input', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_uint) + None, MediaPlayer, ctypes.c_uint) return f(p_mi, on) - def libvlc_video_set_mouse_input(p_mi, on): '''Enable or disable mouse click events handling. By default, those events are handled. This is needed for DVD menus to work, as well as a few video @@ -7252,10 +7312,9 @@ def libvlc_video_set_mouse_input(p_mi, on): ''' f = _Cfunctions.get('libvlc_video_set_mouse_input', None) or \ _Cfunction('libvlc_video_set_mouse_input', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_uint) + None, MediaPlayer, ctypes.c_uint) return f(p_mi, on) - def libvlc_video_get_size(p_mi, num): '''Get the pixel dimensions of a video. @param p_mi: media player. @@ -7264,11 +7323,9 @@ def libvlc_video_get_size(p_mi, num): ''' f = _Cfunctions.get('libvlc_video_get_size', None) or \ _Cfunction('libvlc_video_get_size', ((1,), (1,), (2,), (2,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.POINTER(ctypes.c_uint), - ctypes.POINTER(ctypes.c_uint)) + ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.POINTER(ctypes.c_uint), ctypes.POINTER(ctypes.c_uint)) return f(p_mi, num) - def libvlc_video_get_cursor(p_mi, num): '''Get the mouse pointer coordinates over a video. Coordinates are expressed in terms of the decoded video resolution, @@ -7287,10 +7344,9 @@ def libvlc_video_get_cursor(p_mi, num): ''' f = _Cfunctions.get('libvlc_video_get_cursor', None) or \ _Cfunction('libvlc_video_get_cursor', ((1,), (1,), (2,), (2,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)) + ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.POINTER(ctypes.c_int), ctypes.POINTER(ctypes.c_int)) return f(p_mi, num) - def libvlc_video_get_scale(p_mi): '''Get the current video scaling factor. See also L{libvlc_video_set_scale}(). @@ -7299,10 +7355,9 @@ def libvlc_video_get_scale(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_scale', None) or \ _Cfunction('libvlc_video_get_scale', ((1,),), None, - ctypes.c_float, MediaPlayer) + ctypes.c_float, MediaPlayer) return f(p_mi) - def libvlc_video_set_scale(p_mi, f_factor): '''Set the video scaling factor. That is the ratio of the number of pixels on screen to the number of pixels in the original decoded video in each @@ -7314,10 +7369,9 @@ def libvlc_video_set_scale(p_mi, f_factor): ''' f = _Cfunctions.get('libvlc_video_set_scale', None) or \ _Cfunction('libvlc_video_set_scale', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_float) + None, MediaPlayer, ctypes.c_float) return f(p_mi, f_factor) - def libvlc_video_get_aspect_ratio(p_mi): '''Get current video aspect ratio. @param p_mi: the media player. @@ -7325,10 +7379,9 @@ def libvlc_video_get_aspect_ratio(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_aspect_ratio', None) or \ _Cfunction('libvlc_video_get_aspect_ratio', ((1,),), string_result, - ctypes.c_void_p, MediaPlayer) + ctypes.c_void_p, MediaPlayer) return f(p_mi) - def libvlc_video_set_aspect_ratio(p_mi, psz_aspect): '''Set new video aspect ratio. @param p_mi: the media player. @@ -7336,10 +7389,9 @@ def libvlc_video_set_aspect_ratio(p_mi, psz_aspect): ''' f = _Cfunctions.get('libvlc_video_set_aspect_ratio', None) or \ _Cfunction('libvlc_video_set_aspect_ratio', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_char_p) + None, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_aspect) - def libvlc_video_new_viewpoint(): '''Create a video viewpoint structure. @return: video viewpoint or None (the result must be released with free() or L{libvlc_free}()). @@ -7347,10 +7399,9 @@ def libvlc_video_new_viewpoint(): ''' f = _Cfunctions.get('libvlc_video_new_viewpoint', None) or \ _Cfunction('libvlc_video_new_viewpoint', (), None, - ctypes.POINTER(VideoViewpoint)) + ctypes.POINTER(VideoViewpoint)) return f() - def libvlc_video_update_viewpoint(p_mi, p_viewpoint, b_absolute): '''Update the video viewpoint information. @note: It is safe to call this function before the media player is started. @@ -7362,10 +7413,9 @@ def libvlc_video_update_viewpoint(p_mi, p_viewpoint, b_absolute): ''' f = _Cfunctions.get('libvlc_video_update_viewpoint', None) or \ _Cfunction('libvlc_video_update_viewpoint', ((1,), (1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.POINTER(VideoViewpoint), ctypes.c_bool) + ctypes.c_int, MediaPlayer, ctypes.POINTER(VideoViewpoint), ctypes.c_bool) return f(p_mi, p_viewpoint, b_absolute) - def libvlc_video_get_spu(p_mi): '''Get current video subtitle. @param p_mi: the media player. @@ -7373,10 +7423,9 @@ def libvlc_video_get_spu(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_spu', None) or \ _Cfunction('libvlc_video_get_spu', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_video_get_spu_count(p_mi): '''Get the number of available video subtitles. @param p_mi: the media player. @@ -7384,10 +7433,9 @@ def libvlc_video_get_spu_count(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_spu_count', None) or \ _Cfunction('libvlc_video_get_spu_count', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_video_get_spu_description(p_mi): '''Get the description of available video subtitles. @param p_mi: the media player. @@ -7395,10 +7443,9 @@ def libvlc_video_get_spu_description(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_spu_description', None) or \ _Cfunction('libvlc_video_get_spu_description', ((1,),), None, - ctypes.POINTER(TrackDescription), MediaPlayer) + ctypes.POINTER(TrackDescription), MediaPlayer) return f(p_mi) - def libvlc_video_set_spu(p_mi, i_spu): '''Set new video subtitle. @param p_mi: the media player. @@ -7407,10 +7454,9 @@ def libvlc_video_set_spu(p_mi, i_spu): ''' f = _Cfunctions.get('libvlc_video_set_spu', None) or \ _Cfunction('libvlc_video_set_spu', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_int) + ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, i_spu) - def libvlc_video_get_spu_delay(p_mi): '''Get the current subtitle delay. Positive values means subtitles are being displayed later, negative values earlier. @@ -7420,10 +7466,9 @@ def libvlc_video_get_spu_delay(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_spu_delay', None) or \ _Cfunction('libvlc_video_get_spu_delay', ((1,),), None, - ctypes.c_int64, MediaPlayer) + ctypes.c_int64, MediaPlayer) return f(p_mi) - def libvlc_video_set_spu_delay(p_mi, i_delay): '''Set the subtitle delay. This affects the timing of when the subtitle will be displayed. Positive values result in subtitles being displayed later, @@ -7436,10 +7481,9 @@ def libvlc_video_set_spu_delay(p_mi, i_delay): ''' f = _Cfunctions.get('libvlc_video_set_spu_delay', None) or \ _Cfunction('libvlc_video_set_spu_delay', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_int64) + ctypes.c_int, MediaPlayer, ctypes.c_int64) return f(p_mi, i_delay) - def libvlc_media_player_get_full_title_descriptions(p_mi, titles): '''Get the full description of available titles. @param p_mi: the media player. @@ -7449,10 +7493,9 @@ def libvlc_media_player_get_full_title_descriptions(p_mi, titles): ''' f = _Cfunctions.get('libvlc_media_player_get_full_title_descriptions', None) or \ _Cfunction('libvlc_media_player_get_full_title_descriptions', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.POINTER(ctypes.POINTER(TitleDescription))) + ctypes.c_int, MediaPlayer, ctypes.POINTER(ctypes.POINTER(TitleDescription))) return f(p_mi, titles) - def libvlc_title_descriptions_release(p_titles, i_count): '''Release a title description. @param p_titles: title description array to release. @@ -7461,10 +7504,9 @@ def libvlc_title_descriptions_release(p_titles, i_count): ''' f = _Cfunctions.get('libvlc_title_descriptions_release', None) or \ _Cfunction('libvlc_title_descriptions_release', ((1,), (1,),), None, - None, ctypes.POINTER(TitleDescription), ctypes.c_uint) + None, ctypes.POINTER(TitleDescription), ctypes.c_uint) return f(p_titles, i_count) - def libvlc_media_player_get_full_chapter_descriptions(p_mi, i_chapters_of_title, pp_chapters): '''Get the full description of available chapters. @param p_mi: the media player. @@ -7475,10 +7517,9 @@ def libvlc_media_player_get_full_chapter_descriptions(p_mi, i_chapters_of_title, ''' f = _Cfunctions.get('libvlc_media_player_get_full_chapter_descriptions', None) or \ _Cfunction('libvlc_media_player_get_full_chapter_descriptions', ((1,), (1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_int, ctypes.POINTER(ctypes.POINTER(ChapterDescription))) + ctypes.c_int, MediaPlayer, ctypes.c_int, ctypes.POINTER(ctypes.POINTER(ChapterDescription))) return f(p_mi, i_chapters_of_title, pp_chapters) - def libvlc_chapter_descriptions_release(p_chapters, i_count): '''Release a chapter description. @param p_chapters: chapter description array to release. @@ -7487,10 +7528,9 @@ def libvlc_chapter_descriptions_release(p_chapters, i_count): ''' f = _Cfunctions.get('libvlc_chapter_descriptions_release', None) or \ _Cfunction('libvlc_chapter_descriptions_release', ((1,), (1,),), None, - None, ctypes.POINTER(ChapterDescription), ctypes.c_uint) + None, ctypes.POINTER(ChapterDescription), ctypes.c_uint) return f(p_chapters, i_count) - def libvlc_video_get_crop_geometry(p_mi): '''Get current crop filter geometry. @param p_mi: the media player. @@ -7498,10 +7538,9 @@ def libvlc_video_get_crop_geometry(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_crop_geometry', None) or \ _Cfunction('libvlc_video_get_crop_geometry', ((1,),), string_result, - ctypes.c_void_p, MediaPlayer) + ctypes.c_void_p, MediaPlayer) return f(p_mi) - def libvlc_video_set_crop_geometry(p_mi, psz_geometry): '''Set new crop filter geometry. @param p_mi: the media player. @@ -7509,10 +7548,9 @@ def libvlc_video_set_crop_geometry(p_mi, psz_geometry): ''' f = _Cfunctions.get('libvlc_video_set_crop_geometry', None) or \ _Cfunction('libvlc_video_set_crop_geometry', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_char_p) + None, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_geometry) - def libvlc_video_get_teletext(p_mi): '''Get current teletext page requested or 0 if it's disabled. Teletext is disabled by default, call L{libvlc_video_set_teletext}() to enable @@ -7522,10 +7560,9 @@ def libvlc_video_get_teletext(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_teletext', None) or \ _Cfunction('libvlc_video_get_teletext', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_video_set_teletext(p_mi, i_page): '''Set new teletext page to retrieve. This function can also be used to send a teletext key. @@ -7534,10 +7571,9 @@ def libvlc_video_set_teletext(p_mi, i_page): ''' f = _Cfunctions.get('libvlc_video_set_teletext', None) or \ _Cfunction('libvlc_video_set_teletext', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_int) + None, MediaPlayer, ctypes.c_int) return f(p_mi, i_page) - def libvlc_video_get_track_count(p_mi): '''Get number of available video tracks. @param p_mi: media player. @@ -7545,10 +7581,9 @@ def libvlc_video_get_track_count(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_track_count', None) or \ _Cfunction('libvlc_video_get_track_count', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_video_get_track_description(p_mi): '''Get the description of available video tracks. @param p_mi: media player. @@ -7556,10 +7591,9 @@ def libvlc_video_get_track_description(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_track_description', None) or \ _Cfunction('libvlc_video_get_track_description', ((1,),), None, - ctypes.POINTER(TrackDescription), MediaPlayer) + ctypes.POINTER(TrackDescription), MediaPlayer) return f(p_mi) - def libvlc_video_get_track(p_mi): '''Get current video track. @param p_mi: media player. @@ -7567,10 +7601,9 @@ def libvlc_video_get_track(p_mi): ''' f = _Cfunctions.get('libvlc_video_get_track', None) or \ _Cfunction('libvlc_video_get_track', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_video_set_track(p_mi, i_track): '''Set video track. @param p_mi: media player. @@ -7579,10 +7612,9 @@ def libvlc_video_set_track(p_mi, i_track): ''' f = _Cfunctions.get('libvlc_video_set_track', None) or \ _Cfunction('libvlc_video_set_track', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_int) + ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, i_track) - def libvlc_video_take_snapshot(p_mi, num, psz_filepath, i_width, i_height): '''Take a snapshot of the current video window. If i_width AND i_height is 0, original size is used. @@ -7596,10 +7628,9 @@ def libvlc_video_take_snapshot(p_mi, num, psz_filepath, i_width, i_height): ''' f = _Cfunctions.get('libvlc_video_take_snapshot', None) or \ _Cfunction('libvlc_video_take_snapshot', ((1,), (1,), (1,), (1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.c_char_p, ctypes.c_int, ctypes.c_int) + ctypes.c_int, MediaPlayer, ctypes.c_uint, ctypes.c_char_p, ctypes.c_int, ctypes.c_int) return f(p_mi, num, psz_filepath, i_width, i_height) - def libvlc_video_set_deinterlace(p_mi, psz_mode): '''Enable or disable deinterlace filter. @param p_mi: libvlc media player. @@ -7607,10 +7638,9 @@ def libvlc_video_set_deinterlace(p_mi, psz_mode): ''' f = _Cfunctions.get('libvlc_video_set_deinterlace', None) or \ _Cfunction('libvlc_video_set_deinterlace', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_char_p) + None, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_mode) - def libvlc_video_get_marquee_int(p_mi, option): '''Get an integer marquee option value. @param p_mi: libvlc media player. @@ -7618,10 +7648,9 @@ def libvlc_video_get_marquee_int(p_mi, option): ''' f = _Cfunctions.get('libvlc_video_get_marquee_int', None) or \ _Cfunction('libvlc_video_get_marquee_int', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_uint) + ctypes.c_int, MediaPlayer, ctypes.c_uint) return f(p_mi, option) - def libvlc_video_get_marquee_string(p_mi, option): '''Get a string marquee option value. @param p_mi: libvlc media player. @@ -7629,10 +7658,9 @@ def libvlc_video_get_marquee_string(p_mi, option): ''' f = _Cfunctions.get('libvlc_video_get_marquee_string', None) or \ _Cfunction('libvlc_video_get_marquee_string', ((1,), (1,),), string_result, - ctypes.c_void_p, MediaPlayer, ctypes.c_uint) + ctypes.c_void_p, MediaPlayer, ctypes.c_uint) return f(p_mi, option) - def libvlc_video_set_marquee_int(p_mi, option, i_val): '''Enable, disable or set an integer marquee option Setting libvlc_marquee_Enable has the side effect of enabling (arg !0) @@ -7643,10 +7671,9 @@ def libvlc_video_set_marquee_int(p_mi, option, i_val): ''' f = _Cfunctions.get('libvlc_video_set_marquee_int', None) or \ _Cfunction('libvlc_video_set_marquee_int', ((1,), (1,), (1,),), None, - None, MediaPlayer, ctypes.c_uint, ctypes.c_int) + None, MediaPlayer, ctypes.c_uint, ctypes.c_int) return f(p_mi, option, i_val) - def libvlc_video_set_marquee_string(p_mi, option, psz_text): '''Set a marquee string option. @param p_mi: libvlc media player. @@ -7655,10 +7682,9 @@ def libvlc_video_set_marquee_string(p_mi, option, psz_text): ''' f = _Cfunctions.get('libvlc_video_set_marquee_string', None) or \ _Cfunction('libvlc_video_set_marquee_string', ((1,), (1,), (1,),), None, - None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p) + None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p) return f(p_mi, option, psz_text) - def libvlc_video_get_logo_int(p_mi, option): '''Get integer logo option. @param p_mi: libvlc media player instance. @@ -7666,10 +7692,9 @@ def libvlc_video_get_logo_int(p_mi, option): ''' f = _Cfunctions.get('libvlc_video_get_logo_int', None) or \ _Cfunction('libvlc_video_get_logo_int', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_uint) + ctypes.c_int, MediaPlayer, ctypes.c_uint) return f(p_mi, option) - def libvlc_video_set_logo_int(p_mi, option, value): '''Set logo option as integer. Options that take a different type value are ignored. @@ -7681,10 +7706,9 @@ def libvlc_video_set_logo_int(p_mi, option, value): ''' f = _Cfunctions.get('libvlc_video_set_logo_int', None) or \ _Cfunction('libvlc_video_set_logo_int', ((1,), (1,), (1,),), None, - None, MediaPlayer, ctypes.c_uint, ctypes.c_int) + None, MediaPlayer, ctypes.c_uint, ctypes.c_int) return f(p_mi, option, value) - def libvlc_video_set_logo_string(p_mi, option, psz_value): '''Set logo option as string. Options that take a different type value are ignored. @@ -7694,10 +7718,9 @@ def libvlc_video_set_logo_string(p_mi, option, psz_value): ''' f = _Cfunctions.get('libvlc_video_set_logo_string', None) or \ _Cfunction('libvlc_video_set_logo_string', ((1,), (1,), (1,),), None, - None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p) + None, MediaPlayer, ctypes.c_uint, ctypes.c_char_p) return f(p_mi, option, psz_value) - def libvlc_video_get_adjust_int(p_mi, option): '''Get integer adjust option. @param p_mi: libvlc media player instance. @@ -7706,10 +7729,9 @@ def libvlc_video_get_adjust_int(p_mi, option): ''' f = _Cfunctions.get('libvlc_video_get_adjust_int', None) or \ _Cfunction('libvlc_video_get_adjust_int', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_uint) + ctypes.c_int, MediaPlayer, ctypes.c_uint) return f(p_mi, option) - def libvlc_video_set_adjust_int(p_mi, option, value): '''Set adjust option as integer. Options that take a different type value are ignored. @@ -7722,10 +7744,9 @@ def libvlc_video_set_adjust_int(p_mi, option, value): ''' f = _Cfunctions.get('libvlc_video_set_adjust_int', None) or \ _Cfunction('libvlc_video_set_adjust_int', ((1,), (1,), (1,),), None, - None, MediaPlayer, ctypes.c_uint, ctypes.c_int) + None, MediaPlayer, ctypes.c_uint, ctypes.c_int) return f(p_mi, option, value) - def libvlc_video_get_adjust_float(p_mi, option): '''Get float adjust option. @param p_mi: libvlc media player instance. @@ -7734,10 +7755,9 @@ def libvlc_video_get_adjust_float(p_mi, option): ''' f = _Cfunctions.get('libvlc_video_get_adjust_float', None) or \ _Cfunction('libvlc_video_get_adjust_float', ((1,), (1,),), None, - ctypes.c_float, MediaPlayer, ctypes.c_uint) + ctypes.c_float, MediaPlayer, ctypes.c_uint) return f(p_mi, option) - def libvlc_video_set_adjust_float(p_mi, option, value): '''Set adjust option as float. Options that take a different type value are ignored. @@ -7748,10 +7768,9 @@ def libvlc_video_set_adjust_float(p_mi, option, value): ''' f = _Cfunctions.get('libvlc_video_set_adjust_float', None) or \ _Cfunction('libvlc_video_set_adjust_float', ((1,), (1,), (1,),), None, - None, MediaPlayer, ctypes.c_uint, ctypes.c_float) + None, MediaPlayer, ctypes.c_uint, ctypes.c_float) return f(p_mi, option, value) - def libvlc_audio_output_list_get(p_instance): '''Gets the list of available audio output modules. @param p_instance: libvlc instance. @@ -7759,20 +7778,18 @@ def libvlc_audio_output_list_get(p_instance): ''' f = _Cfunctions.get('libvlc_audio_output_list_get', None) or \ _Cfunction('libvlc_audio_output_list_get', ((1,),), None, - ctypes.POINTER(AudioOutput), Instance) + ctypes.POINTER(AudioOutput), Instance) return f(p_instance) - def libvlc_audio_output_list_release(p_list): '''Frees the list of available audio output modules. @param p_list: list with audio outputs for release. ''' f = _Cfunctions.get('libvlc_audio_output_list_release', None) or \ _Cfunction('libvlc_audio_output_list_release', ((1,),), None, - None, ctypes.POINTER(AudioOutput)) + None, ctypes.POINTER(AudioOutput)) return f(p_list) - def libvlc_audio_output_set(p_mi, psz_name): '''Selects an audio output module. @note: Any change will take be effect only after playback is stopped and @@ -7783,10 +7800,9 @@ def libvlc_audio_output_set(p_mi, psz_name): ''' f = _Cfunctions.get('libvlc_audio_output_set', None) or \ _Cfunction('libvlc_audio_output_set', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_char_p) + ctypes.c_int, MediaPlayer, ctypes.c_char_p) return f(p_mi, psz_name) - def libvlc_audio_output_device_enum(mp): '''Gets a list of potential audio output devices, See L{libvlc_audio_output_device_set}(). @@ -7802,10 +7818,9 @@ def libvlc_audio_output_device_enum(mp): ''' f = _Cfunctions.get('libvlc_audio_output_device_enum', None) or \ _Cfunction('libvlc_audio_output_device_enum', ((1,),), None, - ctypes.POINTER(AudioOutputDevice), MediaPlayer) + ctypes.POINTER(AudioOutputDevice), MediaPlayer) return f(mp) - def libvlc_audio_output_device_list_get(p_instance, aout): '''Gets a list of audio output devices for a given audio output module, See L{libvlc_audio_output_device_set}(). @@ -7823,10 +7838,9 @@ def libvlc_audio_output_device_list_get(p_instance, aout): ''' f = _Cfunctions.get('libvlc_audio_output_device_list_get', None) or \ _Cfunction('libvlc_audio_output_device_list_get', ((1,), (1,),), None, - ctypes.POINTER(AudioOutputDevice), Instance, ctypes.c_char_p) + ctypes.POINTER(AudioOutputDevice), Instance, ctypes.c_char_p) return f(p_instance, aout) - def libvlc_audio_output_device_list_release(p_list): '''Frees a list of available audio output devices. @param p_list: list with audio outputs for release. @@ -7834,10 +7848,9 @@ def libvlc_audio_output_device_list_release(p_list): ''' f = _Cfunctions.get('libvlc_audio_output_device_list_release', None) or \ _Cfunction('libvlc_audio_output_device_list_release', ((1,),), None, - None, ctypes.POINTER(AudioOutputDevice)) + None, ctypes.POINTER(AudioOutputDevice)) return f(p_list) - def libvlc_audio_output_device_set(mp, module, device_id): '''Configures an explicit audio output device. If the module paramater is None, audio output will be moved to the device @@ -7866,10 +7879,9 @@ def libvlc_audio_output_device_set(mp, module, device_id): ''' f = _Cfunctions.get('libvlc_audio_output_device_set', None) or \ _Cfunction('libvlc_audio_output_device_set', ((1,), (1,), (1,),), None, - None, MediaPlayer, ctypes.c_char_p, ctypes.c_char_p) + None, MediaPlayer, ctypes.c_char_p, ctypes.c_char_p) return f(mp, module, device_id) - def libvlc_audio_output_device_get(mp): '''Get the current audio output device identifier. This complements L{libvlc_audio_output_device_set}(). @@ -7888,20 +7900,18 @@ def libvlc_audio_output_device_get(mp): ''' f = _Cfunctions.get('libvlc_audio_output_device_get', None) or \ _Cfunction('libvlc_audio_output_device_get', ((1,),), string_result, - ctypes.c_void_p, MediaPlayer) + ctypes.c_void_p, MediaPlayer) return f(mp) - def libvlc_audio_toggle_mute(p_mi): '''Toggle mute status. @param p_mi: media player @warning Toggling mute atomically is not always possible: On some platforms, other processes can mute the VLC audio playback stream asynchronously. Thus, there is a small race condition where toggling will not work. See also the limitations of L{libvlc_audio_set_mute}(). ''' f = _Cfunctions.get('libvlc_audio_toggle_mute', None) or \ _Cfunction('libvlc_audio_toggle_mute', ((1,),), None, - None, MediaPlayer) + None, MediaPlayer) return f(p_mi) - def libvlc_audio_get_mute(p_mi): '''Get current mute status. @param p_mi: media player. @@ -7909,10 +7919,9 @@ def libvlc_audio_get_mute(p_mi): ''' f = _Cfunctions.get('libvlc_audio_get_mute', None) or \ _Cfunction('libvlc_audio_get_mute', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_audio_set_mute(p_mi, status): '''Set mute status. @param p_mi: media player. @@ -7920,10 +7929,9 @@ def libvlc_audio_set_mute(p_mi, status): ''' f = _Cfunctions.get('libvlc_audio_set_mute', None) or \ _Cfunction('libvlc_audio_set_mute', ((1,), (1,),), None, - None, MediaPlayer, ctypes.c_int) + None, MediaPlayer, ctypes.c_int) return f(p_mi, status) - def libvlc_audio_get_volume(p_mi): '''Get current software audio volume. @param p_mi: media player. @@ -7931,10 +7939,9 @@ def libvlc_audio_get_volume(p_mi): ''' f = _Cfunctions.get('libvlc_audio_get_volume', None) or \ _Cfunction('libvlc_audio_get_volume', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_audio_set_volume(p_mi, i_volume): '''Set current software audio volume. @param p_mi: media player. @@ -7943,10 +7950,9 @@ def libvlc_audio_set_volume(p_mi, i_volume): ''' f = _Cfunctions.get('libvlc_audio_set_volume', None) or \ _Cfunction('libvlc_audio_set_volume', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_int) + ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, i_volume) - def libvlc_audio_get_track_count(p_mi): '''Get number of available audio tracks. @param p_mi: media player. @@ -7954,10 +7960,9 @@ def libvlc_audio_get_track_count(p_mi): ''' f = _Cfunctions.get('libvlc_audio_get_track_count', None) or \ _Cfunction('libvlc_audio_get_track_count', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_audio_get_track_description(p_mi): '''Get the description of available audio tracks. @param p_mi: media player. @@ -7965,10 +7970,9 @@ def libvlc_audio_get_track_description(p_mi): ''' f = _Cfunctions.get('libvlc_audio_get_track_description', None) or \ _Cfunction('libvlc_audio_get_track_description', ((1,),), None, - ctypes.POINTER(TrackDescription), MediaPlayer) + ctypes.POINTER(TrackDescription), MediaPlayer) return f(p_mi) - def libvlc_audio_get_track(p_mi): '''Get current audio track. @param p_mi: media player. @@ -7976,10 +7980,9 @@ def libvlc_audio_get_track(p_mi): ''' f = _Cfunctions.get('libvlc_audio_get_track', None) or \ _Cfunction('libvlc_audio_get_track', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_audio_set_track(p_mi, i_track): '''Set current audio track. @param p_mi: media player. @@ -7988,10 +7991,9 @@ def libvlc_audio_set_track(p_mi, i_track): ''' f = _Cfunctions.get('libvlc_audio_set_track', None) or \ _Cfunction('libvlc_audio_set_track', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_int) + ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, i_track) - def libvlc_audio_get_channel(p_mi): '''Get current audio channel. @param p_mi: media player. @@ -7999,10 +8001,9 @@ def libvlc_audio_get_channel(p_mi): ''' f = _Cfunctions.get('libvlc_audio_get_channel', None) or \ _Cfunction('libvlc_audio_get_channel', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_audio_set_channel(p_mi, channel): '''Set current audio channel. @param p_mi: media player. @@ -8011,10 +8012,9 @@ def libvlc_audio_set_channel(p_mi, channel): ''' f = _Cfunctions.get('libvlc_audio_set_channel', None) or \ _Cfunction('libvlc_audio_set_channel', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_int) + ctypes.c_int, MediaPlayer, ctypes.c_int) return f(p_mi, channel) - def libvlc_audio_get_delay(p_mi): '''Get current audio delay. @param p_mi: media player. @@ -8023,10 +8023,9 @@ def libvlc_audio_get_delay(p_mi): ''' f = _Cfunctions.get('libvlc_audio_get_delay', None) or \ _Cfunction('libvlc_audio_get_delay', ((1,),), None, - ctypes.c_int64, MediaPlayer) + ctypes.c_int64, MediaPlayer) return f(p_mi) - def libvlc_audio_set_delay(p_mi, i_delay): '''Set current audio delay. The audio delay will be reset to zero each time the media changes. @param p_mi: media player. @@ -8036,10 +8035,9 @@ def libvlc_audio_set_delay(p_mi, i_delay): ''' f = _Cfunctions.get('libvlc_audio_set_delay', None) or \ _Cfunction('libvlc_audio_set_delay', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_int64) + ctypes.c_int, MediaPlayer, ctypes.c_int64) return f(p_mi, i_delay) - def libvlc_audio_equalizer_get_preset_count(): '''Get the number of equalizer presets. @return: number of presets. @@ -8047,10 +8045,9 @@ def libvlc_audio_equalizer_get_preset_count(): ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_preset_count', None) or \ _Cfunction('libvlc_audio_equalizer_get_preset_count', (), None, - ctypes.c_uint) + ctypes.c_uint) return f() - def libvlc_audio_equalizer_get_preset_name(u_index): '''Get the name of a particular equalizer preset. This name can be used, for example, to prepare a preset label or menu in a user @@ -8061,10 +8058,9 @@ def libvlc_audio_equalizer_get_preset_name(u_index): ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_preset_name', None) or \ _Cfunction('libvlc_audio_equalizer_get_preset_name', ((1,),), None, - ctypes.c_char_p, ctypes.c_uint) + ctypes.c_char_p, ctypes.c_uint) return f(u_index) - def libvlc_audio_equalizer_get_band_count(): '''Get the number of distinct frequency bands for an equalizer. @return: number of frequency bands. @@ -8072,10 +8068,9 @@ def libvlc_audio_equalizer_get_band_count(): ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_band_count', None) or \ _Cfunction('libvlc_audio_equalizer_get_band_count', (), None, - ctypes.c_uint) + ctypes.c_uint) return f() - def libvlc_audio_equalizer_get_band_frequency(u_index): '''Get a particular equalizer band frequency. This value can be used, for example, to create a label for an equalizer band control @@ -8086,10 +8081,9 @@ def libvlc_audio_equalizer_get_band_frequency(u_index): ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_band_frequency', None) or \ _Cfunction('libvlc_audio_equalizer_get_band_frequency', ((1,),), None, - ctypes.c_float, ctypes.c_uint) + ctypes.c_float, ctypes.c_uint) return f(u_index) - def libvlc_audio_equalizer_new(): '''Create a new default equalizer, with all frequency values zeroed. The new equalizer can subsequently be applied to a media player by invoking @@ -8100,11 +8094,10 @@ def libvlc_audio_equalizer_new(): @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_new', None) or \ - _Cfunction('libvlc_audio_equalizer_new', (), None, - ctypes.c_void_p) + _Cfunction('libvlc_audio_equalizer_new', (), class_result(AudioEqualizer), + ctypes.c_void_p) return f() - def libvlc_audio_equalizer_new_from_preset(u_index): '''Create a new equalizer, with initial frequency values copied from an existing preset. @@ -8117,11 +8110,10 @@ def libvlc_audio_equalizer_new_from_preset(u_index): @version: LibVLC 2.2.0 or later. ''' f = _Cfunctions.get('libvlc_audio_equalizer_new_from_preset', None) or \ - _Cfunction('libvlc_audio_equalizer_new_from_preset', ((1,),), None, - ctypes.c_void_p, ctypes.c_uint) + _Cfunction('libvlc_audio_equalizer_new_from_preset', ((1,),), class_result(AudioEqualizer), + ctypes.c_void_p, ctypes.c_uint) return f(u_index) - def libvlc_audio_equalizer_release(p_equalizer): '''Release a previously created equalizer instance. The equalizer was previously created by using L{libvlc_audio_equalizer_new}() or @@ -8132,10 +8124,9 @@ def libvlc_audio_equalizer_release(p_equalizer): ''' f = _Cfunctions.get('libvlc_audio_equalizer_release', None) or \ _Cfunction('libvlc_audio_equalizer_release', ((1,),), None, - None, ctypes.c_void_p) + None, AudioEqualizer) return f(p_equalizer) - def libvlc_audio_equalizer_set_preamp(p_equalizer, f_preamp): '''Set a new pre-amplification value for an equalizer. The new equalizer settings are subsequently applied to a media player by invoking @@ -8148,10 +8139,9 @@ def libvlc_audio_equalizer_set_preamp(p_equalizer, f_preamp): ''' f = _Cfunctions.get('libvlc_audio_equalizer_set_preamp', None) or \ _Cfunction('libvlc_audio_equalizer_set_preamp', ((1,), (1,),), None, - ctypes.c_int, ctypes.c_void_p, ctypes.c_float) + ctypes.c_int, AudioEqualizer, ctypes.c_float) return f(p_equalizer, f_preamp) - def libvlc_audio_equalizer_get_preamp(p_equalizer): '''Get the current pre-amplification value from an equalizer. @param p_equalizer: valid equalizer handle, must not be None. @@ -8160,10 +8150,9 @@ def libvlc_audio_equalizer_get_preamp(p_equalizer): ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_preamp', None) or \ _Cfunction('libvlc_audio_equalizer_get_preamp', ((1,),), None, - ctypes.c_float, ctypes.c_void_p) + ctypes.c_float, AudioEqualizer) return f(p_equalizer) - def libvlc_audio_equalizer_set_amp_at_index(p_equalizer, f_amp, u_band): '''Set a new amplification value for a particular equalizer frequency band. The new equalizer settings are subsequently applied to a media player by invoking @@ -8177,10 +8166,9 @@ def libvlc_audio_equalizer_set_amp_at_index(p_equalizer, f_amp, u_band): ''' f = _Cfunctions.get('libvlc_audio_equalizer_set_amp_at_index', None) or \ _Cfunction('libvlc_audio_equalizer_set_amp_at_index', ((1,), (1,), (1,),), None, - ctypes.c_int, ctypes.c_void_p, ctypes.c_float, ctypes.c_uint) + ctypes.c_int, AudioEqualizer, ctypes.c_float, ctypes.c_uint) return f(p_equalizer, f_amp, u_band) - def libvlc_audio_equalizer_get_amp_at_index(p_equalizer, u_band): '''Get the amplification value for a particular equalizer frequency band. @param p_equalizer: valid equalizer handle, must not be None. @@ -8190,10 +8178,9 @@ def libvlc_audio_equalizer_get_amp_at_index(p_equalizer, u_band): ''' f = _Cfunctions.get('libvlc_audio_equalizer_get_amp_at_index', None) or \ _Cfunction('libvlc_audio_equalizer_get_amp_at_index', ((1,), (1,),), None, - ctypes.c_float, ctypes.c_void_p, ctypes.c_uint) + ctypes.c_float, AudioEqualizer, ctypes.c_uint) return f(p_equalizer, u_band) - def libvlc_media_player_set_equalizer(p_mi, p_equalizer): '''Apply new equalizer settings to a media player. The equalizer is first created by invoking L{libvlc_audio_equalizer_new}() or @@ -8217,10 +8204,9 @@ def libvlc_media_player_set_equalizer(p_mi, p_equalizer): ''' f = _Cfunctions.get('libvlc_media_player_set_equalizer', None) or \ _Cfunction('libvlc_media_player_set_equalizer', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_void_p) + ctypes.c_int, MediaPlayer, AudioEqualizer) return f(p_mi, p_equalizer) - def libvlc_media_player_get_role(p_mi): '''Gets the media role. @param p_mi: media player. @@ -8229,10 +8215,9 @@ def libvlc_media_player_get_role(p_mi): ''' f = _Cfunctions.get('libvlc_media_player_get_role', None) or \ _Cfunction('libvlc_media_player_get_role', ((1,),), None, - ctypes.c_int, MediaPlayer) + ctypes.c_int, MediaPlayer) return f(p_mi) - def libvlc_media_player_set_role(p_mi, role): '''Sets the media role. @param p_mi: media player. @@ -8241,10 +8226,9 @@ def libvlc_media_player_set_role(p_mi, role): ''' f = _Cfunctions.get('libvlc_media_player_set_role', None) or \ _Cfunction('libvlc_media_player_set_role', ((1,), (1,),), None, - ctypes.c_int, MediaPlayer, ctypes.c_uint) + ctypes.c_int, MediaPlayer, ctypes.c_uint) return f(p_mi, role) - def libvlc_media_list_player_new(p_instance): '''Create new media_list_player. @param p_instance: libvlc instance. @@ -8252,10 +8236,9 @@ def libvlc_media_list_player_new(p_instance): ''' f = _Cfunctions.get('libvlc_media_list_player_new', None) or \ _Cfunction('libvlc_media_list_player_new', ((1,),), class_result(MediaListPlayer), - ctypes.c_void_p, Instance) + ctypes.c_void_p, Instance) return f(p_instance) - def libvlc_media_list_player_release(p_mlp): '''Release a media_list_player after use Decrement the reference count of a media player object. If the @@ -8266,10 +8249,9 @@ def libvlc_media_list_player_release(p_mlp): ''' f = _Cfunctions.get('libvlc_media_list_player_release', None) or \ _Cfunction('libvlc_media_list_player_release', ((1,),), None, - None, MediaListPlayer) + None, MediaListPlayer) return f(p_mlp) - def libvlc_media_list_player_retain(p_mlp): '''Retain a reference to a media player list object. Use L{libvlc_media_list_player_release}() to decrement reference count. @@ -8277,10 +8259,9 @@ def libvlc_media_list_player_retain(p_mlp): ''' f = _Cfunctions.get('libvlc_media_list_player_retain', None) or \ _Cfunction('libvlc_media_list_player_retain', ((1,),), None, - None, MediaListPlayer) + None, MediaListPlayer) return f(p_mlp) - def libvlc_media_list_player_event_manager(p_mlp): '''Return the event manager of this media_list_player. @param p_mlp: media list player instance. @@ -8288,10 +8269,9 @@ def libvlc_media_list_player_event_manager(p_mlp): ''' f = _Cfunctions.get('libvlc_media_list_player_event_manager', None) or \ _Cfunction('libvlc_media_list_player_event_manager', ((1,),), class_result(EventManager), - ctypes.c_void_p, MediaListPlayer) + ctypes.c_void_p, MediaListPlayer) return f(p_mlp) - def libvlc_media_list_player_set_media_player(p_mlp, p_mi): '''Replace media player in media_list_player with this instance. @param p_mlp: media list player instance. @@ -8299,10 +8279,9 @@ def libvlc_media_list_player_set_media_player(p_mlp, p_mi): ''' f = _Cfunctions.get('libvlc_media_list_player_set_media_player', None) or \ _Cfunction('libvlc_media_list_player_set_media_player', ((1,), (1,),), None, - None, MediaListPlayer, MediaPlayer) + None, MediaListPlayer, MediaPlayer) return f(p_mlp, p_mi) - def libvlc_media_list_player_get_media_player(p_mlp): '''Get media player of the media_list_player instance. @param p_mlp: media list player instance. @@ -8310,10 +8289,9 @@ def libvlc_media_list_player_get_media_player(p_mlp): ''' f = _Cfunctions.get('libvlc_media_list_player_get_media_player', None) or \ _Cfunction('libvlc_media_list_player_get_media_player', ((1,),), class_result(MediaPlayer), - ctypes.c_void_p, MediaListPlayer) + ctypes.c_void_p, MediaListPlayer) return f(p_mlp) - def libvlc_media_list_player_set_media_list(p_mlp, p_mlist): '''Set the media list associated with the player. @param p_mlp: media list player instance. @@ -8321,30 +8299,27 @@ def libvlc_media_list_player_set_media_list(p_mlp, p_mlist): ''' f = _Cfunctions.get('libvlc_media_list_player_set_media_list', None) or \ _Cfunction('libvlc_media_list_player_set_media_list', ((1,), (1,),), None, - None, MediaListPlayer, MediaList) + None, MediaListPlayer, MediaList) return f(p_mlp, p_mlist) - def libvlc_media_list_player_play(p_mlp): '''Play media list. @param p_mlp: media list player instance. ''' f = _Cfunctions.get('libvlc_media_list_player_play', None) or \ _Cfunction('libvlc_media_list_player_play', ((1,),), None, - None, MediaListPlayer) + None, MediaListPlayer) return f(p_mlp) - def libvlc_media_list_player_pause(p_mlp): '''Toggle pause (or resume) media list. @param p_mlp: media list player instance. ''' f = _Cfunctions.get('libvlc_media_list_player_pause', None) or \ _Cfunction('libvlc_media_list_player_pause', ((1,),), None, - None, MediaListPlayer) + None, MediaListPlayer) return f(p_mlp) - def libvlc_media_list_player_set_pause(p_mlp, do_pause): '''Pause or resume media list. @param p_mlp: media list player instance. @@ -8353,10 +8328,9 @@ def libvlc_media_list_player_set_pause(p_mlp, do_pause): ''' f = _Cfunctions.get('libvlc_media_list_player_set_pause', None) or \ _Cfunction('libvlc_media_list_player_set_pause', ((1,), (1,),), None, - None, MediaListPlayer, ctypes.c_int) + None, MediaListPlayer, ctypes.c_int) return f(p_mlp, do_pause) - def libvlc_media_list_player_is_playing(p_mlp): '''Is media list playing? @param p_mlp: media list player instance. @@ -8364,10 +8338,9 @@ def libvlc_media_list_player_is_playing(p_mlp): ''' f = _Cfunctions.get('libvlc_media_list_player_is_playing', None) or \ _Cfunction('libvlc_media_list_player_is_playing', ((1,),), None, - ctypes.c_int, MediaListPlayer) + ctypes.c_int, MediaListPlayer) return f(p_mlp) - def libvlc_media_list_player_get_state(p_mlp): '''Get current libvlc_state of media list player. @param p_mlp: media list player instance. @@ -8375,10 +8348,9 @@ def libvlc_media_list_player_get_state(p_mlp): ''' f = _Cfunctions.get('libvlc_media_list_player_get_state', None) or \ _Cfunction('libvlc_media_list_player_get_state', ((1,),), None, - State, MediaListPlayer) + State, MediaListPlayer) return f(p_mlp) - def libvlc_media_list_player_play_item_at_index(p_mlp, i_index): '''Play media list item at position index. @param p_mlp: media list player instance. @@ -8387,10 +8359,9 @@ def libvlc_media_list_player_play_item_at_index(p_mlp, i_index): ''' f = _Cfunctions.get('libvlc_media_list_player_play_item_at_index', None) or \ _Cfunction('libvlc_media_list_player_play_item_at_index', ((1,), (1,),), None, - ctypes.c_int, MediaListPlayer, ctypes.c_int) + ctypes.c_int, MediaListPlayer, ctypes.c_int) return f(p_mlp, i_index) - def libvlc_media_list_player_play_item(p_mlp, p_md): '''Play the given media item. @param p_mlp: media list player instance. @@ -8399,20 +8370,18 @@ def libvlc_media_list_player_play_item(p_mlp, p_md): ''' f = _Cfunctions.get('libvlc_media_list_player_play_item', None) or \ _Cfunction('libvlc_media_list_player_play_item', ((1,), (1,),), None, - ctypes.c_int, MediaListPlayer, Media) + ctypes.c_int, MediaListPlayer, Media) return f(p_mlp, p_md) - def libvlc_media_list_player_stop(p_mlp): '''Stop playing media list. @param p_mlp: media list player instance. ''' f = _Cfunctions.get('libvlc_media_list_player_stop', None) or \ _Cfunction('libvlc_media_list_player_stop', ((1,),), None, - None, MediaListPlayer) + None, MediaListPlayer) return f(p_mlp) - def libvlc_media_list_player_next(p_mlp): '''Play next item from media list. @param p_mlp: media list player instance. @@ -8420,10 +8389,9 @@ def libvlc_media_list_player_next(p_mlp): ''' f = _Cfunctions.get('libvlc_media_list_player_next', None) or \ _Cfunction('libvlc_media_list_player_next', ((1,),), None, - ctypes.c_int, MediaListPlayer) + ctypes.c_int, MediaListPlayer) return f(p_mlp) - def libvlc_media_list_player_previous(p_mlp): '''Play previous item from media list. @param p_mlp: media list player instance. @@ -8431,10 +8399,9 @@ def libvlc_media_list_player_previous(p_mlp): ''' f = _Cfunctions.get('libvlc_media_list_player_previous', None) or \ _Cfunction('libvlc_media_list_player_previous', ((1,),), None, - ctypes.c_int, MediaListPlayer) + ctypes.c_int, MediaListPlayer) return f(p_mlp) - def libvlc_media_list_player_set_playback_mode(p_mlp, e_mode): '''Sets the playback mode for the playlist. @param p_mlp: media list player instance. @@ -8442,7 +8409,7 @@ def libvlc_media_list_player_set_playback_mode(p_mlp, e_mode): ''' f = _Cfunctions.get('libvlc_media_list_player_set_playback_mode', None) or \ _Cfunction('libvlc_media_list_player_set_playback_mode', ((1,), (1,),), None, - None, MediaListPlayer, PlaybackMode) + None, MediaListPlayer, PlaybackMode) return f(p_mlp, e_mode) @@ -8453,18 +8420,13 @@ def libvlc_media_list_player_set_playback_mode(p_mlp, e_mode): # libvlc_printerr # libvlc_set_exit_handler -# 54 function(s) not wrapped as methods: -# libvlc_audio_equalizer_get_amp_at_index +# 39 function(s) not wrapped as methods: # libvlc_audio_equalizer_get_band_count # libvlc_audio_equalizer_get_band_frequency -# libvlc_audio_equalizer_get_preamp # libvlc_audio_equalizer_get_preset_count # libvlc_audio_equalizer_get_preset_name # libvlc_audio_equalizer_new # libvlc_audio_equalizer_new_from_preset -# libvlc_audio_equalizer_release -# libvlc_audio_equalizer_set_amp_at_index -# libvlc_audio_equalizer_set_preamp # libvlc_audio_output_device_list_release # libvlc_audio_output_list_release # libvlc_chapter_descriptions_release @@ -8492,17 +8454,7 @@ def libvlc_media_list_player_set_playback_mode(p_mlp, e_mode): # libvlc_media_tracks_release # libvlc_module_description_list_release # libvlc_new -# libvlc_renderer_discoverer_event_manager # libvlc_renderer_discoverer_list_release -# libvlc_renderer_discoverer_release -# libvlc_renderer_discoverer_start -# libvlc_renderer_discoverer_stop -# libvlc_renderer_item_flags -# libvlc_renderer_item_hold -# libvlc_renderer_item_icon_uri -# libvlc_renderer_item_name -# libvlc_renderer_item_release -# libvlc_renderer_item_type # libvlc_title_descriptions_release # libvlc_track_description_list_release # libvlc_track_description_release @@ -8516,7 +8468,6 @@ def callbackmethod(callback): """Now obsolete @callbackmethod decorator.""" return callback - # libvlc_free is not present in some versions of libvlc. If it is not # in the library, then emulate it by calling libc.free if not hasattr(dll, 'libvlc_free'): @@ -8536,8 +8487,7 @@ if not hasattr(dll, 'libvlc_free'): # ensure argtypes is right, because default type of int won't # work on 64-bit systems - libvlc_free.argtypes = [ctypes.c_void_p] - + libvlc_free.argtypes = [ ctypes.c_void_p ] # Version functions def _dot2int(v): @@ -8558,7 +8508,6 @@ def _dot2int(v): i = (i << 8) + t.pop(0) return i - def hex_version(): """Return the version of these bindings in hex or 0 if unavailable. """ @@ -8567,7 +8516,6 @@ def hex_version(): except (NameError, ValueError): return 0 - def libvlc_hex_version(): """Return the libvlc version in hex or 0 if unavailable. """ @@ -8576,7 +8524,6 @@ def libvlc_hex_version(): except ValueError: return 0 - def debug_callback(event, *args, **kwds): '''Example callback, useful for debugging. ''' @@ -8596,7 +8543,6 @@ if __name__ == '__main__': import termios import tty - def getch(): # getchar(), getc(stdin) #PYCHOK flake fd = sys.stdin.fileno() old = termios.tcgetattr(fd) @@ -8607,15 +8553,11 @@ if __name__ == '__main__': termios.tcsetattr(fd, termios.TCSADRAIN, old) return ch - def end_callback(event): print('End of media stream (event %s)' % event.type) sys.exit(0) - echo_position = False - - def pos_callback(event, player): if echo_position: sys.stdout.write('\r%s to %.2f%% (%.2f%%)' % (event.type, @@ -8623,21 +8565,49 @@ if __name__ == '__main__': player.get_position() * 100)) sys.stdout.flush() + def print_python(): + from platform import architecture, mac_ver, uname, win32_ver + if 'intelpython' in sys.executable: + t = 'Intel-' + # elif 'PyPy ' in sys.version: + # t = 'PyPy-' + else: + t = '' + t = '%sPython: %s (%s)' % (t, sys.version.split()[0], architecture()[0]) + if win32_ver()[0]: + t = t, 'Windows', win32_ver()[0] + elif mac_ver()[0]: + t = t, ('iOS' if sys.platform == 'ios' else 'macOS'), mac_ver()[0] + else: + try: + import distro # + t = t, bytes_to_str(distro.name()), bytes_to_str(distro.version()) + except ImportError: + t = (t,) + uname()[0:3:2] + print(' '.join(t)) def print_version(): """Print version of this vlc.py and of the libvlc""" try: - print('Build date: %s (%#x)' % (build_date, hex_version())) + print('%s: %s (%s)' % (os.path.basename(__file__), __version__, build_date)) print('LibVLC version: %s (%#x)' % (bytes_to_str(libvlc_get_version()), libvlc_hex_version())) print('LibVLC compiler: %s' % bytes_to_str(libvlc_get_compiler())) if plugin_path: print('Plugin path: %s' % plugin_path) - except: + except Exception: print('Error: %s' % sys.exc_info()[1]) + if '-h' in sys.argv[:2] or '--help' in sys.argv[:2]: + print('Usage: %s [options] ' % sys.argv[0]) + print('Once launched, type ? for help.') + print('') - if sys.argv[1:] and '-h' not in sys.argv[1:] and '--help' not in sys.argv[1:]: + elif '-v' in sys.argv[:2] or '--version' in sys.argv[:2]: + print_version() + print_python() + print('') + else: movie = os.path.expanduser(sys.argv.pop()) if not os.access(movie, os.R_OK): print('Error: %s file not readable' % movie) @@ -8676,15 +8646,13 @@ if __name__ == '__main__': # any number of positional and/or keyword arguments to be passed # to the callback (in addition to the first one, an Event instance). event_manager = player.event_manager() - event_manager.event_attach(EventType.MediaPlayerEndReached, end_callback) + event_manager.event_attach(EventType.MediaPlayerEndReached, end_callback) event_manager.event_attach(EventType.MediaPlayerPositionChanged, pos_callback, player) - def mspf(): """Milliseconds per frame""" return int(1000 // (player.get_fps() or 25)) - def print_info(): """Print information about the media""" try: @@ -8700,31 +8668,26 @@ if __name__ == '__main__': print('Video size: %s' % str(player.video_get_size(0))) # num=0 print('Scale: %s' % player.video_get_scale()) print('Aspect ratio: %s' % player.video_get_aspect_ratio()) - # print('Window:' % player.get_hwnd() + #print('Window:' % player.get_hwnd() except Exception: print('Error: %s' % sys.exc_info()[1]) - def sec_forward(): """Go forward one sec""" player.set_time(player.get_time() + 1000) - def sec_backward(): """Go backward one sec""" player.set_time(player.get_time() - 1000) - def frame_forward(): """Go forward one frame""" player.set_time(player.get_time() + mspf()) - def frame_backward(): """Go backward one frame""" player.set_time(player.get_time() - mspf()) - def print_help(): """Print help""" print('Single-character commands:') @@ -8733,18 +8696,15 @@ if __name__ == '__main__': print(' %s: %s.' % (k, m.rstrip('.'))) print('0-9: go to that fraction of the movie') - def quit_app(): """Stop and exit""" sys.exit(0) - def toggle_echo_position(): """Toggle echoing of media position""" global echo_position echo_position = not echo_position - keybindings = { ' ': player.pause, '+': sec_forward, @@ -8756,7 +8716,7 @@ if __name__ == '__main__': 'p': toggle_echo_position, 'q': quit_app, '?': print_help, - } + } print('Press q to quit, ? to get help.%s' % os.linesep) while True: @@ -8765,11 +8725,5 @@ if __name__ == '__main__': if k in keybindings: keybindings[k]() elif k.isdigit(): - # jump to fraction of the movie. - player.set_position(float('0.' + k)) - - else: - print('Usage: %s [options] ' % sys.argv[0]) - print('Once launched, type ? for help.') - print('') - print_version() + # jump to fraction of the movie. + player.set_position(float('0.'+k)) From 98d3c04a083e090d9f6c9d2217b326407bfa6a81 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Fri, 13 Dec 2019 13:31:07 +0300 Subject: [PATCH 3/6] settings refactoring --- app/connections.py | 48 ++-- app/eparser/__init__.py | 2 +- app/eparser/iptv.py | 2 +- app/properties.py | 67 ------ app/settings.py | 365 +++++++++++++++++++++++++++++++ app/tools/picons.py | 2 +- app/ui/backup.py | 18 +- app/ui/dialogs.py | 14 +- app/ui/download_dialog.py | 69 +++--- app/ui/epg_dialog.py | 22 +- app/ui/import_dialog.glade | 1 + app/ui/imports.py | 22 +- app/ui/iptv.py | 2 +- app/ui/main_app_window.py | 216 +++++++++--------- app/ui/main_helper.py | 4 +- app/ui/picons_downloader.py | 23 +- app/ui/satellites_dialog.py | 14 +- app/ui/service_details_dialog.py | 10 +- app/ui/settings_dialog.py | 160 ++++++-------- app/ui/uicommons.py | 4 - 20 files changed, 665 insertions(+), 400 deletions(-) delete mode 100644 app/properties.py create mode 100644 app/settings.py diff --git a/app/connections.py b/app/connections.py index 715f592a..7f5d3df9 100644 --- a/app/connections.py +++ b/app/connections.py @@ -11,7 +11,7 @@ from urllib.parse import urlencode from urllib.request import urlopen, HTTPPasswordMgrWithDefaultRealm, HTTPBasicAuthHandler, build_opener, install_opener from app.commons import log -from app.properties import Profile +from app.settings import Profile _BQ_FILES_LIST = ("tv", "radio", # enigma 2 "myservices.xml", "bouquets.xml", "ubouquets.xml") # neutrino @@ -44,16 +44,16 @@ class TestException(Exception): pass -def download_data(*, properties, download_type=DownloadType.ALL, callback=print): - with FTP(host=properties["host"], user=properties["user"], passwd=properties["password"]) as ftp: +def download_data(*, settings, download_type=DownloadType.ALL, callback=print): + with FTP(host=settings.host, user=settings.user, passwd=settings.password) as ftp: ftp.encoding = "utf-8" callback("FTP OK.\n") - save_path = properties["data_dir_path"] + save_path = settings.data_dir_path os.makedirs(os.path.dirname(save_path), exist_ok=True) files = [] # bouquets if download_type is DownloadType.ALL or download_type is DownloadType.BOUQUETS: - ftp.cwd(properties["services_path"]) + ftp.cwd(settings.services_path) ftp.dir(files.append) file_list = _BQ_FILES_LIST + _DATA_FILES_LIST if download_type is DownloadType.ALL else _BQ_FILES_LIST for file in files: @@ -63,7 +63,7 @@ def download_data(*, properties, download_type=DownloadType.ALL, callback=print) download_file(ftp, name, save_path, callback) # satellites.xml and webtv if download_type in (DownloadType.ALL, DownloadType.SATELLITES, DownloadType.WEBTV): - ftp.cwd(properties["satellites_xml_path"]) + ftp.cwd(settings.satellites_xml_path) files.clear() ftp.dir(files.append) @@ -75,11 +75,11 @@ def download_data(*, properties, download_type=DownloadType.ALL, callback=print) download_file(ftp, _WEBTV_XML_FILE, save_path, callback) # epg.dat if download_type is DownloadType.EPG: - stb_path = properties["services_path"] - epg_options = properties.get("epg_options", None) + stb_path = settings.services_path + epg_options = settings.epg_options if epg_options: - stb_path = epg_options.get("epg_dat_stb_path", stb_path) - save_path = epg_options.get("epg_dat_path", save_path) + stb_path = epg_options.epg_dat_stb_path or stb_path + save_path = epg_options.epg_dat_path or save_path ftp.cwd(stb_path) ftp.dir(files.append) for file in files: @@ -91,16 +91,17 @@ def download_data(*, properties, download_type=DownloadType.ALL, callback=print) callback("\nDone.\n") -def upload_data(*, properties, download_type=DownloadType.ALL, remove_unused=False, profile=Profile.ENIGMA_2, +def upload_data(*, settings, download_type=DownloadType.ALL, remove_unused=False, callback=print, done_callback=None, use_http=False): - data_path = properties["data_dir_path"] - host = properties["host"] - base_url = "http://{}:{}/api/".format(host, properties.get("http_port", "80")) + profile = settings.profile + data_path = settings.data_dir_path + host = settings.host + base_url = "http://{}:{}/api/".format(host, settings.http_port) tn, ht = None, None # telnet, http try: if profile is Profile.ENIGMA_2 and use_http: - ht = http(properties.get("http_user", ""), properties.get("http_password", ""), base_url, callback) + ht = http(settings.http_user, settings.http_password, base_url, callback) next(ht) message = "" if download_type is DownloadType.BOUQUETS: @@ -120,18 +121,19 @@ def upload_data(*, properties, download_type=DownloadType.ALL, remove_unused=Fal time.sleep(2) else: # telnet - tn = telnet(host=host, user=properties.get("telnet_user", "root"), - password=properties.get("telnet_password", ""), - timeout=properties.get("telnet_timeout", 5)) + tn = telnet(host=host, + user=settings.telnet_user, + password=settings.telnet_password, + timeout=settings.telnet_timeout) next(tn) # terminate enigma or neutrino tn.send("init 4") - with FTP(host=host, user=properties["user"], passwd=properties["password"]) as ftp: + with FTP(host=host, user=settings.user, passwd=settings.password) as ftp: ftp.encoding = "utf-8" callback("FTP OK.\n") - sat_xml_path = properties["satellites_xml_path"] - services_path = properties["services_path"] + sat_xml_path = settings.satellites_xml_path + services_path = settings.services_path if download_type is DownloadType.SATELLITES: upload_xml(ftp, data_path, sat_xml_path, _SAT_XML_FILE, callback) @@ -153,7 +155,7 @@ def upload_data(*, properties, download_type=DownloadType.ALL, remove_unused=Fal upload_files(ftp, data_path, _DATA_FILES_LIST, callback) if download_type is DownloadType.PICONS: - upload_picons(ftp, properties.get("picons_dir_path"), properties.get("picons_path"), callback) + upload_picons(ftp, settings.picons_dir_path, settings.picons_path, callback) if tn and not use_http: # resume enigma or restart neutrino @@ -362,7 +364,7 @@ def telnet_test(host, port, user, password, timeout): time.sleep(timeout) yield tn.read_very_eager() tn.close() - yield "Done" + yield "Done!" if __name__ == "__main__": diff --git a/app/eparser/__init__.py b/app/eparser/__init__.py index 6062f1c6..fff031a5 100644 --- a/app/eparser/__init__.py +++ b/app/eparser/__init__.py @@ -1,5 +1,5 @@ from app.commons import run_task -from app.properties import Profile +from app.settings import Profile from .ecommons import Service, Satellite, Transponder, Bouquet, Bouquets, is_transponder_valid from .enigma.blacklist import get_blacklist, write_blacklist from .enigma.bouquets import get_bouquets as get_enigma_bouquets, write_bouquets as write_enigma_bouquets, to_bouquet_id diff --git a/app/eparser/iptv.py b/app/eparser/iptv.py index 2c67a53f..b47a8967 100644 --- a/app/eparser/iptv.py +++ b/app/eparser/iptv.py @@ -3,7 +3,7 @@ import re import urllib.request from enum import Enum -from app.properties import Profile +from app.settings import Profile from app.ui.uicommons import IPTV_ICON from .ecommons import BqServiceType, Service diff --git a/app/properties.py b/app/properties.py deleted file mode 100644 index ebf0b12f..00000000 --- a/app/properties.py +++ /dev/null @@ -1,67 +0,0 @@ -import json -import os -from enum import Enum -from pathlib import Path - -CONFIG_PATH = str(Path.home()) + "/.config/demon-editor/" -CONFIG_FILE = CONFIG_PATH + "config.json" -DATA_PATH = "data/" - - -class Profile(Enum): - """ Profiles for settings """ - ENIGMA_2 = "0" - NEUTRINO_MP = "1" - - -def get_config(): - os.makedirs(os.path.dirname(CONFIG_PATH), exist_ok=True) # create dir if not exist - os.makedirs(os.path.dirname(DATA_PATH), exist_ok=True) - - if not os.path.isfile(CONFIG_FILE) or os.stat(CONFIG_FILE).st_size == 0: - reset_config() - - with open(CONFIG_FILE, "r") as config_file: - return json.load(config_file) - - -def reset_config(): - with open(CONFIG_FILE, "w") as default_config_file: - json.dump(get_default_settings(), default_config_file) - - -def write_config(config): - assert isinstance(config, dict) - with open(CONFIG_FILE, "w") as config_file: - json.dump(config, config_file) - - -def get_default_settings(): - return { - Profile.ENIGMA_2.value: { - "host": "127.0.0.1", "port": "21", "user": "root", "password": "root", - "http_user": "root", "http_password": "", "http_port": "80", "http_timeout": 5, - "telnet_user": "root", "telnet_password": "", "telnet_port": "23", "telnet_timeout": 5, - "services_path": "/etc/enigma2/", "user_bouquet_path": "/etc/enigma2/", - "satellites_xml_path": "/etc/tuxbox/", "data_dir_path": DATA_PATH + "enigma2/", - "picons_path": "/usr/share/enigma2/picon", "picons_dir_path": DATA_PATH + "enigma2/picons/", - "backup_dir_path": DATA_PATH + "enigma2/backup/", - "backup_before_save": True, "backup_before_downloading": True, - "v5_support": False, "http_api_support": False, "enable_yt_dl": False, "enable_send_to": False, - "use_colors": True, "new_color": "rgb(255,230,204)", "extra_color": "rgb(179,230,204)", - "fav_click_mode": 0}, - Profile.NEUTRINO_MP.value: { - "host": "127.0.0.1", "port": "21", "user": "root", "password": "root", - "http_user": "", "http_password": "", "http_port": "80", "http_timeout": 2, - "telnet_user": "root", "telnet_password": "", "telnet_port": "23", "telnet_timeout": 1, - "services_path": "/var/tuxbox/config/zapit/", "user_bouquet_path": "/var/tuxbox/config/zapit/", - "satellites_xml_path": "/var/tuxbox/config/", "data_dir_path": DATA_PATH + "neutrino/", - "picons_path": "/usr/share/tuxbox/neutrino/icons/logo/", "picons_dir_path": DATA_PATH + "neutrino/picons/", - "backup_dir_path": DATA_PATH + "neutrino/backup/", - "backup_before_save": True, "backup_before_downloading": True, - "fav_click_mode": 0}, - "profile": Profile.ENIGMA_2.value} - - -if __name__ == "__main__": - pass diff --git a/app/settings.py b/app/settings.py new file mode 100644 index 00000000..a73cd704 --- /dev/null +++ b/app/settings.py @@ -0,0 +1,365 @@ +import json +import os +from pprint import pformat +from textwrap import dedent +from enum import Enum +from pathlib import Path + +CONFIG_PATH = str(Path.home()) + "/.config/demon-editor/" +CONFIG_FILE = CONFIG_PATH + "config.json" +DATA_PATH = "data/" + + +class Profile(Enum): + """ Profiles for settings """ + ENIGMA_2 = "0" + NEUTRINO_MP = "1" + + +class Settings: + __INSTANCE = None + + def __init__(self): + self._config = get_config() + self._current_profile = Profile(self._config.get("profile")) + self._current_profile_options = self._config.get(self._current_profile.value) + + def __str__(self): + return dedent(""" Current profile: {} + Current profile options: + {} + Full config: + {} + """).format(self._current_profile, + pformat(self._current_profile_options), + pformat(self._config)) + + @classmethod + def get_instance(cls): + if not cls.__INSTANCE: + cls.__INSTANCE = Settings() + return cls.__INSTANCE + + def save(self): + write_config(self._config) + + def reset(self, force_write=False): + def_settings = get_default_settings() + for p in Profile: + current = self._config.get(p.value) + default = def_settings.get(p.value) + for k in default: + current[k] = default.get(k) + + if force_write: + write_config(get_default_settings()) + + def add(self, name, value): + """ Adds extra options """ + self._config[name] = value + + def get(self, name): + """ Returns extra options """ + return self._config.get(name, None) + + def get_default(self, name): + """ Returns default value of the option """ + return get_default_settings().get(self._current_profile.value).get(name) + + @property + def presets(self): + raise NotImplementedError + + @presets.setter + def presets(self, name): + raise NotImplementedError + + @property + def profile(self): + return self._current_profile + + @profile.setter + def profile(self, prf): + self._current_profile = prf + self._config["profile"] = prf.value + self._current_profile_options = self._config.get(prf.value) + + @property + def host(self): + return self._current_profile_options.get("host", self.get_default("host")) + + @host.setter + def host(self, value): + self._current_profile_options["host"] = value + + @property + def port(self): + return self._current_profile_options.get("port", self.get_default("port")) + + @port.setter + def port(self, value): + self._current_profile_options["port"] = value + + @property + def user(self): + return self._current_profile_options.get("user", self.get_default("user")) + + @user.setter + def user(self, value): + self._current_profile_options["user"] = value + + @property + def password(self): + return self._current_profile_options.get("password", self.get_default("password")) + + @password.setter + def password(self, value): + self._current_profile_options["password"] = value + + @property + def http_user(self): + return self._current_profile_options.get("http_user", self.get_default("http_user")) + + @http_user.setter + def http_user(self, value): + self._current_profile_options["http_user"] = value + + @property + def http_password(self): + return self._current_profile_options.get("http_password", self.get_default("http_password")) + + @http_password.setter + def http_password(self, value): + self._current_profile_options["http_password"] = value + + @property + def http_port(self): + return self._current_profile_options.get("http_port", self.get_default("http_port")) + + @http_port.setter + def http_port(self, value): + self._current_profile_options["http_port"] = value + + @property + def http_timeout(self): + return self._current_profile_options.get("http_timeout", self.get_default("http_timeout")) + + @http_timeout.setter + def http_timeout(self, value): + self._current_profile_options["http_timeout"] = value + + @property + def telnet_user(self): + return self._current_profile_options.get("telnet_user", self.get_default("telnet_user")) + + @telnet_user.setter + def telnet_user(self, value): + self._current_profile_options["telnet_user"] = value + + @property + def telnet_password(self): + return self._current_profile_options.get("telnet_password", self.get_default("telnet_password")) + + @telnet_password.setter + def telnet_password(self, value): + self._current_profile_options["telnet_password"] = value + + @property + def telnet_port(self): + return self._current_profile_options.get("telnet_port", self.get_default("telnet_port")) + + @telnet_port.setter + def telnet_port(self, value): + self._current_profile_options["telnet_port"] = value + + @property + def telnet_timeout(self): + return self._current_profile_options.get("telnet_timeout", self.get_default("telnet_timeout")) + + @telnet_timeout.setter + def telnet_timeout(self, value): + self._current_profile_options["telnet_timeout"] = value + + @property + def services_path(self): + return self._current_profile_options.get("services_path", self.get_default("services_path")) + + @services_path.setter + def services_path(self, value): + self._current_profile_options["services_path"] = value + + @property + def user_bouquet_path(self): + return self._current_profile_options.get("user_bouquet_path", self.get_default("user_bouquet_path")) + + @user_bouquet_path.setter + def user_bouquet_path(self, value): + self._current_profile_options["user_bouquet_path"] = value + + @property + def satellites_xml_path(self): + return self._current_profile_options.get("satellites_xml_path", self.get_default("satellites_xml_path")) + + @satellites_xml_path.setter + def satellites_xml_path(self, value): + self._current_profile_options["satellites_xml_path"] = value + + @property + def data_dir_path(self): + return self._current_profile_options.get("data_dir_path", self.get_default("data_dir_path")) + + @data_dir_path.setter + def data_dir_path(self, value): + self._current_profile_options["data_dir_path"] = value + + @property + def picons_path(self): + return self._current_profile_options.get("picons_path", self.get_default("picons_path")) + + @picons_path.setter + def picons_path(self, value): + self._current_profile_options["picons_path"] = value + + @property + def picons_dir_path(self): + return self._current_profile_options.get("picons_dir_path", self.get_default("picons_dir_path")) + + @picons_dir_path.setter + def picons_dir_path(self, value): + self._current_profile_options["picons_dir_path"] = value + + @property + def backup_dir_path(self): + return self._current_profile_options.get("backup_dir_path", self.get_default("backup_dir_path")) + + @backup_dir_path.setter + def backup_dir_path(self, value): + self._current_profile_options["backup_dir_path"] = value + + @property + def backup_before_save(self): + return self._current_profile_options.get("backup_before_save", self.get_default("backup_before_save")) + + @backup_before_save.setter + def backup_before_save(self, value): + self._current_profile_options["backup_before_save"] = value + + @property + def backup_before_downloading(self): + return self._current_profile_options.get("backup_before_downloading", + self.get_default("backup_before_downloading")) + + @backup_before_downloading.setter + def backup_before_downloading(self, value): + self._current_profile_options["backup_before_downloading"] = value + + @property + def v5_support(self): + return self._current_profile_options.get("v5_support", self.get_default("v5_support")) + + @v5_support.setter + def v5_support(self, value): + self._current_profile_options["v5_support"] = value + + @property + def http_api_support(self): + return self._current_profile_options.get("http_api_support", self.get_default("http_api_support")) + + @http_api_support.setter + def http_api_support(self, value): + self._current_profile_options["http_api_support"] = value + + @property + def enable_yt_dl(self): + return self._current_profile_options.get("enable_yt_dl", self.get_default("enable_yt_dl")) + + @enable_yt_dl.setter + def enable_yt_dl(self, value): + self._current_profile_options["enable_yt_dl"] = value + + @property + def enable_send_to(self): + return self._current_profile_options.get("enable_send_to", self.get_default("enable_send_to")) + + @enable_send_to.setter + def enable_send_to(self, value): + self._current_profile_options["enable_send_to"] = value + + @property + def use_colors(self): + return self._current_profile_options.get("use_colors", self.get_default("use_colors")) + + @use_colors.setter + def use_colors(self, value): + self._current_profile_options["use_colors"] = value + + @property + def new_color(self): + return self._current_profile_options.get("new_color", self.get_default("new_color")) + + @new_color.setter + def new_color(self, value): + self._current_profile_options["new_color"] = value + + @property + def extra_color(self): + return self._current_profile_options.get("extra_color", self.get_default("extra_color")) + + @extra_color.setter + def extra_color(self, value): + self._current_profile_options["extra_color"] = value + + @property + def fav_click_mode(self): + return self._current_profile_options.get("fav_click_mode", self.get_default("fav_click_mode")) + + @fav_click_mode.setter + def fav_click_mode(self, value): + self._current_profile_options["fav_click_mode"] = value + + +def get_config(): + os.makedirs(os.path.dirname(CONFIG_PATH), exist_ok=True) # create dir if not exist + os.makedirs(os.path.dirname(DATA_PATH), exist_ok=True) + + if not os.path.isfile(CONFIG_FILE) or os.stat(CONFIG_FILE).st_size == 0: + write_config(get_default_settings()) + + with open(CONFIG_FILE, "r") as config_file: + return json.load(config_file) + + +def write_config(config): + with open(CONFIG_FILE, "w") as config_file: + json.dump(config, config_file, indent=" ") + + +def get_default_settings(): + return { + Profile.ENIGMA_2.value: { + "host": "127.0.0.1", "port": "21", "user": "root", "password": "root", + "http_user": "root", "http_password": "", "http_port": "80", "http_timeout": 5, + "telnet_user": "root", "telnet_password": "", "telnet_port": "23", "telnet_timeout": 5, + "services_path": "/etc/enigma2/", "user_bouquet_path": "/etc/enigma2/", + "satellites_xml_path": "/etc/tuxbox/", "data_dir_path": DATA_PATH + "enigma2/", + "picons_path": "/usr/share/enigma2/picon", "picons_dir_path": DATA_PATH + "enigma2/picons/", + "backup_dir_path": DATA_PATH + "enigma2/backup/", + "backup_before_save": True, "backup_before_downloading": True, + "v5_support": False, "http_api_support": False, "enable_yt_dl": False, "enable_send_to": False, + "use_colors": True, "new_color": "rgb(255,230,204)", "extra_color": "rgb(179,230,204)", + "fav_click_mode": 0}, + Profile.NEUTRINO_MP.value: { + "host": "127.0.0.1", "port": "21", "user": "root", "password": "root", + "http_user": "", "http_password": "", "http_port": "80", "http_timeout": 2, + "telnet_user": "root", "telnet_password": "", "telnet_port": "23", "telnet_timeout": 1, + "services_path": "/var/tuxbox/config/zapit/", "user_bouquet_path": "/var/tuxbox/config/zapit/", + "satellites_xml_path": "/var/tuxbox/config/", "data_dir_path": DATA_PATH + "neutrino/", + "picons_path": "/usr/share/tuxbox/neutrino/icons/logo/", "picons_dir_path": DATA_PATH + "neutrino/picons/", + "backup_dir_path": DATA_PATH + "neutrino/backup/", + "backup_before_save": True, "backup_before_downloading": True, + "fav_click_mode": 0}, + "profile": Profile.ENIGMA_2.value} + + +if __name__ == "__main__": + pass diff --git a/app/tools/picons.py b/app/tools/picons.py index 01ad980b..87f3d5a4 100644 --- a/app/tools/picons.py +++ b/app/tools/picons.py @@ -7,7 +7,7 @@ from collections import namedtuple from html.parser import HTMLParser from app.commons import run_task -from app.properties import Profile +from app.settings import Profile _ENIGMA2_PICON_KEY = "{:X}:{:X}:{}" _NEUTRINO_PICON_KEY = "{:x}{:04x}{:04x}.png" diff --git a/app/ui/backup.py b/app/ui/backup.py index 3e11aadd..7aca7613 100644 --- a/app/ui/backup.py +++ b/app/ui/backup.py @@ -7,7 +7,7 @@ from datetime import datetime from enum import Enum from app.commons import run_idle -from app.properties import Profile +from app.settings import Profile from app.ui.dialogs import show_dialog, DialogType from app.ui.main_helper import append_text_to_tview from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, KeyboardKey @@ -19,7 +19,7 @@ class RestoreType(Enum): class BackupDialog: - def __init__(self, transient, options, profile, callback): + def __init__(self, transient, settings, callback): handlers = {"on_restore_bouquets": self.on_restore_bouquets, "on_restore_all": self.on_restore_all, "on_remove": self.on_remove, @@ -35,10 +35,10 @@ class BackupDialog: builder.add_from_file(UI_RESOURCES_PATH + "backup_dialog.glade") builder.connect_signals(handlers) - self._options = options.get(profile.value) - self._data_path = self._options.get("data_dir_path", "") - self._backup_path = self._options.get("backup_dir_path", self._data_path + "backup/") - self._profile = profile + self._settings = settings + self._profile = settings.profile + self._data_path = self._settings.data_dir_path + self._backup_path = self._settings.backup_dir_path or self._data_path + "backup/" self._open_data_callback = callback self._dialog_window = builder.get_object("dialog_window") self._dialog_window.set_transient_for(transient) @@ -50,7 +50,7 @@ class BackupDialog: self._info_bar = builder.get_object("info_bar") self._message_label = builder.get_object("message_label") # Setting the last size of the dialog window if it was saved - window_size = self._options.get("backup_tool_window_size", None) + window_size = self._settings.get("backup_tool_window_size") if window_size: self._dialog_window.resize(*window_size) @@ -166,8 +166,8 @@ class BackupDialog: self._open_data_callback(self._data_path) def on_resize(self, window): - if self._options: - self._options["backup_tool_window_size"] = window.get_size() + if self._settings: + self._settings.add("backup_tool_window_size", window.get_size()) def on_key_release(self, view, event): """ Handling keystrokes """ diff --git a/app/ui/dialogs.py b/app/ui/dialogs.py index 7e2690d1..596b89f6 100644 --- a/app/ui/dialogs.py +++ b/app/ui/dialogs.py @@ -67,12 +67,12 @@ class WaitDialog: self._dialog.destroy() -def show_dialog(dialog_type: DialogType, transient, text=None, options=None, action_type=None, file_filter=None): +def show_dialog(dialog_type: DialogType, transient, text=None, settings=None, action_type=None, file_filter=None): """ Shows dialogs by name """ if dialog_type in (DialogType.INFO, DialogType.ERROR): return get_message_dialog(transient, dialog_type, Gtk.ButtonsType.OK, text) - elif dialog_type is DialogType.CHOOSER and options: - return get_file_chooser_dialog(transient, text, options, action_type, file_filter) + elif dialog_type is DialogType.CHOOSER and settings: + return get_file_chooser_dialog(transient, text, settings, action_type, file_filter) elif dialog_type is DialogType.INPUT: return get_input_dialog(transient, text) elif dialog_type is DialogType.QUESTION: @@ -81,19 +81,19 @@ def show_dialog(dialog_type: DialogType, transient, text=None, options=None, act return get_about_dialog(transient) -def get_chooser_dialog(transient, options, pattern, name): +def get_chooser_dialog(transient, settings, pattern, name): file_filter = Gtk.FileFilter() file_filter.add_pattern(pattern) file_filter.set_name(name) return show_dialog(dialog_type=DialogType.CHOOSER, transient=transient, - options=options, + settings=settings, action_type=Gtk.FileChooserAction.OPEN, file_filter=file_filter) -def get_file_chooser_dialog(transient, text, options, action_type, file_filter): +def get_file_chooser_dialog(transient, text, settings, action_type, file_filter): dialog = Gtk.FileChooserDialog(get_message(text) if text else "", transient, action_type if action_type is not None else Gtk.FileChooserAction.SELECT_FOLDER, (Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_OPEN, Gtk.ResponseType.OK), @@ -101,7 +101,7 @@ def get_file_chooser_dialog(transient, text, options, action_type, file_filter): if file_filter is not None: dialog.add_filter(file_filter) - path = options.get("data_dir_path") + path = settings.data_dir_path dialog.set_current_folder(path) response = dialog.run() if response == Gtk.ResponseType.OK: diff --git a/app/ui/download_dialog.py b/app/ui/download_dialog.py index 801ee934..91d0d9c5 100644 --- a/app/ui/download_dialog.py +++ b/app/ui/download_dialog.py @@ -2,7 +2,7 @@ from gi.repository import GLib from app.commons import run_idle, run_task from app.connections import download_data, DownloadType, upload_data -from app.properties import Profile, get_config +from app.settings import Profile from app.ui.backup import backup_data, restore_data from app.ui.main_helper import append_text_to_tview from app.ui.settings_dialog import show_settings_dialog @@ -11,12 +11,11 @@ from .dialogs import show_dialog, DialogType, get_message class DownloadDialog: - def __init__(self, transient, properties, open_data_callback, update_settings_callback, profile=Profile.ENIGMA_2): - self._profile_properties = properties.get(profile.value) - self._properties = properties + def __init__(self, transient, settings, open_data_callback, update_settings_callback): + self._profile = settings.profile + self._settings = settings self._open_data_callback = open_data_callback self._update_settings_callback = update_settings_callback - self._profile = profile handlers = {"on_receive": self.on_receive, "on_send": self.on_send, @@ -53,14 +52,14 @@ class DownloadDialog: self._use_http_switch = builder.get_object("use_http_switch") self._http_radio_button = builder.get_object("http_radio_button") self._use_http_box = builder.get_object("use_http_box") - self.init_properties() + self.init_settings() def show(self): self._dialog_window.show() - def init_properties(self): - self._host_entry.set_text(self._profile_properties["host"]) - self._data_path_entry.set_text(self._profile_properties["data_dir_path"]) + def init_settings(self): + self._host_entry.set_text(self._settings.host) + self._data_path_entry.set_text(self._settings.data_dir_path) is_enigma = self._profile is Profile.ENIGMA_2 self._webtv_radio_button.set_visible(not is_enigma) self._http_radio_button.set_visible(is_enigma) @@ -93,33 +92,34 @@ class DownloadDialog: if button.get_active(): label = button.get_label() if label == "Telnet": - self._login_entry.set_text(self._profile_properties.get("telnet_user", "")) - self._password_entry.set_text(self._profile_properties.get("telnet_password", "")) - self._port_entry.set_text(self._profile_properties.get("telnet_port", "")) - self._timeout_entry.set_text(str(self._profile_properties.get("telnet_timeout", 0))) + self._login_entry.set_text(self._settings.telnet_user) + self._password_entry.set_text(self._settings.telnet_password) + self._port_entry.set_text(self._settings.telnet_port) + self._timeout_entry.set_text(str(self._settings.telnet_timeout)) elif label == "HTTP": - self._login_entry.set_text(self._profile_properties.get("http_user", "root")) - self._password_entry.set_text(self._profile_properties.get("http_password", "")) - self._port_entry.set_text(self._profile_properties.get("http_port", "")) - self._timeout_entry.set_text(str(self._profile_properties.get("http_timeout", 0))) + self._login_entry.set_text(self._settings.http_user) + self._password_entry.set_text(self._settings.http_password) + self._port_entry.set_text(self._settings.http_port) + self._timeout_entry.set_text(str(self._settings.http_timeout)) elif label == "FTP": - self._login_entry.set_text(self._profile_properties.get("user", "")) - self._password_entry.set_text(self._profile_properties.get("password", "")) - self._port_entry.set_text(self._profile_properties.get("port", "")) + self._login_entry.set_text(self._settings.user) + self._password_entry.set_text(self._settings.password) + self._port_entry.set_text(self._settings.port) self._timeout_entry.set_text("") self._current_property = label def on_preferences(self, item): - show_settings_dialog(self._dialog_window, self._properties) - self._profile = Profile(self._properties.get("profile", Profile.ENIGMA_2.value)) - self._profile_properties = get_config().get(self._profile.value) - self.init_properties() - self._update_settings_callback() + response = show_settings_dialog(self._dialog_window, self._settings) + if response != Gtk.ResponseType.CANCEL: + self._profile = self._settings.profile + self.init_settings() + gen = self._update_settings_callback() + GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW) - for button in self._settings_buttons_box.get_children(): - if button.get_active(): - self.on_settings_button(button) - break + for button in self._settings_buttons_box.get_children(): + if button.get_active(): + self.on_settings_button(button) + break def on_info_bar_close(self, bar=None, resp=None): self._info_bar.set_visible(False) @@ -129,21 +129,20 @@ class DownloadDialog: """ Download/upload data from/to receiver """ self._expander.set_expanded(True) self.clear_output() - backup, backup_src, data_path = self._profile_properties.get("backup_before_downloading", True), None, None + backup, backup_src, data_path = self._settings.backup_before_downloading, None, None try: if download: if backup and d_type is not DownloadType.SATELLITES: - data_path = self._profile_properties.get("data_dir_path", self._data_path_entry.get_text()) - backup_path = self._profile_properties.get("backup_dir_path", data_path + "backup/") + data_path = self._settings.data_dir_path or self._data_path_entry.get_text() + backup_path = self._settings.backup_dir_path or data_path + "backup/" backup_src = backup_data(data_path, backup_path, d_type is DownloadType.ALL) - download_data(properties=self._profile_properties, download_type=d_type, callback=self.append_output) + download_data(settings=self._settings, download_type=d_type, callback=self.append_output) else: self.show_info_message(get_message("Please, wait..."), Gtk.MessageType.INFO) - upload_data(properties=self._profile_properties, + upload_data(settings=self._settings, download_type=d_type, remove_unused=self._remove_unused_check_button.get_active(), - profile=self._profile, callback=self.append_output, done_callback=lambda: self.show_info_message(get_message("Done!"), Gtk.MessageType.INFO), use_http=self._use_http_switch.get_active()) diff --git a/app/ui/epg_dialog.py b/app/ui/epg_dialog.py index 7754cdf2..de6e49c3 100644 --- a/app/ui/epg_dialog.py +++ b/app/ui/epg_dialog.py @@ -25,7 +25,7 @@ class RefsSource(Enum): class EpgDialog: - def __init__(self, transient, options, services, bouquet, fav_model, bouquet_name): + def __init__(self, transient, settings, services, bouquet, fav_model, bouquet_name): handlers = {"on_close_dialog": self.on_close_dialog, "on_apply": self.on_apply, @@ -56,7 +56,7 @@ class EpgDialog: self._services = {} self._ex_services = services self._ex_fav_model = fav_model - self._options = options + self._settings = settings self._bouquet = bouquet self._bouquet_name = bouquet_name self._current_ref = [] @@ -106,7 +106,7 @@ class EpgDialog: self._update_on_start_switch = builder.get_object("update_on_start_switch") self._epg_dat_source_box = builder.get_object("epg_dat_source_box") # Setting the last size of the dialog window - window_size = self._options.get("epg_tool_window_size", None) + window_size = self._settings.get("epg_tool_window_size") if window_size: self._dialog.resize(*window_size) @@ -288,7 +288,7 @@ class EpgDialog: @run_idle def on_save_to_xml(self, item): - response = show_dialog(DialogType.CHOOSER, self._dialog, options=self._options) + response = show_dialog(DialogType.CHOOSER, self._dialog, settings=self._settings) if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT): return @@ -483,10 +483,10 @@ class EpgDialog: # ***************** Options *********************# def init_options(self): - epg_dat_path = self._options.get("data_dir_path", "") + "epg/" + epg_dat_path = self._settings.data_dir_path + "epg/" self._epg_dat_path_entry.set_text(epg_dat_path) default_epg_data_stb_path = "/etc/enigma2" - epg_options = self._options.get("epg_options", None) + epg_options = self._settings.get("epg_options") if epg_options: self._refs_source = RefsSource.XML if epg_options.get("xml_source", False) else RefsSource.SERVICES self._xml_radiobutton.set_active(self._refs_source is RefsSource.XML) @@ -514,11 +514,11 @@ class EpgDialog: "epg_dat_path": self._epg_dat_path_entry.get_text(), "epg_dat_stb_path": self._epg_dat_stb_path_entry.get_text(), "epg_data_update_on_start": self._update_on_start_switch.get_active()} - self._options["epg_options"] = epg_options + self._settings.add("epg_options", epg_options) def on_resize(self, window): - if self._options: - self._options["epg_tool_window_size"] = window.get_size() + if self._settings: + self._settings.add("epg_tool_window_size", window.get_size()) def on_names_source_changed(self, button): self._refs_source = RefsSource.XML if button.get_active() else RefsSource.SERVICES @@ -536,13 +536,13 @@ class EpgDialog: self._xml_chooser_button.set_sensitive(not state) def on_field_icon_press(self, entry, icon, event_button): - update_entry_data(entry, self._dialog, self._options) + update_entry_data(entry, self._dialog, self._settings) # ***************** Downloads *********************# def download_epg_from_stb(self): """ Download the epg.dat file via ftp from the receiver. """ - download_data(properties=self._options, download_type=DownloadType.EPG, callback=print) + download_data(settings=self._settings, download_type=DownloadType.EPG, callback=print) if __name__ == "__main__": diff --git a/app/ui/import_dialog.glade b/app/ui/import_dialog.glade index b35db491..fe01dbcb 100644 --- a/app/ui/import_dialog.glade +++ b/app/ui/import_dialog.glade @@ -89,6 +89,7 @@ Author: Dmitriy Yefremov True dialog center + True diff --git a/app/ui/imports.py b/app/ui/imports.py index a957247d..bcbf979c 100644 --- a/app/ui/imports.py +++ b/app/ui/imports.py @@ -6,17 +6,18 @@ from app.eparser import get_bouquets, get_services from app.eparser.ecommons import BqType, BqServiceType, Bouquet from app.eparser.enigma.bouquets import get_bouquet from app.eparser.neutrino.bouquets import parse_webtv, parse_bouquets as get_neutrino_bouquets -from app.properties import Profile +from app.settings import Profile from app.ui.dialogs import show_dialog, DialogType, get_chooser_dialog, get_message from app.ui.main_helper import on_popup_menu from .uicommons import Gtk, UI_RESOURCES_PATH, KeyboardKey, Column -def import_bouquet(transient, profile, model, path, options, services, appender): +def import_bouquet(transient, model, path, settings, services, appender): """ Import of single bouquet """ itr = model.get_iter(path) bq_type = BqType(model.get(itr, Column.BQ_TYPE)[0]) pattern, f_pattern = None, None + profile = settings.profile if profile is Profile.ENIGMA_2: pattern = ".{}".format(bq_type.value) @@ -29,7 +30,7 @@ def import_bouquet(transient, profile, model, path, options, services, appender) elif bq_type is BqType.WEBTV: f_pattern = "webtv.xml" - file_path = get_chooser_dialog(transient, options, f_pattern, "bouquet files") + file_path = get_chooser_dialog(transient, settings, f_pattern, "bouquet files") if file_path == Gtk.ResponseType.CANCEL: return @@ -56,7 +57,7 @@ def import_bouquet(transient, profile, model, path, options, services, appender) else: bqs = get_neutrino_bouquets(file_path, "", bq_type.value) file_path = "{}/".format(Path(file_path).parent) - ImportDialog(transient, file_path, profile, services.keys(), lambda b, s: appender(b), (bqs,)).show() + ImportDialog(transient, file_path, settings, services.keys(), lambda b, s: appender(b), (bqs,)).show() def get_enigma2_bouquet(path): @@ -68,7 +69,7 @@ def get_enigma2_bouquet(path): class ImportDialog: - def __init__(self, transient, path, profile, service_ids, appender, bouquets=None): + def __init__(self, transient, path, settings, service_ids, appender, bouquets=None): handlers = {"on_import": self.on_import, "on_cursor_changed": self.on_cursor_changed, "on_info_button_toggled": self.on_info_button_toggled, @@ -77,6 +78,7 @@ class ImportDialog: "on_select_all": self.on_select_all, "on_unselect_all": self.on_unselect_all, "on_popup_menu": on_popup_menu, + "on_resize": self.on_resize, "on_key_press": self.on_key_press} builder = Gtk.Builder() @@ -88,7 +90,8 @@ class ImportDialog: self._services = {} self._service_ids = service_ids self._append = appender - self._profile = profile + self._profile = settings.profile + self._settings = settings self._bouquets = bouquets self._dialog_window = builder.get_object("dialog_window") @@ -101,6 +104,9 @@ class ImportDialog: self._info_check_button = builder.get_object("info_check_button") self._info_bar = builder.get_object("info_bar") self._message_label = builder.get_object("message_label") + window_size = self._settings.get("import_dialog_window_size") + if window_size: + self._dialog_window.resize(*window_size) self.init_data(path) @@ -206,6 +212,10 @@ class ImportDialog: def update_selection(self, view, select): view.get_model().foreach(lambda mod, path, itr: mod.set_value(itr, 2, select)) + def on_resize(self, window): + if self._settings: + self._settings.add("import_dialog_window_size", window.get_size()) + def on_key_press(self, view, event): """ Handling keystrokes """ key_code = event.hardware_keycode diff --git a/app/ui/iptv.py b/app/ui/iptv.py index 274ca3de..7693daeb 100644 --- a/app/ui/iptv.py +++ b/app/ui/iptv.py @@ -13,7 +13,7 @@ from gi.repository import GLib from app.commons import run_idle, run_task, log from app.eparser.ecommons import BqServiceType, Service from app.eparser.iptv import NEUTRINO_FAV_ID_FORMAT, StreamType, ENIGMA2_FAV_ID_FORMAT, get_fav_id, MARKER_FORMAT -from app.properties import Profile +from app.settings import Profile from app.tools.yt import YouTube, PlayListParser from .dialogs import Action, show_dialog, DialogType, get_dialogs_string, get_message from .main_helper import get_base_model, get_iptv_url, on_popup_menu diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 91325e40..49fa4d5c 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -16,7 +16,7 @@ from app.eparser.ecommons import CAS, Flag, BouquetService from app.eparser.enigma.bouquets import BqServiceType from app.eparser.iptv import export_to_m3u from app.eparser.neutrino.bouquets import BqType -from app.properties import get_config, write_config, Profile +from app.settings import Profile, Settings from app.tools.media import Player from app.ui.epg_dialog import EpgDialog from app.ui.transmitter import LinksTransmitter @@ -26,7 +26,7 @@ from .download_dialog import DownloadDialog from .iptv import IptvDialog, SearchUnavailableDialog, IptvListConfigurationDialog, YtListImportDialog from .search import SearchProvider from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, LOCKED_ICON, HIDE_ICON, IPTV_ICON, MOVE_KEYS, KeyboardKey, Column, \ - EXTRA_COLOR, NEW_COLOR, FavClickMode + FavClickMode from .dialogs import show_dialog, DialogType, get_chooser_dialog, WaitDialog, get_message from .main_helper import insert_marker, move_items, rename, ViewTarget, set_flags, locate_in_services, \ scroll_to, get_base_model, update_picons_data, copy_picon_reference, assign_picon, remove_picon, \ @@ -157,9 +157,9 @@ class Application(Gtk.Application): "on_create_bouquet_for_current_type": self.on_create_bouquet_for_current_type, "on_create_bouquet_for_each_type": self.on_create_bouquet_for_each_type} - self._options = get_config() - self._profile = self._options.get("profile") - os.makedirs(os.path.dirname(self._options.get(self._profile).get("data_dir_path")), exist_ok=True) + self._settings = Settings.get_instance() + self._profile = self._settings.profile + os.makedirs(os.path.dirname(self._settings.data_dir_path), exist_ok=True) # Used for copy/paste. When adding the previous data will not be deleted. # Clearing only after the insertion! self._rows_buffer = [] @@ -192,7 +192,7 @@ class Application(Gtk.Application): builder.add_from_file(UI_RESOURCES_PATH + "main_window.glade") builder.connect_signals(handlers) self._main_window = builder.get_object("main_window") - main_window_size = self._options.get("window_size", None) + main_window_size = self._settings.get("window_size") # Setting the last size of the window if it was saved if main_window_size: self._main_window.resize(*main_window_size) @@ -216,7 +216,7 @@ class Application(Gtk.Application): self._app_info_box.bind_property("visible", builder.get_object("left_header_box"), "sensitive", 4) # Status bar self._ip_label = builder.get_object("ip_label") - self._ip_label.set_text(self._options.get(self._profile).get("host")) + self._ip_label.set_text(self._settings.host) self._receiver_info_box = builder.get_object("receiver_info_box") self._receiver_info_label = builder.get_object("receiver_info_label") self._signal_box = builder.get_object("signal_box") @@ -301,7 +301,7 @@ class Application(Gtk.Application): def do_shutdown(self): """ Performs shutdown tasks """ - write_config(self._options) # storing current config + self._settings.save() # storing current config if self._player: self._player.release() Gtk.Application.do_shutdown(self) @@ -343,15 +343,12 @@ class Application(Gtk.Application): If update=False - first call on program start, else - after options changes! """ - profile = Profile(self._profile) - if profile is Profile.ENIGMA_2: - opts = self._options.get(self._profile) - self._use_colors = opts.get("use_colors", False) - if self._use_colors: + if self._profile is Profile.ENIGMA_2: + if self._settings.use_colors: new_rgb = Gdk.RGBA() extra_rgb = Gdk.RGBA() - new_rgb = new_rgb if new_rgb.parse(opts.get("new_color", NEW_COLOR)) else None - extra_rgb = extra_rgb if extra_rgb.parse(opts.get("extra_color", EXTRA_COLOR)) else None + new_rgb = new_rgb if new_rgb.parse(self._settings.new_color) else None + extra_rgb = extra_rgb if extra_rgb.parse(self._settings.extra_color) else None if update: gen = self.update_background_colors(new_rgb, extra_rgb) GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW) @@ -388,7 +385,7 @@ class Application(Gtk.Application): def on_resize(self, window): """ Stores new size properties for app window after resize """ - self._options["window_size"] = window.get_size() + self._settings.add("window_size", window.get_size()) @run_idle def on_about_app(self, item): @@ -577,7 +574,7 @@ class Application(Gtk.Application): # ***************** ####### *********************# def get_bouquet_file_name(self, bouquet): - bouquet_file_name = "{}userbouquet.{}.{}".format(self._options.get(self._profile).get("data_dir_path"), + bouquet_file_name = "{}userbouquet.{}.{}".format(self._settings.get(self._profile).get("data_dir_path"), *bouquet.split(":")) return bouquet_file_name @@ -805,19 +802,18 @@ class Application(Gtk.Application): @run_idle def on_satellite_editor_show(self, model): """ Shows satellites editor dialog """ - show_satellites_dialog(self._main_window, self._options.get(self._profile)) + show_satellites_dialog(self._main_window, self._settings) def on_download(self, item): DownloadDialog(transient=self._main_window, - properties=self._options, + settings=self._settings, open_data_callback=self.open_data, - update_settings_callback=self.update_options, - profile=Profile(self._profile)).show() + update_settings_callback=self.update_options).show() @run_task def on_download_data(self): try: - download_data(properties=self._options.get(self._profile), + download_data(settings=self._settings, download_type=DownloadType.ALL, callback=lambda x: print(x, end="")) except Exception as e: @@ -828,29 +824,27 @@ class Application(Gtk.Application): @run_task def on_upload_data(self, download_type): try: - profile = Profile(self._profile) - opts = self._options.get(self._profile) + profile = self._profile + opts = self._settings use_http = profile is Profile.ENIGMA_2 if profile is Profile.ENIGMA_2: - host, port = opts.get("host", "127.0.0.1"), opts.get("http_port") - user, password = opts.get("http_user", "root"), opts.get("http_password", "") + host, port, user, password = opts.host, opts.http_port, opts.http_user, opts.http_password try: test_http(host, port, user, password, skip_message=True) except TestException: use_http = False - upload_data(properties=opts, + upload_data(settings=opts, download_type=download_type, remove_unused=True, - profile=profile, callback=lambda x: print(x, end=""), use_http=use_http) except Exception as e: self.show_error_dialog(str(e)) def on_data_open(self, model): - response = show_dialog(DialogType.CHOOSER, self._main_window, options=self._options.get(self._profile)) + response = show_dialog(DialogType.CHOOSER, self._main_window, settings=self._settings) if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT): return self.open_data(response) @@ -864,18 +858,17 @@ class Application(Gtk.Application): self._wait_dialog.show() yield True - profile = Profile(self._profile) - data_path = self._options.get(self._profile).get("data_dir_path") if data_path is None else data_path - + data_path = self._settings.data_dir_path if data_path is None else data_path yield from self.clear_current_data() try: + prf = self._profile black_list = get_blacklist(data_path) - bouquets = get_bouquets(data_path, Profile(self._profile)) + bouquets = get_bouquets(data_path, prf) yield True - services = get_services(data_path, profile, self.get_format_version() if profile is Profile.ENIGMA_2 else 0) + services = get_services(data_path, prf, self.get_format_version() if prf is Profile.ENIGMA_2 else 0) yield True - update_picons_data(self._options.get(self._profile).get("picons_dir_path"), self._picons) + update_picons_data(self._settings.picons_dir_path, self._picons) yield True except FileNotFoundError as e: msg = get_message("Please, download files from receiver or setup your path for read data!") @@ -1016,12 +1009,11 @@ class Application(Gtk.Application): def save_data(self): self._save_header_button.set_sensitive(False) - profile = Profile(self._profile) - options = self._options.get(self._profile) - path = options.get("data_dir_path") - backup_path = options.get("backup_dir_path", path + "backup/") + profile = self._profile + path = self._settings.data_dir_path + backup_path = self._settings.backup_dir_path # Backup data or clearing data path - backup_data(path, backup_path) if options.get("backup_before_save", True) else clear_data_path(path) + backup_data(path, backup_path) if self._settings.backup_before_save else clear_data_path(path) yield True bouquets = [] @@ -1068,7 +1060,7 @@ class Application(Gtk.Application): if show_dialog(DialogType.QUESTION, self._main_window) == Gtk.ResponseType.CANCEL: return - gen = self.create_new_configuration(Profile(self._profile)) + gen = self.create_new_configuration(self._profile) GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW) def create_new_configuration(self, profile): @@ -1151,7 +1143,7 @@ class Application(Gtk.Application): self.show_error_dialog("Error. No bouquet is selected!") return - if Profile(self._profile) is Profile.NEUTRINO_MP and self._bq_selected.endswith(BqType.WEBTV.value): + if self._profile is Profile.NEUTRINO_MP and self._bq_selected.endswith(BqType.WEBTV.value): self.show_error_dialog("Operation not allowed in this context!") return @@ -1177,14 +1169,14 @@ class Application(Gtk.Application): v.get_selection().unselect_all() def on_preferences(self, item): - response = show_settings_dialog(self._main_window, self._options) + response = show_settings_dialog(self._main_window, self._settings) if response != Gtk.ResponseType.CANCEL: gen = self.update_options() GLib.idle_add(lambda: next(gen, False), priority=GLib.PRIORITY_LOW) def update_options(self): - profile = self._options.get("profile") - self._ip_label.set_text(self._options.get(profile).get("host")) + profile = self._settings.profile + self._ip_label.set_text(self._settings.host) if profile != self._profile: yield from self.show_app_info(True) self._profile = profile @@ -1281,7 +1273,6 @@ class Application(Gtk.Application): self.update_bouquet_list() def on_view_focus(self, view, focus_event=None): - profile = Profile(self._profile) model_name, model = get_model_data(view) not_empty = len(model) > 0 # if > 0 model has items is_service = model_name == self._SERVICE_LIST_NAME @@ -1293,7 +1284,7 @@ class Application(Gtk.Application): self._tool_elements[elem].set_sensitive(not_empty) if elem == "bouquets_paste_popup_item": self._tool_elements[elem].set_sensitive(not_empty and self._bouquets_buffer) - if profile is Profile.NEUTRINO_MP: + if self._profile is Profile.NEUTRINO_MP: for elem in self._LOCK_HIDE_ELEMENTS: self._tool_elements[elem].set_sensitive(not_empty) else: @@ -1309,17 +1300,17 @@ class Application(Gtk.Application): for elem in self._BOUQUET_ELEMENTS: self._tool_elements[elem].set_sensitive(False) for elem in self._LOCK_HIDE_ELEMENTS: - self._tool_elements[elem].set_sensitive(not_empty and profile is Profile.ENIGMA_2) + self._tool_elements[elem].set_sensitive(not_empty and self._profile is Profile.ENIGMA_2) for elem in self._FAV_IPTV_ELEMENTS: is_iptv = self._bq_selected and not is_service - if profile is Profile.NEUTRINO_MP: + if self._profile is Profile.NEUTRINO_MP: is_iptv = is_iptv and BqType(self._bq_selected.split(":")[1]) is BqType.WEBTV self._tool_elements[elem].set_sensitive(is_iptv) for elem in self._COMMONS_ELEMENTS: self._tool_elements[elem].set_sensitive(not_empty) - if profile is not Profile.ENIGMA_2: + if self._profile is not Profile.ENIGMA_2: for elem in self._FAV_ENIGMA_ELEMENTS: self._tool_elements[elem].set_sensitive(False) @@ -1330,11 +1321,9 @@ class Application(Gtk.Application): self.set_service_flags(Flag.LOCK) def set_service_flags(self, flag): - profile = Profile(self._profile) - - if profile is Profile.ENIGMA_2: + if self._profile is Profile.ENIGMA_2: set_flags(flag, self._services_view, self._fav_view, self._services, self._blacklist) - elif profile is Profile.NEUTRINO_MP and self._bq_selected: + elif self._profile is Profile.NEUTRINO_MP and self._bq_selected: model, paths = self._bouquets_view.get_selection().get_selected_rows() itr = model.get_iter(paths[0]) value = model.get_value(itr, 1 if flag is Flag.LOCK else 2) @@ -1397,15 +1386,14 @@ class Application(Gtk.Application): self._fav_view, self._services, self._bouquets.get(self._bq_selected, None), - Profile(self._profile), + self._profile, Action.ADD).show() if response != Gtk.ResponseType.CANCEL: self.update_fav_num_column(self._fav_model) @run_idle def on_iptv_list_configuration(self, item): - profile = Profile(self._profile) - if profile is Profile.NEUTRINO_MP: + if self._profile is Profile.NEUTRINO_MP: self.show_error_dialog("Neutrino at the moment not supported!") return @@ -1418,7 +1406,8 @@ class Application(Gtk.Application): return bq = self._bouquets.get(self._bq_selected, []) - IptvListConfigurationDialog(self._main_window, self._services, iptv_rows, bq, self._fav_model, profile).show() + IptvListConfigurationDialog(self._main_window, self._services, iptv_rows, bq, + self._fav_model, self._profile).show() @run_idle def on_remove_all_unavailable(self, item): @@ -1434,8 +1423,7 @@ class Application(Gtk.Application): return fav_bqt = self._bouquets.get(self._bq_selected, None) - prf = Profile(self._profile) - response = SearchUnavailableDialog(self._main_window, self._fav_model, fav_bqt, iptv_rows, prf).show() + response = SearchUnavailableDialog(self._main_window, self._fav_model, fav_bqt, iptv_rows, self._profile).show() if response: next(self.remove_favs(response, self._fav_model), False) @@ -1443,7 +1431,7 @@ class Application(Gtk.Application): @run_idle def on_epg_list_configuration(self, item): - if Profile(self._profile) is not Profile.ENIGMA_2: + if self._profile is not Profile.ENIGMA_2: self.show_error_dialog("Only Enigma2 is supported!") return @@ -1452,8 +1440,7 @@ class Application(Gtk.Application): return bq = self._bouquets.get(self._bq_selected) - profile = self._options.get(self._profile) - EpgDialog(self._main_window, profile, self._services, bq, self._fav_model, self._current_bq_name).show() + EpgDialog(self._main_window, self._settings, self._services, bq, self._fav_model, self._current_bq_name).show() # ***************** Import ********************# @@ -1462,11 +1449,11 @@ class Application(Gtk.Application): if not self._bq_selected: return - YtListImportDialog(self._main_window, Profile(self._profile), self.append_imported_services).show() + YtListImportDialog(self._main_window, self._profile, self.append_imported_services).show() def on_import_m3u(self, item): """ Imports iptv from m3u files. """ - response = get_chooser_dialog(self._main_window, self._options.get(self._profile), "*.m3u", "m3u files") + response = get_chooser_dialog(self._main_window, self._settings, "*.m3u", "m3u files") if response == Gtk.ResponseType.CANCEL: return @@ -1474,7 +1461,7 @@ class Application(Gtk.Application): self.show_error_dialog("No m3u file is selected!") return - channels = parse_m3u(response, Profile(self._profile)) + channels = parse_m3u(response, self._profile) if channels and self._bq_selected: self.append_imported_services(channels) @@ -1499,31 +1486,29 @@ class Application(Gtk.Application): self.show_error_dialog("This list does not contains IPTV streams!") return - response = show_dialog(DialogType.CHOOSER, self._main_window, options=self._options.get(self._profile)) + response = show_dialog(DialogType.CHOOSER, self._main_window, settings=self._settings) if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT): return try: bq = Bouquet(self._current_bq_name, None, bq_services, None, None) - export_to_m3u(response, bq, Profile(self._profile)) + export_to_m3u(response, bq, self._profile) except Exception as e: self.show_error_dialog(str(e)) else: show_dialog(DialogType.INFO, self._main_window, "Done!") def on_import_bouquet(self, item): - profile = Profile(self._profile) model, paths = self._bouquets_view.get_selection().get_selected_rows() if not paths: self.show_error_dialog("No selected item!") return - opts = self._options.get(self._profile) - appender = self.append_bouquet if profile is Profile.ENIGMA_2 else self.append_bouquets - import_bouquet(self._main_window, profile, model, paths[0], opts, self._services, appender) + appender = self.append_bouquet if self._profile is Profile.ENIGMA_2 else self.append_bouquets + import_bouquet(self._main_window, model, paths[0], self._settings, self._services, appender) def on_import_bouquets(self, item): - response = show_dialog(DialogType.CHOOSER, self._main_window, options=self._options.get(self._profile)) + response = show_dialog(DialogType.CHOOSER, self._main_window, settings=self._settings) if response in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT): return @@ -1531,7 +1516,7 @@ class Application(Gtk.Application): gen = self.append_imported_data(b, s) GLib.idle_add(lambda: next(gen, False)) - ImportDialog(self._main_window, response, Profile(self._profile), self._services.keys(), append).show() + ImportDialog(self._main_window, response, self._settings, self._services.keys(), append).show() def append_imported_data(self, bouquets, services): try: @@ -1544,10 +1529,7 @@ class Application(Gtk.Application): def on_backup_tool_show(self, item): """ Shows backup tool dialog """ - BackupDialog(self._main_window, - self._options, - Profile(self._profile), - self.open_data).show() + BackupDialog(self._main_window, self._settings, self.open_data).show() # ***************** Player *********************# @@ -1563,7 +1545,7 @@ class Application(Gtk.Application): self.show_error_dialog("Not allowed in this context!") return - url = get_iptv_url(row, Profile(self._profile)) + url = get_iptv_url(row, self._profile) self.update_player_buttons() if not url: return @@ -1673,14 +1655,12 @@ class Application(Gtk.Application): # ************************ HTTP API ****************************# @run_task def init_http_api(self): - prp = self._options.get(self._profile) - profile = Profile(self._profile) - self._fav_click_mode = FavClickMode(prp.get("fav_click_mode", FavClickMode.DISABLED)) - http_api_enable = prp.get("http_api_support", False) - status = all((http_api_enable, profile is Profile.ENIGMA_2, not self._receiver_info_box.get_visible())) + self._fav_click_mode = FavClickMode(self._settings.fav_click_mode) + http_api_enable = self._settings.http_api_support + status = all((http_api_enable, self._profile is Profile.ENIGMA_2, not self._receiver_info_box.get_visible())) GLib.idle_add(self._http_status_image.set_visible, status) - if profile is Profile.NEUTRINO_MP or not http_api_enable: + if self._profile is Profile.NEUTRINO_MP or not http_api_enable: self.update_info_boxes_visible(False) if self._http_api: self._http_api.close() @@ -1689,12 +1669,12 @@ class Application(Gtk.Application): return if not self._http_api: - self._http_api = HttpAPI(prp.get("host", "127.0.0.1"), prp.get("http_port", "80"), - prp.get("http_user", ""), prp.get("http_password", "")) + self._http_api = HttpAPI(self._settings.host, self._settings.http_port, + self._settings.http_user, self._settings.http_password) GLib.timeout_add_seconds(3, self.update_info, priority=GLib.PRIORITY_LOW) - self.init_send_to(http_api_enable and prp.get("enable_send_to", False)) + self.init_send_to(http_api_enable and self._settings.enable_send_to) @run_idle def init_send_to(self, enable): @@ -1803,22 +1783,26 @@ class Application(Gtk.Application): """ Updates positions values for the filtering function """ self._sat_positions.clear() sat_positions = set() - terrestrial = False - cable = False - for srv in self._services.values(): - tr_type = srv.transponder_type - if tr_type == "s" and srv.pos: - sat_positions.add(float(srv.pos)) - elif tr_type == "t": - terrestrial = True - elif tr_type == "c": - cable = True + if self._profile is Profile.ENIGMA_2: + terrestrial = False + cable = False - if terrestrial: - self._sat_positions.append("T") - if cable: - self._sat_positions.append("C") + for srv in self._services.values(): + tr_type = srv.transponder_type + if tr_type == "s" and srv.pos: + sat_positions.add(float(srv.pos)) + elif tr_type == "t": + terrestrial = True + elif tr_type == "c": + cable = True + + if terrestrial: + self._sat_positions.append("T") + if cable: + self._sat_positions.append("C") + elif self._profile is Profile.NEUTRINO_MP: + list(map(lambda s: sat_positions.add(float(s.pos)), filter(lambda s: s.pos, self._services.values()))) self._sat_positions.extend(map(str, sorted(sat_positions))) if self._filter_bar.is_visible(): @@ -1895,12 +1879,12 @@ class Application(Gtk.Application): self._fav_view, self._services, self._bouquets.get(self._bq_selected, None), - Profile(self._profile), + self._profile, Action.EDIT).show() self.on_locate_in_services(view) dialog = ServiceDetailsDialog(self._main_window, - self._options, + self._settings, self._services_view, self._fav_view, self._services, @@ -1910,7 +1894,7 @@ class Application(Gtk.Application): def on_services_add_new(self, item): dialog = ServiceDetailsDialog(self._main_window, - self._options, + self._settings, self._services_view, self._fav_view, self._services, @@ -2013,18 +1997,17 @@ class Application(Gtk.Application): @run_idle def on_picons_loader_show(self, item): ids = {} - if Profile(self._profile) is Profile.ENIGMA_2: + if self._profile is Profile.ENIGMA_2: for r in self._services_model: data = r[Column.SRV_PICON_ID].split("_") ids["{}:{}:{}".format(data[3], data[5], data[6])] = r[Column.SRV_PICON_ID] - dialog = PiconsDialog(self._main_window, self._options, ids, self._sat_positions, Profile(self._profile)) - dialog.show() + PiconsDialog(self._main_window, self._settings, ids, self._sat_positions).show() self.update_picons() @run_task def update_picons(self): - update_picons_data(self._options.get(self._profile).get("picons_dir_path"), self._picons) + update_picons_data(self._settings.picons_dir_path, self._picons) append_picons(self._picons, self._services_model) def on_assign_picon(self, view): @@ -2033,14 +2016,14 @@ class Application(Gtk.Application): self._fav_view, self._main_window, self._picons, - self._options.get(self._profile), + self._settings.get(self._profile), self._services) def on_remove_picon(self, view): remove_picon(self.get_target_view(view), self._services_view, self._fav_view, self._picons, - self._options.get(self._profile)) + self._settings.get(self._profile)) def on_reference_picon(self, view): """ Copying picon id to clipboard """ @@ -2050,7 +2033,7 @@ class Application(Gtk.Application): if show_dialog(DialogType.QUESTION, self._main_window) == Gtk.ResponseType.CANCEL: return - remove_all_unused_picons(self._options.get(self._profile), self._picons, self._services.values()) + remove_all_unused_picons(self._settings.get(self._profile), self._picons, self._services.values()) def get_target_view(self, view): return ViewTarget.SERVICES if Gtk.Buildable.get_name(view) == "services_tree_view" else ViewTarget.FAV @@ -2077,19 +2060,18 @@ class Application(Gtk.Application): def create_bouquets(self, g_type): gen_bouquets(self._services_view, self._bouquets_view, self._main_window, g_type, self._TV_TYPES, - Profile(self._profile), self.append_bouquet) + self._profile, self.append_bouquet) # ***************** Profile label *********************# def update_profile_label(self): - profile = Profile(self._profile) - if profile is Profile.ENIGMA_2: + if self._profile is Profile.ENIGMA_2: self._header_bar.set_subtitle("{} Enigma2 v.{}".format(get_message("Profile:"), self.get_format_version())) - elif profile is Profile.NEUTRINO_MP: + elif self._profile is Profile.NEUTRINO_MP: self._header_bar.set_subtitle("{} Neutrino-MP".format(get_message("Profile:"))) def get_format_version(self): - return 5 if self._options.get(self._profile).get("v5_support", False) else 4 + return 5 if self._settings.v5_support else 4 @run_idle def update_info_boxes_visible(self, visible): diff --git a/app/ui/main_helper.py b/app/ui/main_helper.py index e8972876..fe4b3692 100644 --- a/app/ui/main_helper.py +++ b/app/ui/main_helper.py @@ -9,7 +9,7 @@ from app.commons import run_task from app.eparser import Service from app.eparser.ecommons import Flag, BouquetService, Bouquet, BqType from app.eparser.enigma.bouquets import BqServiceType, to_bouquet_id -from app.properties import Profile +from app.settings import Profile from .uicommons import ViewTarget, BqGenType, Gtk, Gdk, HIDE_ICON, LOCKED_ICON, KeyboardKey, Column from .dialogs import show_dialog, DialogType, get_chooser_dialog, WaitDialog @@ -552,7 +552,7 @@ def get_bouquets_names(model): def update_entry_data(entry, dialog, options): """ Updates value in text entry from chooser dialog """ - response = show_dialog(dialog_type=DialogType.CHOOSER, transient=dialog, options=options) + response = show_dialog(dialog_type=DialogType.CHOOSER, transient=dialog, settings=options) if response not in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT): entry.set_text(response) return response diff --git a/app/ui/picons_downloader.py b/app/ui/picons_downloader.py index f89c31b8..7ed182d3 100644 --- a/app/ui/picons_downloader.py +++ b/app/ui/picons_downloader.py @@ -9,7 +9,7 @@ from gi.repository import GLib, GdkPixbuf from app.commons import run_idle, run_task from app.connections import upload_data, DownloadType from app.tools.picons import PiconsParser, parse_providers, Provider, convert_to -from app.properties import Profile +from app.settings import Profile from app.tools.satellites import SatellitesParser, SatelliteSource from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, TEXT_DOMAIN, TV_ICON from .dialogs import show_dialog, DialogType, get_message @@ -17,7 +17,7 @@ from .main_helper import update_entry_data, append_text_to_tview, scroll_to, on_ class PiconsDialog: - def __init__(self, transient, options, picon_ids, sat_positions, profile=Profile.ENIGMA_2): + def __init__(self, transient, settings, picon_ids, sat_positions): self._picon_ids = picon_ids self._sat_positions = sat_positions self._TMP_DIR = tempfile.gettempdir() + "/" @@ -85,16 +85,13 @@ class PiconsDialog: self._style_provider.load_from_path(UI_RESOURCES_PATH + "style.css") self._url_entry.get_style_context().add_provider_for_screen(Gdk.Screen.get_default(), self._style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER) - self._properties = options.get(profile.value) - self._profile = profile - self._ip_entry.set_text(self._properties.get("host", "")) - self._picons_entry.set_text(self._properties.get("picons_path", "")) - self._picons_path = self._properties.get("picons_dir_path", "") + self._settings = settings + self._profile = settings.profile + self._ip_entry.set_text(self._settings.host) + self._picons_entry.set_text(self._settings.picons_path) + self._picons_path = self._settings.picons_dir_path self._picons_dir_entry.set_text(self._picons_path) - self._enigma2_picons_path = self._picons_path - if profile is Profile.NEUTRINO_MP: - self._enigma2_picons_path = options.get(Profile.ENIGMA_2.value).get("picons_dir_path", "") if not len(self._picon_ids) and self._profile is Profile.ENIGMA_2: message = get_message("To automatically set the identifiers for picons,\n" "first load the required services list into the main application window.") @@ -280,9 +277,8 @@ class PiconsDialog: try: GLib.idle_add(self._expander.set_expanded, True) - upload_data(properties=self._properties, + upload_data(settings=self._settings, download_type=DownloadType.PICONS, - profile=self._profile, callback=self.append_output, done_callback=lambda: self.show_info_message(get_message("Done!"), Gtk.MessageType.INFO)) except OSError as e: @@ -332,9 +328,6 @@ class PiconsDialog: self._convert_button.set_visible(tab_num) self._send_button.set_visible(not tab_num) - if self._enigma2_path_button.get_filename() is None: - self._enigma2_path_button.set_current_folder(self._enigma2_picons_path) - @run_idle def on_convert(self, item): if show_dialog(DialogType.QUESTION, self._dialog) == Gtk.ResponseType.CANCEL: diff --git a/app/ui/satellites_dialog.py b/app/ui/satellites_dialog.py index 8cc7c420..80fc0bc0 100644 --- a/app/ui/satellites_dialog.py +++ b/app/ui/satellites_dialog.py @@ -24,9 +24,9 @@ def show_satellites_dialog(transient, options): class SatellitesDialog: _aggr = [None for x in range(9)] # aggregate - def __init__(self, transient, options): - self._data_path = options.get("data_dir_path") + "satellites.xml" - self._options = options + def __init__(self, transient, settings): + self._data_path = settings.data_dir_path + "satellites.xml" + self._settings = settings handlers = {"on_open": self.on_open, "on_remove": self.on_remove, @@ -55,7 +55,7 @@ class SatellitesDialog: self._window.set_transient_for(transient) self._sat_view = builder.get_object("satellites_editor_tree_view") # Setting the last size of the dialog window if it was saved - window_size = self._options.get("sat_editor_window_size", None) + window_size = self._settings.get("sat_editor_window_size") if window_size: self._window.resize(*window_size) @@ -75,8 +75,8 @@ class SatellitesDialog: def on_resize(self, window): """ Stores new size properties for dialog window after resize """ - if self._options: - self._options["sat_editor_window_size"] = window.get_size() + if self._settings: + self._settings.add("sat_editor_window_size", window.get_size()) @run_idle def on_quit(self, *args): @@ -100,7 +100,7 @@ class SatellitesDialog: file_filter.set_name("satellites.xml") response = show_dialog(dialog_type=DialogType.CHOOSER, transient=self._window, - options=self._options, + settings=self._settings, action_type=action, file_filter=file_filter) return response diff --git a/app/ui/service_details_dialog.py b/app/ui/service_details_dialog.py index 342fb1c7..0d2cffa0 100644 --- a/app/ui/service_details_dialog.py +++ b/app/ui/service_details_dialog.py @@ -6,7 +6,7 @@ from app.eparser import Service from app.eparser.ecommons import MODULATION, Inversion, ROLL_OFF, Pilot, Flag, Pids, POLARIZATION, \ get_key_by_value, get_value_by_name, FEC_DEFAULT, PLS_MODE, SERVICE_TYPE, T_MODULATION, C_MODULATION, TrType, \ SystemCable, T_SYSTEM, BANDWIDTH, TRANSMISSION_MODE, GUARD_INTERVAL, HIERARCHY, T_FEC -from app.properties import Profile +from app.settings import Profile from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, HIDE_ICON, TEXT_DOMAIN, CODED_ICON, Column, IS_GNOME_SESSION from .dialogs import show_dialog, DialogType, Action, get_dialogs_string from .main_helper import get_base_model @@ -34,7 +34,7 @@ class ServiceDetailsDialog: _DIGIT_ENTRY_NAME = "digit-entry" - def __init__(self, transient, options, srv_view, fav_view, services, bouquets, new_color, action=Action.EDIT): + def __init__(self, transient, settings, srv_view, fav_view, services, bouquets, new_color, action=Action.EDIT): handlers = {"on_system_changed": self.on_system_changed, "on_save": self.on_save, "on_create_new": self.on_create_new, @@ -52,10 +52,10 @@ class ServiceDetailsDialog: self._dialog = builder.get_object("service_details_dialog") self._dialog.set_transient_for(transient) - self._profile = Profile(options["profile"]) + self._profile = settings.profile self._tr_type = None - self._satellites_xml_path = options.get(self._profile.value)["data_dir_path"] + "satellites.xml" - self._picons_dir_path = options.get(self._profile.value)["picons_dir_path"] + self._satellites_xml_path = settings.data_dir_path + "satellites.xml" + self._picons_dir_path = settings.picons_dir_path self._services_view = srv_view self._fav_view = fav_view self._action = action diff --git a/app/ui/settings_dialog.py b/app/ui/settings_dialog.py index 6697e62d..7b0f0de2 100644 --- a/app/ui/settings_dialog.py +++ b/app/ui/settings_dialog.py @@ -2,8 +2,8 @@ from enum import Enum from app.commons import run_task, run_idle from app.connections import test_telnet, test_ftp, TestException, test_http -from app.properties import write_config, Profile, get_default_settings -from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, TEXT_DOMAIN, NEW_COLOR, EXTRA_COLOR, FavClickMode +from app.settings import Profile +from .uicommons import Gtk, Gdk, UI_RESOURCES_PATH, TEXT_DOMAIN, FavClickMode from .main_helper import update_entry_data @@ -19,7 +19,7 @@ class Property(Enum): class SettingsDialog: - def __init__(self, transient, options): + def __init__(self, transient, settings): handlers = {"on_field_icon_press": self.on_field_icon_press, "on_profile_changed": self.on_profile_changed, "on_reset": self.on_reset, @@ -89,11 +89,11 @@ class SettingsDialog: self._click_mode_zap_button.bind_property("sensitive", self._enable_send_to_switch, "sensitive") self._enable_send_to_switch.bind_property("sensitive", builder.get_object("enable_send_to_label"), "sensitive") self._extra_support_grid.bind_property("sensitive", builder.get_object("v5_support_grid"), "sensitive") - # Options - self._options = options - self._active_profile = options.get("profile") + # Settings + self._settings = settings + self._active_profile = settings.profile self.set_settings() - self.init_ui_elements(Profile(self._active_profile)) + self.init_ui_elements(self._active_profile) def init_ui_elements(self, profile): is_enigma_profile = profile is Profile.ENIGMA_2 @@ -115,106 +115,90 @@ class SettingsDialog: return response def on_field_icon_press(self, entry, icon, event_button): - update_entry_data(entry, self._dialog, self._options.get(self._options.get("profile"))) + update_entry_data(entry, self._dialog, self._settings.get(self._settings.get("profile"))) def on_profile_changed(self, item): profile = Profile.ENIGMA_2 if self._enigma_radio_button.get_active() else Profile.NEUTRINO_MP - self._active_profile = profile.value + self._active_profile = profile + self._settings.profile = profile self.set_settings() self.init_ui_elements(profile) - def set_profile(self, profile): - self._active_profile = profile.value - self.set_settings() - def on_reset(self, item): - def_settings = get_default_settings() - for key in def_settings: - current = self._options.get(key) - if type(current) is str: - continue - default = def_settings.get(key) - for k in default: - current[k] = default.get(k) + self._settings.reset() self.set_settings() def set_settings(self): - def_settings = get_default_settings().get(self._active_profile) - options = self._options.get(self._active_profile) + self._host_field.set_text(self._settings.host) + self._port_field.set_text(self._settings.port) + self._login_field.set_text(self._settings.user) + self._password_field.set_text(self._settings.password) + self._http_login_field.set_text(self._settings.http_user) + self._http_password_field.set_text(self._settings.http_password) + self._http_port_field.set_text(self._settings.http_port) + self._telnet_login_field.set_text(self._settings.telnet_user) + self._telnet_password_field.set_text(self._settings.telnet_password) + self._telnet_port_field.set_text(self._settings.telnet_port) + self._telnet_timeout_spin_button.set_value(self._settings.telnet_timeout) + self._services_field.set_text(self._settings.services_path) + self._user_bouquet_field.set_text(self._settings.user_bouquet_path) + self._satellites_xml_field.set_text(self._settings.satellites_xml_path) + self._picons_field.set_text(self._settings.picons_path) + self._data_dir_field.set_text(self._settings.data_dir_path) + self._picons_dir_field.set_text(self._settings.picons_dir_path) + self._backup_dir_field.set_text(self._settings.backup_dir_path) + self._before_save_switch.set_active(self._settings.backup_before_save) + self._before_downloading_switch.set_active(self._settings.backup_before_downloading) + self.set_fav_click_mode(self._settings.fav_click_mode) - self._host_field.set_text(options.get("host", def_settings["host"])) - self._port_field.set_text(options.get("port", def_settings["port"])) - self._login_field.set_text(options.get("user", def_settings["user"])) - self._password_field.set_text(options.get("password", def_settings["password"])) - self._http_login_field.set_text(options.get("http_user", def_settings["http_user"])) - self._http_password_field.set_text(options.get("http_password", def_settings["http_password"])) - self._http_port_field.set_text(options.get("http_port", def_settings["http_port"])) - self._telnet_login_field.set_text(options.get("telnet_user", def_settings["telnet_user"])) - self._telnet_password_field.set_text(options.get("telnet_password", def_settings["telnet_password"])) - self._telnet_port_field.set_text(options.get("telnet_port", def_settings["telnet_port"])) - self._telnet_timeout_spin_button.set_value(options.get("telnet_timeout", def_settings["telnet_timeout"])) - self._services_field.set_text(options.get("services_path", def_settings["services_path"])) - self._user_bouquet_field.set_text(options.get("user_bouquet_path", def_settings["user_bouquet_path"])) - self._satellites_xml_field.set_text(options.get("satellites_xml_path", def_settings["satellites_xml_path"])) - self._picons_field.set_text(options.get("picons_path", def_settings["picons_path"])) - self._data_dir_field.set_text(options.get("data_dir_path", def_settings["data_dir_path"])) - self._picons_dir_field.set_text(options.get("picons_dir_path", def_settings["picons_dir_path"])) - self._backup_dir_field.set_text(options.get("backup_dir_path", def_settings["backup_dir_path"])) - self._before_save_switch.set_active(options.get("backup_before_save", def_settings["backup_before_save"])) - self._before_downloading_switch.set_active(options.get("backup_before_downloading", - def_settings["backup_before_downloading"])) - self.set_fav_click_mode(options.get("fav_click_mode", def_settings["fav_click_mode"])) - - if Profile(self._active_profile) is Profile.ENIGMA_2: - self._support_ver5_switch.set_active(options.get("v5_support", False)) - self._support_http_api_switch.set_active(options.get("http_api_support", False)) - self._enable_y_dl_switch.set_active(options.get("enable_yt_dl", False)) - self._enable_send_to_switch.set_active(options.get("enable_send_to", False)) - self._set_color_switch.set_active(options.get("use_colors", False)) + if self._active_profile is Profile.ENIGMA_2: + self._support_ver5_switch.set_active(self._settings.v5_support) + self._support_http_api_switch.set_active(self._settings.http_api_support) + self._enable_y_dl_switch.set_active(self._settings.enable_yt_dl) + self._enable_send_to_switch.set_active(self._settings.enable_send_to) + self._set_color_switch.set_active(self._settings.use_colors) new_rgb = Gdk.RGBA() - new_rgb.parse(options.get("new_color", NEW_COLOR)) + new_rgb.parse(self._settings.new_color) extra_rgb = Gdk.RGBA() - extra_rgb.parse(options.get("extra_color", EXTRA_COLOR)) + extra_rgb.parse(self._settings.extra_color) self._new_color_button.set_rgba(new_rgb) self._extra_color_button.set_rgba(extra_rgb) def apply_settings(self, item=None): - profile = Profile.ENIGMA_2 if self._enigma_radio_button.get_active() else Profile.NEUTRINO_MP - self._active_profile = profile.value - self._options["profile"] = self._active_profile - options = self._options.get(self._active_profile) - options["host"] = self._host_field.get_text() - options["port"] = self._port_field.get_text() - options["user"] = self._login_field.get_text() - options["password"] = self._password_field.get_text() - options["http_user"] = self._http_login_field.get_text() - options["http_password"] = self._http_password_field.get_text() - options["http_port"] = self._http_port_field.get_text() - options["telnet_user"] = self._telnet_login_field.get_text() - options["telnet_password"] = self._telnet_password_field.get_text() - options["telnet_port"] = self._telnet_port_field.get_text() - options["telnet_timeout"] = int(self._telnet_timeout_spin_button.get_value()) - options["services_path"] = self._services_field.get_text() - options["user_bouquet_path"] = self._user_bouquet_field.get_text() - options["satellites_xml_path"] = self._satellites_xml_field.get_text() - options["picons_path"] = self._picons_field.get_text() - options["data_dir_path"] = self._data_dir_field.get_text() - options["picons_dir_path"] = self._picons_dir_field.get_text() - options["backup_dir_path"] = self._backup_dir_field.get_text() - options["backup_before_save"] = self._before_save_switch.get_active() - options["backup_before_downloading"] = self._before_downloading_switch.get_active() - options["fav_click_mode"] = self.get_fav_click_mode() + self._active_profile = Profile.ENIGMA_2 if self._enigma_radio_button.get_active() else Profile.NEUTRINO_MP + self._settings.profile = self._active_profile + self._settings.host = self._host_field.get_text() + self._settings.port = self._port_field.get_text() + self._settings.user = self._login_field.get_text() + self._settings.password = self._password_field.get_text() + self._settings.http_user = self._http_login_field.get_text() + self._settings.http_password = self._http_password_field.get_text() + self._settings.http_port = self._http_port_field.get_text() + self._settings.telnet_user = self._telnet_login_field.get_text() + self._settings.telnet_password = self._telnet_password_field.get_text() + self._settings.telnet_port = self._telnet_port_field.get_text() + self._settings.telnet_timeout = int(self._telnet_timeout_spin_button.get_value()) + self._settings.services_path = self._services_field.get_text() + self._settings.user_bouquet_path = self._user_bouquet_field.get_text() + self._settings.satellites_xml_path = self._satellites_xml_field.get_text() + self._settings.picons_path = self._picons_field.get_text() + self._settings.data_dir_path = self._data_dir_field.get_text() + self._settings.picons_dir_path = self._picons_dir_field.get_text() + self._settings.backup_dir_path = self._backup_dir_field.get_text() + self._settings.backup_before_save = self._before_save_switch.get_active() + self._settings.backup_before_downloading = self._before_downloading_switch.get_active() + self._settings.fav_click_mode = self.get_fav_click_mode() - if profile is Profile.ENIGMA_2: - options["use_colors"] = self._set_color_switch.get_active() - options["new_color"] = self._new_color_button.get_rgba().to_string() - options["extra_color"] = self._extra_color_button.get_rgba().to_string() - options["v5_support"] = self._support_ver5_switch.get_active() - options["http_api_support"] = self._support_http_api_switch.get_active() - options["enable_yt_dl"] = self._enable_y_dl_switch.get_active() - options["enable_send_to"] = self._enable_send_to_switch.get_active() + if self._active_profile is Profile.ENIGMA_2: + self._settings.use_colors = self._set_color_switch.get_active() + self._settings.new_color = self._new_color_button.get_rgba().to_string() + self._settings.extra_color = self._extra_color_button.get_rgba().to_string() + self._settings.v5_support = self._support_ver5_switch.get_active() + self._settings.http_api_support = self._support_http_api_switch.get_active() + self._settings.enable_yt_dl = self._enable_y_dl_switch.get_active() + self._settings.enable_send_to = self._enable_send_to_switch.get_active() - write_config(self._options) + self._settings.save() @run_task def on_connection_test(self, item): diff --git a/app/ui/uicommons.py b/app/ui/uicommons.py index 63c1f942..a222d354 100644 --- a/app/ui/uicommons.py +++ b/app/ui/uicommons.py @@ -29,10 +29,6 @@ TV_ICON = theme.load_icon("tv-symbolic", 16, 0) if theme.lookup_icon("tv-symboli IPTV_ICON = theme.load_icon("emblem-shared", 16, 0) if theme.lookup_icon("emblem-shared", 16, 0) else None EPG_ICON = theme.load_icon("gtk-index", 16, 0) if theme.lookup_icon("gtk-index", 16, 0) else None -# Colors -NEW_COLOR = "rgb(255,230,204)" # Color for new services in the main list -EXTRA_COLOR = "rgb(179,230,204)" # Color for services with a extra name for the bouquet - class KeyboardKey(Enum): """ The raw(hardware) codes of the keyboard keys. """ From f26f806147c3b21e0a38a721fd9a1b243b7e0881 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Pont?= Date: Sat, 14 Dec 2019 12:30:24 +0100 Subject: [PATCH 4/6] Spanish translation corrections (#3) * Spanish translation corrections --- .../locale/es/LC_MESSAGES/demon-editor.mo | Bin 15515 -> 15731 bytes po/es/demon-editor.po | 238 +++++++++--------- 2 files changed, 119 insertions(+), 119 deletions(-) diff --git a/deb/usr/share/locale/es/LC_MESSAGES/demon-editor.mo b/deb/usr/share/locale/es/LC_MESSAGES/demon-editor.mo index 6646b6d71d9630a4fc0139de0ab7517bf72a286e..1be1ad1e03db3a9cf39cfd15ff2cc06e35e35ff4 100644 GIT binary patch delta 4323 zcma);eQZ_r8OIMrKxip10;Qnz6a@OlrKNB5@>;N+-B8QRluaf%z4x>na(m9@oO@Al zvDrTw79uexd&!0@%^V3;5)zDTB*4~=nCX%k(QTQ=5glgnWm}LXV=i-_@44p|h>P1F zy`SIty*|(Pd7j^|KRocs!Bc;lGBnjNj1$WZqa2=wQ{X6^3txe^!OL(CyaH#yf5Itn zT8&}MgtOu8a0zUL4RAL623!QQ@D6w+=8xfBe4nW?hN2DLq+=Ex??Y|;52%fe+QP=O zpbS_Lf3Jkw`Cbht!^3bM4B=Eb0!!hGa54Nj)V%kg4EX@Afd8%?GK}do8tU){CZRm< zg7?9Pp%$EgQs^AiM!$w-@KVgnPzQbtZ->`m8!V|ej7hKqPK6ub0@wrPPI|iljPoNY&1Es*w zg?PfpF|R>M`6-+aXERF*)I)8sA^zS9b$|_Jcn*FY4nZ042dH(Ip+b2LN|{NC!olUR zl??PEV0wvigs0C->MEDCRWiCR^dmB!N@4|)fZ!ya#fo8sI;3~Ka zYWzsd=ON-6FN>UST%(~fsctI7dLvX!`=ALA#ToY;L>8EW2os492>D#TC14tN}{hL@Yse_ja~7Ojtfu*y&m^ph4OSl zd%?p}C_|RPIj|{acg%;O49da^_#~94$Dj;64&}g4q4pWNK;sS?uRuxpPCVg5C=aee zNm)+7WO)Tt%$Grpw?P@W4Jt==K`HkHtb<3O3C}{Ue+$Z>58!&$|5X~YtclE+4>v!ghX^LOjLsiMUaF*)7e2rmz zn+_AoqvxTNcp1)vZ$Q=ghftDVkNeBl7Rq)hRFd8UC4EoK-B5<+p``vM)cU7jB|HkJ zchPu>h9vzZ)IIP9G~p*u**gdKw6O`bVH-5zI;agFS$FyeGs@k#xV`trPT}{Q;HhWozQQM?1?>lKLZEVZuqMnRpram{CG(Nu~?h9_& zCVaeRU1y(@3ye)(eqY|s8TZ&ZE0eJUvoG$52gYXv<^jy`_d6-a3yjT{o3g`?YQ7?? z+iU#^emGLQeoDMJ{HS(u>F97*#_V@edu%_PQ(E~o7vW%&bEIKMt9Nqgbp`b25UaxGbnZQ;fG znpva6_dBliEBX~PW?V>C$`k3JDx9zltCI6)>3Z|7C zJCSj6cA_xBO?zhA%6UN|k%%-7!dDY5lQ(5N0vt|U`RJ55q~Q}Q?=I&=$98kJSuo|r zmF7dE!w=fN)9*0d)Sn&X#)eJD4af|9tTqtWLn3pJ#c#$=kqIsXrt3ti6$3}Uj>noM zVO3-0P_%T9b)aBjwEaNd^3#_8McWo4S=@K9IsgAp&bkB9WU?XeTH*1=d3WE)ji4yq zEq-Wz_;%w`CE|o8;yE0eO;v59!=1{Bz;R7yFq^RlkxgdbKX!J|*zRR4b=W3pnsWl9 zv(I;YZIo^5DX}u)xu%Yiv>pDvslK=9hn*cr5U8Zl>k#|GZ(!VO`y{$za!ax+(pk+5 zDA7XxlN?b;IJm01zR-;K3X;Y)o6Je)Qy6ih83*~ys-1FbMsv%~4B_l0GyARm%FiHc z`*s6?Jz%01$(OhLA~T}wQ2w&(0J-QXxyBbZU|nPr*;4Q>e5Sd&io40zHI=n|%gore zPu+3<1FeT5;V%L?Zu?x!W%ms-qzB%!oxE%T0dMos*hgZ?#EbF zCu*a-@5qm+pzM}LIryCxYmsETsf2oZF*RdSlXf=e`QgmgC1qRl4uLcxgq^JmS5bC3 zFO8{+bv`JL`Nb^J@r6aj1P`BTts1}dMp`p%apDJs0#xwgsO$c{aXxX9K;!1DX}fc1 zJSmgL_F{hC9Q5(=!01XlIHBGDS7&E*%{m8h?WU>S(XC7^TRA(UDeyX>u4^$=>iJ7I;z#(-_gM})D=*x#iYYSGn==iBT2eX`B1p$zF?M(_VKJOWVgfZ zsBQETP`vSd8kjx3J07eyb~yH6HgYE_vCvFbmEY21gEdKe>6Rh00scG^kJFXsi2kI__QCFjW#5+ty1;^1z;$<9!9wcny|cRm_s(2q z?%ndJUKOoP(3tkb2bdJGMn!B2si}<*V%?-o8WT-Snra&i#0OFvur}7D8vK7Vb9ad` zCO7vtbLPx>eCIo7{(k%$$1eV1X7Mhi)cJa)=HhcW6EEXpd>PB}O8 z=)JjkH~05q3$DQ#IE?f0VU+rr*gW3L{bLQP7*;q#!2${{pmg{%oP)nW8Q`zu=dYnO zbR9p6w@^CT+NjhL+=UhR37n0G@IIVCsdpL|;x|zS`oqSeQnR?YMuGS?%FO?X{W!NN zdSMtPLgOe6J&Kk1sn}B}9ezE2{%!2!{sPJbu3-gU$9wP{l=^duYn7_vVj0fDW|R)P zP%3W5I^2&Ep%W-G`Vw~FMPxP9pRgL|Hb))SqqN(C(%$_j@9#v3;C^Hbs%XU(z8Gsz zLU{(I!AmG1dljXDEAjm;l!%lQM;Z7+{211v%y1Ia(a5T>lKV|44Sg780FT7?M^I+?I7%{|MoG>e;Zl4B=|KG+Wdd)Z%=|V= zKQq_Kd#wL_E~G*NW#n5?LiQn)HTwvD5ci`*<{(PFJj%?EV-0>DSKvA1r(WWZAgRCM zGOS%6EonEBUTO&I=wE%3i{*G0rGcN~Dtr@bv8**xqeNm0$}Snk`M4itK!;Eo&Y{fk z49bk3K^f2ml!(58GLh?8ln~zLLK>*r5UqJN%6%(_$%rzL%_tonLzOBz^?GQ+mm zO(-MZi87E8T!h)!&*B2^zZT!0M_HoFCi4rzKhb)`^ZmK_Cy`^quh_;8a#`#n_kA%_!e?lss%|IIP1TO zi>rM49n#P}cq?F2R4{99+0D3V9t$c_&Kl>_N%;EXu(B`1unk13ilp>hHwQFX1xo zU%@&3TwLWsLUR*q@HR>k*7Qc%+k?_@KT3lSqs9?jiYI%YKQphgdS>e^HRO%>=2E?7 z7Bw{YYVEYqJ%JG7P+G?c^7jkN_khge}(Ieq~GA=I}m=_v0wQqIu zff}^3p4x8btxSf-!aMnk9t8T>bmOYebql7w@d5LhM!#&(yxX|B+^4GPX}WJlpPw3c zCd_D4a-o#fMI*3M`GS?v1LlRM`m&U{(o|#KZ#qzIg_S+MZ_n-oeFrJaAG6Y)Z;q}F z%6#+o+QjT_mTSp?j_Dz@rn#YNuj7tQ{@B&hxVD4*+5^OA}|d%_6_K*4;vx%z=| zE9F=^+g4EhNAtdwRKvdI2BWrbyF6&wF+8AlI2oS!CACB{M;OBzVZ@@rnQP76WkaT> z<$nGTw5+V`cT=95_b1Qmf@@B-tS~=lsbArwZEuU(;oGT%8njc+h?Dm8ZpS^WZQo}; z@3b7M7_w7^uytc4@(*fS8Fj`AK0}>+-c{RV>b@TEy$RbU1a?p=%K08;VUZrP@{{K? zPTo$Go~Erl%blQGR@$_#YcJnMm*()gN6TgT%wN{6sw#D?13GkUH*cGo^}6_w?K`7R z%Az=mq;}kZ^=Ad@)LthHGtb9u-;?ADBR(#*nOk6I>=c>ihLzoTQBqcR#PPImA1Tmw z*o>#gtz$YIrOsKtrN;`EpSJuuRV*!KDGOLHD*vzcOEpWQ$+=_yH3F$oa4otnt#Z7Y zd0XZZ<;+y{!k1@FkKd$QSDRC z=rK=hXeyS*ZRf@kOfabi92PbD4`MXYBXAP*Fo@|m$xDw*_kO8h)bq0}X=zs{OFLMH zjR$cjVs*wkMzWC}=|al!nNumh_O|Ua-)n2%Tc-xd>QQTge>=$8L|`x6WZJB27`k3l7x5k);zsB>`5=<(XS?B zB%I{dP$_xjp?S7_eVJvhwAWTm?GSB|qrSt&nboo0^mbVHg#AtJ1lePDF3+@f4Va&F zteiV&XW1h@<)XRKQM1<8c`wb_7++j0Aqulr_FMc$nAN7Mb47H59qi1kmOST`=-||G z%K3pF8r~YO23O{G=knrIJ|)%EWpKx3DTEv|{b@&rOU&=685iDB(ifhSPQXbpRmu?+ z?LkWHjBNfOaWtDrD)V$#v-xG$p=Eo+FMu>&`T*!rjvBW4KzH^0q0&czGgRhgPIM>A zC7$NF?yh#v<)qmW)=sK^k|f2M!1g6KI1>ZDCPa(F%I9n=t-D#-)3bcLthw|_#i@nk zRN@4%%#oh8bD~RMH+;NrpwXP`=`gSNw9Swa)G4zhS!a5ZJ-hpZyyRDY^4U~@G-2Q6 z3U)LR62{3o(E;;+s}b7p6f!?gF0Po~1;0yn&dAy=ULkL4H*Q;{XXSh+D`%N}WuggY z9L~F`xJ`c7d~V~3vf-zCm+J6?k@MWN9K4ECIp^4Ei!Gt4p3%dmvsXW4M~RWrVTV|Z-ZXF8P(2m>AdFx55hF>|e*nIW!H)m{ diff --git a/po/es/demon-editor.po b/po/es/demon-editor.po index 9b3a86cd..bf2adf36 100644 --- a/po/es/demon-editor.po +++ b/po/es/demon-editor.po @@ -57,16 +57,16 @@ msgid "Assign" msgstr "Assignar" msgid "Bouquet details" -msgstr "Detalles Ramo" +msgstr "Detalles bouquet" msgid "Bouquets" -msgstr "Ramos" +msgstr "Bouquets" msgid "Copy" msgstr "Copiar" msgid "Copy reference" -msgstr "Copia de Referencia" +msgstr "Copia de referencia" msgid "Download" msgstr "Descargar" @@ -78,7 +78,7 @@ msgid "Edit mаrker text" msgstr "Editar texto del mаrcador" msgid "FTP-transfer" -msgstr "Transferencia-FTP" +msgstr "Transferencia FTP" msgid "Global search" msgstr "Búsqueda Global" @@ -99,10 +99,10 @@ msgid "Import m3u file" msgstr "Importar fichero m3u" msgid "List configuration" -msgstr "Lista configuración" +msgstr "Listar configuración" msgid "Rename for this bouquet" -msgstr "Renombrar para este ramo" +msgstr "Renombrar para este bouquet" msgid "Set default name" msgstr "Establecer nombre predeterminado" @@ -114,7 +114,7 @@ msgid "Locate in services" msgstr "Buscar en servicios" msgid "Locked" -msgstr "Cerrado" +msgstr "Bloqueado" msgid "Move" msgstr "Mover" @@ -123,13 +123,13 @@ msgid "New" msgstr "Nuevo" msgid "New bouquet" -msgstr "Ramo nuevo" +msgstr "Bouquet nuevo" msgid "Create bouquet" -msgstr "Crear ramo" +msgstr "Crear bouquet" msgid "For current satellite" -msgstr "Para el Satélite actual" +msgstr "Para el satélite actual" msgid "For current package" msgstr "Para el paquete actual" @@ -138,7 +138,7 @@ msgid "For current type" msgstr "Para el tipo actual" msgid "For each satellite" -msgstr "Para cada Satélite" +msgstr "Para cada satélite" msgid "For each package" msgstr "Para cada paquete" @@ -150,25 +150,25 @@ msgid "Open" msgstr "Abrir" msgid "Parent lock On/Off Ctrl + L" -msgstr "Bloqueo parentesco Encender/Apagar Ctrl + L" +msgstr "Bloqueo parental Encender/Apagar Ctrl + L" msgid "Picons" msgstr "Picons" msgid "Picons downloader" -msgstr "Picons descargar" +msgstr "Descargar picons" msgid "Satellites downloader" -msgstr "Satélites descargar" +msgstr "Descargar satélites" msgid "Remove" -msgstr "Remover" +msgstr "Quitar" msgid "Remove all unavailable" -msgstr "Remover todo lo indisponible" +msgstr "Quitar todo lo indisponible" msgid "Satellites editor" -msgstr "Editor Satélites" +msgstr "Editor de satélites" msgid "Save" msgstr "Guardar" @@ -183,7 +183,7 @@ msgid "Services filter" msgstr "Filtro servicios" msgid "Settings" -msgstr "Configuraciones" +msgstr "Configuración" msgid "Up" msgstr "Arriba" @@ -198,7 +198,7 @@ msgid "All" msgstr "Todo" msgid "Are you sure?" -msgstr "Estás seguro?" +msgstr "¿Estás seguro?" msgid "Current data path:" msgstr "Ruta de datos actual:" @@ -207,13 +207,13 @@ msgid "Data:" msgstr "Datos:" msgid "Enigma2 channel and satellites list editor for GNU/Linux" -msgstr "Editor de Canales y Satélites Enigma2 para GNU/Linux" +msgstr "Editor de canales y satélites Enigma2 para GNU/Linux" msgid "Host:" msgstr "Anfitrión:" msgid "Loading data..." -msgstr "Cargar datos..." +msgstr "Cargando datos..." msgid "Receive" msgstr "Recibir" @@ -222,10 +222,10 @@ msgid "Receive files from receiver" msgstr "Recibir ficheros de su receptor" msgid "Receiver IP:" -msgstr "Receptor IP:" +msgstr "IP del receptor:" msgid "Remove unused bouquets" -msgstr "Remover ramos sin usar" +msgstr "Quitar bouquets sin usar" msgid "Reset profile" msgstr "Restablecer perfil" @@ -234,7 +234,7 @@ msgid "Satellites" msgstr "Satélites" msgid "Satellites.xml file:" -msgstr "Fichero Satellites.xml:" +msgstr "Fichero satellites.xml:" msgid "Selected" msgstr "Seleccionado" @@ -246,10 +246,10 @@ msgid "Send files to receiver" msgstr "Enviar ficheros al receptor" msgid "Services and Bouquets files:" -msgstr "Ficheros de Servicios y ramos:" +msgstr "Ficheros de servicios y bouquets:" msgid "User bouquet files:" -msgstr "Importar ficheros de ramos:" +msgstr "Importar ficheros de bouquets:" msgid "Extra:" msgstr "Extra:" @@ -266,16 +266,16 @@ msgstr "Todos los tipos" # Streams player msgid "Play" -msgstr "Play" +msgstr "Reproducir" msgid "Stop playback" msgstr "Detener la reproducción" msgid "Previous stream in the list" -msgstr "Secuencia anterior en la lista" +msgstr "Anterior flujo en la lista" msgid "Next stream in the list" -msgstr "Secuencia siguiente en la lista" +msgstr "Siguiente flujo en la lista" msgid "Toggle in fullscreen" msgstr "Cambiar a pantalla completa" @@ -285,7 +285,7 @@ msgstr "Cerrar" # Picons dialog msgid "Load providers" -msgstr "Cargar Proveedores" +msgstr "Cargar proveedores" msgid "Providers" msgstr "Proveedores" @@ -300,19 +300,19 @@ msgid "Resize:" msgstr "Redimensionar:" msgid "Current picons path:" -msgstr "Ruta actual Picons:" +msgstr "Ruta actual picons:" msgid "Receiver picons path:" msgstr "Ruta picons receptor:" msgid "Picons download tool" -msgstr "Picons herramiento de descarga" +msgstr "Herramienta de descarga de picons" msgid "Transfer to receiver" msgstr "Transferir al receptor" msgid "Downloader" -msgstr "Descargador" +msgstr "Programa de descarga" msgid "Converter" msgstr "Convertidor" @@ -324,31 +324,31 @@ msgid "Path to save:" msgstr "Ruta para guardar:" msgid "Path to Enigma2 picons:" -msgstr "Ruta a picons Enigma2:" +msgstr "Ruta a picons de Enigma2:" msgid "Specify the correct position value for the provider!" -msgstr "Especifique la posición correcta para el proveedor!" +msgstr "¡Especifique el valor correcto de la posición del proveedor!" msgid "Converter between name formats" msgstr "Conversor entre formatos de nombre" msgid "Receive picons for providers" -msgstr "Recibir picons para proovedor" +msgstr "Recibir picons de proveedores" msgid "Load satellite providers." -msgstr "Cargar proovedores Satélite." +msgstr "Cargar proveedores de satélite." msgid "" "To automatically set the identifiers for picons,\n" "first load the required services list into the main application window." msgstr "" -"Para configurar automáticamente los identificadores para picons, \n" -"primero cargue la lista de serviços requeridos en la ventana principal." +"Para configurar automáticamente los identificadores para picons,\n" +"cargue primero la lista de servicios requeridos en la ventana principal." # Satellites editor msgid "Satellites edit tool" -msgstr "Editor de Satélites" +msgstr "Editor de satélites" msgid "Add" msgstr "Añadir" @@ -360,10 +360,10 @@ msgid "Transponder" msgstr "Transpondedor" msgid "Satellite properties:" -msgstr "Propiedades del Satélite:" +msgstr "Propiedades del satélite:" msgid "Transponder properties:" -msgstr "Propiedades del Transpondedor:" +msgstr "Propiedades del transpondedor:" msgid "Name" msgstr "Nombre" @@ -373,30 +373,30 @@ msgstr "Posición" # Satellites update dialog msgid "Satellites update" -msgstr "Actualisar Satélite" +msgstr "Actualizar satélites" msgid "Remove selection" -msgstr "Remover selección" +msgstr "Quitar selección" # Service details dialog msgid "Service data:" msgstr "Datos servicio:" msgid "Transponder data:" -msgstr "Datos Transpondedor:" +msgstr "Datos transpondedor:" msgid "Service data" msgstr "Datos servicio" msgid "Transponder details" -msgstr "Detalles Transpondedor" +msgstr "Detalles transpondedor" msgid "" "Changes will be applied to all services of this transponder!\n" "Continue?" msgstr "" "Los cambios se aplicarán a todos los servicios de este transpondedor!\n" -"Continuar?" +"¿Continuar?" msgid "Reference" msgstr "Referencia" @@ -408,10 +408,10 @@ msgid "Flags:" msgstr "Flags:" msgid "Delays (ms):" -msgstr "Retraso (mc)" +msgstr "Retraso (ms)" msgid "Bitstream" -msgstr "Secuencia de Bits" +msgstr "Secuencia de bits" msgid "Description" msgstr "Descripción" @@ -420,10 +420,10 @@ msgid "Source:" msgstr "Fuente:" msgid "Cancel" -msgstr "Annular" +msgstr "Cancelar" msgid "Update" -msgstr "Actualisar" +msgstr "Actualizar" msgid "Filter" msgstr "Filtrar" @@ -433,7 +433,7 @@ msgstr "Buscar" # IPTV dialog msgid "Stream data" -msgstr "Datos de la Secuencia" +msgstr "Transmitir flujo" # IPTV list configuration dialog msgid "Starting values" @@ -443,7 +443,7 @@ msgid "Reset to default" msgstr "Restablecer a predeterminado" msgid "IPTV streams list configuration" -msgstr "Configurar lista de Secuencias IPTV" +msgstr "Configurar lista de flujos IPTV" # Settings dialog msgid "Preferences" @@ -456,7 +456,7 @@ msgid "Timeout between commands in seconds" msgstr "Tiempo de espera entre comandos en segundos" msgid "Timeout:" -msgstr "Time-out:" +msgstr "Tiempo de espera:" msgid "Login:" msgstr "Usuario:" @@ -471,68 +471,68 @@ msgid "Picons:" msgstr "Picons:" msgid "Port:" -msgstr "Puerta:" +msgstr "Puerto:" msgid "Data path:" msgstr "Ruta de datos:" msgid "Picons path:" -msgstr "Ruta de Picons:" +msgstr "Ruta de picons:" msgid "Network settings:" msgstr "Configuración de red:" msgid "STB file paths:" -msgstr "Ruta de ficherors STB:" +msgstr "Rutas de ficheros del receptor:" msgid "Local file paths:" -msgstr "Ruta de ficheros local:" +msgstr "Rutas de ficheros local:" # Dialogs messages msgid "Error. No bouquet is selected!" -msgstr "Error. Ningún ramo está seleccionado!" +msgstr "Error. ¡Ningún bouquet seleccionado!" msgid "This item is not allowed to be removed!" -msgstr "Este artículo no puede ser eliminado!" +msgstr "¡Este elemento no puede ser quitado!" msgid "This item is not allowed to edit!" -msgstr "Este artículo no puede ser editado!" +msgstr "¡Este elemento no puede ser editado!" msgid "Not allowed in this context!" -msgstr "No permitido en este contexto!" +msgstr "¡No permitido en este contexto!" msgid "Please, download files from receiver or setup your path for read data!" -msgstr "Por favor, descargue archivos desde el receptor o configure su ruta para leer los datos!" +msgstr "Por favor, descargue ficheros desde el receptor o configure la ruta para leer los datos!" msgid "Reading data error!" -msgstr "Error de lectura de datos!" +msgstr "¡Error de lectura de datos!" msgid "No m3u file is selected!" -msgstr "Ningún archivo m3u ha sido seleccionado!" +msgstr "¡No se ha seleccionado ningún fichero m3u!" msgid "Not implemented yet!" -msgstr "Aun no implementado!" +msgstr "¡Aún sin implementar!" msgid "The text of marker is empty, please try again!" -msgstr "El texto del marcador está vacío, inténtalo de nuevo!" +msgstr "¡El texto del marcador está vacío, inténtalo de nuevo!" msgid "Please, select only one item!" -msgstr "Por favor, seleccione solo un elemento!" +msgstr "¡Por favor, seleccione sólo un elemento!" msgid "No png file is selected!" -msgstr "Ningún fichero png seleccionado!" +msgstr "¡No se ha seleccionado ningún fichero png!" msgid "No reference is present!" -msgstr "Ninguna referencia presente!" +msgstr "¡Ninguna referencia presente!" msgid "No selected item!" -msgstr "Ningún elemento seleccionado!" +msgstr "¡Ningún elemento seleccionado!" msgid "The task is already running!" -msgstr "La tarea ya se está ejecutando!" +msgstr "¡La tarea ya se está ejecutando!" msgid "Done!" -msgstr "Hecho!" +msgstr "¡Hecho!" msgid "Please, wait..." msgstr "Por favor, espere..." @@ -541,50 +541,50 @@ msgid "Resizing..." msgstr "Redimensionando..." msgid "Select paths!" -msgstr "Seleccione rutas!" +msgstr "¡Seleccione rutas!" msgid "No satellite is selected!" -msgstr "Ningún Satélite seleccionado!" +msgstr "¡Ningún satélite seleccionado!" msgid "Please, select only one satellite!" -msgstr "Seleccione solo un Satélite!" +msgstr "¡Seleccione sólo un Satélite!" msgid "Please check your parameters and try again." -msgstr "Por favor revise sus parámetros y vuelva a intentar!" +msgstr "¡Por favor revise sus parámetros y vuelva a intentarlo!" msgid "No satellites.xml file is selected!" -msgstr "Ningún satellites.xml seleccionado!" +msgstr "¡Ningún satellites.xml seleccionado!" msgid "Error. Verify the data!" -msgstr "Error. Revise sus datos!" +msgstr "Error. ¡Revise los datos!" msgid "Operation not allowed in this context!" -msgstr "Operación no permitida en este contexto!" +msgstr "¡Operación no permitida en este contexto!" msgid "No VLC is found. Check that it is installed!" -msgstr "VLC no encontrado. Verifica si está instalado!" +msgstr "VLC no encontrado. ¡Verifique que está instalado!" # Search unavailable streams dialog msgid "Please wait, streams testing in progress..." -msgstr "Por favor espera una prueba de las secuencias..." +msgstr "Por favor espere, hay una prueba de flujo en progreso..." msgid "Found" msgstr "Encontrado" msgid "unavailable streams." -msgstr "Secuencias no presentes" +msgstr "Flujos no presentes." msgid "No changes required!" -msgstr "ningún cambio requerido!" +msgstr "¡Ningún cambio requerido!" msgid "This list does not contains IPTV streams!" -msgstr "La lista no contiene secuencias IPTV!" +msgstr "¡La lista no contiene flujos IPTV!" msgid "New empty configuration" msgstr "Nueva configuración vacía" msgid "No data to save!" -msgstr "No hay datos para guardar!" +msgstr "¡No hay datos que guardar!" msgid "Network" msgstr "Red" @@ -596,19 +596,19 @@ msgid "Program" msgstr "Programa" msgid "Backup:" -msgstr "Backup:" +msgstr "Copia de seguridad:" msgid "Backup" -msgstr "Backup" +msgstr "Copia de seguridad" msgid "Backups" -msgstr "Backups" +msgstr "Copias de seguridad" msgid "Backup path:" -msgstr "Ruta del backup:" +msgstr "Ruta de la copia de seguridad:" msgid "Restore bouquets" -msgstr "Restaurar ramos" +msgstr "Restaurar bouquets" msgid "Restore all" msgstr "Restaurar todo" @@ -620,19 +620,19 @@ msgid "Before downloading from the receiver" msgstr "Antes de recibir del receptor" msgid "Set background color for the services" -msgstr "Determinar color de fondo para servicios" +msgstr "Determinar color de fondo de los servicios" msgid "Marked as new:" msgstr "Marcado como nuevo:" msgid "With an extra name in the bouquet:" -msgstr "Con nombre adicional en ramo:" +msgstr "Con nombre adicional en bouquet:" msgid "Select" msgstr "Seleccione" msgid "About" -msgstr "Sobre" +msgstr "Acerca de" msgid "Exit" msgstr "Salir" @@ -645,19 +645,19 @@ msgid "Import" msgstr "Importar" msgid "Bouquet" -msgstr "Ramo" +msgstr "Bouquet" msgid "Bouquets and services" -msgstr "Ramos y servicios" +msgstr "Bouquets y servicios" msgid "The main list does not contain services for this bouquet!" -msgstr "La lista principal no contiene servicios para este ramo!" +msgstr "¡La lista principal no contiene servicios para este bouquet!" msgid "No bouquet file is selected!" -msgstr "Nigún fichero de ramo ha sido seleccionado!" +msgstr "¡No se ha seleccionado nigún fichero de bouquet!" msgid "Remove all unused" -msgstr "Quite todos los" +msgstr "Quitar todos sin usar" msgid "Test" msgstr "Prueba" @@ -672,7 +672,7 @@ msgid "Zap" msgstr "Zapear" msgid "Play stream" -msgstr "Reproducir secuencia" +msgstr "Reproducir flujo" msgid "Disabled" msgstr "Desactivado" @@ -684,16 +684,16 @@ msgid "Enable HTTP API (experimental)" msgstr "Habilitar API HTTP (experimental)" msgid "Switch(zap) the channel(Ctrl + Z)" -msgstr "Cambiar (ZAP) el canal (Ctrl + Z)" +msgstr "Poner el canal (Ctrl + Z)" msgid "Switch the channel and watch in the program(Ctrl + W)" -msgstr "Cambiar el canal y ver en el programa (Ctrl + W)" +msgstr "Poner el canal y ver en el programa (Ctrl + W)" msgid "Play IPTV or other stream in the program(Ctrl + P)" msgstr "Reproducir IPTV u otro flujo en el programa (Ctrl + P)" msgid "Export to m3u" -msgstr "Exportar hacia m3u" +msgstr "Exportar a m3u" msgid "EPG configuration" msgstr "Configuración EPG" @@ -705,61 +705,61 @@ msgid "EPG source" msgstr "Fuente EPG" msgid "Service names source:" -msgstr "Nombre de servicio fuente:" +msgstr "Origen nombres de servicio:" msgid "Main service list" msgstr "Lista principal de servicios:" msgid "XML file" -msgstr "Archivo XML" +msgstr "Fichero XML" msgid "Use web source" msgstr "Usar fuente web" msgid "Url to *.xml.gz file:" -msgstr "URL del archivo *.xml.gz:" +msgstr "URL del fichero *.xml.gz:" msgid "Enable filtering" -msgstr "Habilitar filtrar" +msgstr "Habilitar filtrado" msgid "Filter by presence in the epg.dat file." -msgstr "Filtrar por presencia del archivo epg.dat." +msgstr "Filtrar según presencia del fichero epg.dat." msgid "Paths to the epg.dat file:" -msgstr "Ruta al archivo epg.dat:" +msgstr "Ruta al fichero epg.dat:" msgid "Local path:" msgstr "Ruta local:" msgid "STB path:" -msgstr "Ruta STB:" +msgstr "Ruta receptor:" msgid "Update on start" -msgstr "Actualisar al iniciar" +msgstr "Actualizar al inicio" msgid "Auto configuration by service names." -msgstr "Auto configuración por nombres de servicios." +msgstr "Auto configuración según nombres de servicios." msgid "Save list to xml." msgstr "Guardar como XML." msgid "Download XML file error." -msgstr "Error bajando archivo XML." +msgstr "Error bajando fichero XML." msgid "Unsupported file type:" -msgstr "Archivo no supportado:" +msgstr "Fichero no soportado:" msgid "Unpacking data error." -msgstr "Error abriende datos." +msgstr "Error abriendo datos." msgid "XML parsing error:" -msgstr "Error analisando XML:" +msgstr "Error analizando XML:" msgid "Count of successfully configured services:" msgstr "Número de servicios configurados con éxito:" msgid "Current epg.dat file does not contains references for the services of this bouquet!" -msgstr "Archivo epg.dat actual no tiene referencias a servicios de este ramo!" +msgstr "¡El fichero epg.dat actual no tiene referencias a servicios de este bouquet!" msgid "Use HTTP" msgstr "Utilizar HTTP" @@ -771,10 +771,10 @@ msgid "Import YouTube playlist" msgstr "Importar lista de reproducción de YouTube" msgid "Found a link to the YouTube resource!\nTry to get a direct link to the video?" -msgstr "Encontré un enlace al recurso de YouTube!\nIntentar obtener un enlace directo al video?" +msgstr "¡Encontrado enlace al recurso de YouTube!\n¿Intentar obtener un enlace directo al vídeo?" msgid "Playlist import" msgstr "Importar lista de reproducción" msgid "Getting link error:" -msgstr "Recibido Link error:" \ No newline at end of file +msgstr "Error en el enlace:" From a4800ace1449d7146687a3ea30d134c914854699 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Sun, 15 Dec 2019 19:01:27 +0300 Subject: [PATCH 5/6] small clean after refactoring of the settings --- app/ui/main_app_window.py | 6 +++--- app/ui/main_helper.py | 26 ++++++++++++++------------ app/ui/picons_downloader.py | 2 +- app/ui/settings_dialog.py | 2 +- 4 files changed, 19 insertions(+), 17 deletions(-) diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 49fa4d5c..80bb5157 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -2016,14 +2016,14 @@ class Application(Gtk.Application): self._fav_view, self._main_window, self._picons, - self._settings.get(self._profile), + self._settings, self._services) def on_remove_picon(self, view): remove_picon(self.get_target_view(view), self._services_view, self._fav_view, self._picons, - self._settings.get(self._profile)) + self._settings) def on_reference_picon(self, view): """ Copying picon id to clipboard """ @@ -2033,7 +2033,7 @@ class Application(Gtk.Application): if show_dialog(DialogType.QUESTION, self._main_window) == Gtk.ResponseType.CANCEL: return - remove_all_unused_picons(self._settings.get(self._profile), self._picons, self._services.values()) + remove_all_unused_picons(self._settings, self._picons, self._services.values()) def get_target_view(self, view): return ViewTarget.SERVICES if Gtk.Buildable.get_name(view) == "services_tree_view" else ViewTarget.FAV diff --git a/app/ui/main_helper.py b/app/ui/main_helper.py index fe4b3692..bc874db9 100644 --- a/app/ui/main_helper.py +++ b/app/ui/main_helper.py @@ -360,13 +360,13 @@ def append_picons(picons, model): GLib.idle_add(lambda: next(app, False), priority=GLib.PRIORITY_LOW) -def assign_picon(target, srv_view, fav_view, transient, picons, options, services): +def assign_picon(target, srv_view, fav_view, transient, picons, settings, services): view = srv_view if target is ViewTarget.SERVICES else fav_view model, paths = view.get_selection().get_selected_rows() if not is_only_one_item_selected(paths, transient): return - response = get_chooser_dialog(transient, options, "*.png", "png files") + response = get_chooser_dialog(transient, settings, "*.png", "png files") if response == Gtk.ResponseType.CANCEL: return @@ -381,8 +381,10 @@ def assign_picon(target, srv_view, fav_view, transient, picons, options, service picon_id = services.get(fav_id)[Column.SRV_PICON_ID] if picon_id: - picon_file = options.get("picons_dir_path") + picon_id if os.path.isfile(response): + picons_path = settings.picons_dir_path + os.makedirs(os.path.dirname(picons_path), exist_ok=True) + picon_file = picons_path + picon_id shutil.copy(response, picon_file) picon = get_picon_pixbuf(picon_file) picons[picon_id] = picon @@ -400,7 +402,7 @@ def set_picon(fav_id, model, picon, fav_id_pos, picon_pos): break -def remove_picon(target, srv_view, fav_view, picons, options): +def remove_picon(target, srv_view, fav_view, picons, settings): view = srv_view if target is ViewTarget.SERVICES else fav_view model, paths = view.get_selection().get_selected_rows() model = get_base_model(model) @@ -431,7 +433,7 @@ def remove_picon(target, srv_view, fav_view, picons, options): fav_view.get_model().foreach(remove) if target is ViewTarget.SERVICES else get_base_model( srv_view.get_model()).foreach(remove) - remove_picons(options, picon_ids, picons) + remove_picons(settings, picon_ids, picons) def copy_picon_reference(target, view, services, clipboard, transient): @@ -455,15 +457,15 @@ def copy_picon_reference(target, view, services, clipboard, transient): show_dialog(DialogType.ERROR, transient, "No reference is present!") -def remove_all_unused_picons(options, picons, services): +def remove_all_unused_picons(settings, picons, services): ids = {s.picon_id for s in services} pcs = list(filter(lambda x: x not in ids, picons)) - remove_picons(options, pcs, picons) + remove_picons(settings, pcs, picons) -def remove_picons(options, picon_ids, picons): - pions_path = options.get("picons_dir_path") - backup_path = options.get("backup_dir_path") + "picons/" +def remove_picons(settings, picon_ids, picons): + pions_path = settings.picons_dir_path + backup_path = settings.backup_dir_path + "picons/" os.makedirs(os.path.dirname(backup_path), exist_ok=True) for p_id in picon_ids: picons[p_id] = None @@ -550,9 +552,9 @@ def get_bouquets_names(model): # ***************** Others *********************# -def update_entry_data(entry, dialog, options): +def update_entry_data(entry, dialog, settings): """ Updates value in text entry from chooser dialog """ - response = show_dialog(dialog_type=DialogType.CHOOSER, transient=dialog, settings=options) + response = show_dialog(dialog_type=DialogType.CHOOSER, transient=dialog, settings=settings) if response not in (Gtk.ResponseType.CANCEL, Gtk.ResponseType.DELETE_EVENT): entry.set_text(response) return response diff --git a/app/ui/picons_downloader.py b/app/ui/picons_downloader.py index 7ed182d3..0ef967f0 100644 --- a/app/ui/picons_downloader.py +++ b/app/ui/picons_downloader.py @@ -294,7 +294,7 @@ class PiconsDialog: self._message_label.set_text(text) def on_picons_dir_open(self, entry, icon, event_button): - update_entry_data(entry, self._dialog, options={"data_dir_path": self._picons_path}) + update_entry_data(entry, self._dialog, settings=self._settings) @run_idle def on_selected_toggled(self, toggle, path): diff --git a/app/ui/settings_dialog.py b/app/ui/settings_dialog.py index 7b0f0de2..a86d7eb1 100644 --- a/app/ui/settings_dialog.py +++ b/app/ui/settings_dialog.py @@ -115,7 +115,7 @@ class SettingsDialog: return response def on_field_icon_press(self, entry, icon, event_button): - update_entry_data(entry, self._dialog, self._settings.get(self._settings.get("profile"))) + update_entry_data(entry, self._dialog, self._settings) def on_profile_changed(self, item): profile = Profile.ENIGMA_2 if self._enigma_radio_button.get_active() else Profile.NEUTRINO_MP From a8b40472390a7a7c7e48f9e151eb81f4dcffe8d3 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Mon, 16 Dec 2019 09:57:27 +0300 Subject: [PATCH 6/6] player refactoring --- app/tools/media.py | 71 ++++++++++++++++++++++++++------------- app/ui/main_app_window.py | 15 +++++---- 2 files changed, 57 insertions(+), 29 deletions(-) diff --git a/app/tools/media.py b/app/tools/media.py index fc76ec69..2df7c3ea 100644 --- a/app/tools/media.py +++ b/app/tools/media.py @@ -1,32 +1,37 @@ -from app.commons import run_task -from app.tools import vlc -from app.tools.vlc import EventType +import sys +from app.commons import run_task, log class Player: - _VLC_INSTANCE = None + __VLC_INSTANCE = None - def __init__(self, rewind_callback=None, position_callback=None): - self._is_playing = False - self._player = self.get_vlc_instance() - ev_mgr = self._player.event_manager() + def __init__(self, rewind_callback, position_callback): + try: + from app.tools import vlc + from app.tools.vlc import EventType + except OSError as e: + log("{}: Load library error: {}".format(__class__.__name__, e)) + else: + self._is_playing = False + args = "--quiet {}".format("" if sys.platform == "darwin" else "--no-xlib") + self._player = vlc.Instance(args).media_player_new() + ev_mgr = self._player.event_manager() - if rewind_callback: - # TODO look other EventType options - ev_mgr.event_attach(EventType.MediaPlayerBuffering, - lambda e, p: rewind_callback(p.get_media().get_duration()), - self._player) - if position_callback: - ev_mgr.event_attach(EventType.MediaPlayerTimeChanged, - lambda e, p: position_callback(p.get_time()), - self._player) + if rewind_callback: + # TODO look other EventType options + ev_mgr.event_attach(EventType.MediaPlayerBuffering, + lambda et, p: rewind_callback(p.get_media().get_duration()), + self._player) + if position_callback: + ev_mgr.event_attach(EventType.MediaPlayerTimeChanged, + lambda et, p: position_callback(p.get_time()), + self._player) - @staticmethod - def get_vlc_instance(): - if Player._VLC_INSTANCE: - return Player._VLC_INSTANCE - _VLC_INSTANCE = vlc.Instance("--quiet --no-xlib").media_player_new() - return _VLC_INSTANCE + @classmethod + def get_instance(cls, rewind_callback=None, position_callback=None): + if not cls.__VLC_INSTANCE: + cls.__VLC_INSTANCE = Player(rewind_callback, position_callback) + return cls.__VLC_INSTANCE @run_task def play(self, mrl=None): @@ -57,6 +62,26 @@ class Player: def set_xwindow(self, xid): self._player.set_xwindow(xid) + def set_nso(self, widget): + """ Used on MacOS to set NSObject. + + Based on gtkvlc.py[get_window_pointer] example from here: + https://github.com/oaubert/python-vlc/tree/master/examples + """ + try: + import ctypes + g_dll = ctypes.CDLL("libgdk-3.0.dylib") + except OSError as e: + log("{}: Load library error: {}".format(__class__.__name__, e)) + else: + get_nsview = g_dll.gdk_quartz_window_get_nsview + get_nsview.restype, get_nsview.argtypes = ctypes.c_void_p, [ctypes.c_void_p] + ctypes.pythonapi.PyCapsule_GetPointer.restype = ctypes.c_void_p + ctypes.pythonapi.PyCapsule_GetPointer.argtypes = [ctypes.py_object] + # Get the C void* pointer to the window + pointer = ctypes.pythonapi.PyCapsule_GetPointer(widget.get_window().__gpointer__, None) + self._player.set_nsobject(get_nsview(pointer)) + def set_mrl(self, mrl): self._player.set_mrl(mrl) diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py index 80bb5157..0a9ed14e 100644 --- a/app/ui/main_app_window.py +++ b/app/ui/main_app_window.py @@ -1554,8 +1554,8 @@ class Application(Gtk.Application): def play(self, url): if not self._player: try: - self._player = Player(rewind_callback=self.on_player_duration_changed, - position_callback=self.on_player_time_changed) + self._player = Player.get_instance(rewind_callback=self.on_player_duration_changed, + position_callback=self.on_player_time_changed) except (NameError, AttributeError): self.show_error_dialog("No VLC is found. Check that it is installed!") return @@ -1592,8 +1592,7 @@ class Application(Gtk.Application): def on_player_close(self, item=None): if self._player: - self._player.release() - self._player = None + self._player.stop() GLib.idle_add(self._player_box.set_visible, False, priority=GLib.PRIORITY_LOW) @lru_cache(maxsize=1) @@ -1615,8 +1614,12 @@ class Application(Gtk.Application): return "{}{:02d}:{:02d}".format(str(h) + ":" if h else "", m, s) def on_drawing_area_realize(self, widget): - self._drawing_area_xid = widget.get_window().get_xid() - self._player.set_xwindow(self._drawing_area_xid) + if sys.platform == "darwin": + self._player.set_nso(widget) + else: + self._drawing_area_xid = widget.get_window().get_xid() + print(self._drawing_area_xid) + self._player.set_xwindow(self._drawing_area_xid) def on_player_drawing_area_draw(self, widget, cr): """ Used for black background drawing in the player drawing area.