def __init__(self, parent_win): PreferencesProvider.__init__(self) PlayerSource.__init__(self, parent_win) self.host = None self.control = None self.data = None self.fifo = None self.fifo_name = None self.io_watcher_id = None
def close(self): PlayerSource.close(self) if self.io_watcher_id is not None: gobject.source_remove(self.io_watcher_id) self.io_watcher_id = None if self.data: self.data.close() self.data = None if self.control: self.control.close() self.control = None if self.fifo: self.fifo.close() self.fifo = None self.fifo_name = None return True
def open(self, url, options=None): PlayerSource.open(self, url, options) if url.startswith("mythstreamer://"): url = "http://" + url[len("mythstreamer://"):] d = urlparse.urlparse(url) params = {} for k, v in parse_qsl(d.query): t = params.setdefault(k, []) t.append(v) self.host = d.hostname try: self.control = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.control.settimeout(self.timeout) self.control.connect((d.hostname, d.port)) except Exception, e: self.close() msg = "Could not connect to GMythStreamer at %s:%s: %s" % \ (d.hostname, d.port, e) self._log_and_raise(msg) return False
def __init__(self, parent_win): PreferencesProvider.__init__(self) PlayerSource.__init__(self, parent_win)