The branch, twofactorauth has been updated via 203b7cb65ff266f47508681fdce91fb1a345ad17 (commit) from 13272248f26b3242bb1e7f13fbe17e35519667d3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: x2go/client.py | 6 +++ x2go/pulseaudio.py | 104 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 x2go/pulseaudio.py The diff of changes is: diff --git a/x2go/client.py b/x2go/client.py index 46d4fea..2ad5e71 100644 --- a/x2go/client.py +++ b/x2go/client.py @@ -162,6 +162,7 @@ import x2go.backends.printing as printing if _X2GOCLIENT_OS == 'Windows': from xserver import X2goClientXConfig, X2goXServer + from pulseaudio import X2goPulseAudio class X2goClient(object): @@ -187,11 +188,13 @@ class X2goClient(object): sessions_rootdir=None, ssh_rootdir=None, start_xserver=False, + start_pulseaudio=False, use_listsessions_cache=False, auto_update_listsessions_cache=False, auto_update_sessionregistry=False, auto_register_sessions=False, refresh_interval=5, + pulseaudio_installdir=os.path.join(os.getcwd(), 'pulseaudio'), logger=None, loglevel=log.loglevel_DEFAULT): """\ @param logger: you can pass an L{X2goLogger} object to the @@ -259,6 +262,9 @@ class X2goClient(object): # presume the running XServer listens on :0 os.environ.update({'DISPLAY': 'localhost:0'}) + if _X2GOCLIENT_OS == 'Windows' and start_pulseaudio: + self.pulseaudio = X2goPulseAudio(path=self.pulseaudio_installdir, logger=self.logger) + self.auto_register_sessions = auto_register_sessions self.session_registry = X2goSessionRegistry(self, logger=self.logger) self.session_guardian = X2goSessionGuardian(self, auto_update_listsessions_cache=auto_update_listsessions_cache & use_listsessions_cache, diff --git a/x2go/pulseaudio.py b/x2go/pulseaudio.py new file mode 100644 index 0000000..d163afa --- /dev/null +++ b/x2go/pulseaudio.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- + +# Copyright (C) 2010-2011 by Mike Gabriel <m.gabriel@das-netzwerkteam.de> +# +# Python X2go is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Python X2go is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. +# +# This code was initially written by: +# 2010 Dick Kniep <dick.kniep@lindix.nl> +# +# Other contributors: +# none so far + +__NAME__ = 'x2gopulseaudio-pylib' + +from defaults import X2GOCLIENT_OS as _X2GOCLIENT_OS +if _X2GOCLIENT_OS == 'Windows': + import wmi + +# modules +import os +import subprocess +import threading +import gevent +import copy + +# Python X2go modules +import log + +class X2goPulseAudio(threading.Thread): + """ + This class controls the Pulse Audio daemon. + """ + + def __init__(self, path=None, logger=None, loglevel=log.loglevel_DEFAULT): + """\ + STILL UNDOCUMENTED + + """ + if _X2GOCLIENT_OS not in ("Windows"): + import exceptions + class OSNotSupportedException(exceptions.StandardError): pass + raise OSNotSupportedException('classes of x2go.pulseaudio module are for Windows only') + + if logger is None: + self.logger = log.X2goLogger(loglevel=loglevel) + else: + self.logger = copy.deepcopy(logger) + self.logger.tag = __NAME__ + + self.path = path + self._keepalive = None + + threading.Thread.__init__(self) + self.daemon = True + self.start() + + def run(self): + """\ + STILL UNDOCUMENTED + + """ + self._keepalive = True + cmd = 'pulseaudio' + if self.path: + cmd = os.path.join(self.path, cmd) + cmd_options = [ + '-n', + '-L module-native-protocol-tcp port=4713', + '-L module-esound-protocol-tcp port=16001', + '-L module-waveout', + ] + cmd_line = [cmd] + cmd_line.extend(cmd_options) + self.logger('starting PulsaAudio server with command line: %s' % ' '.join(cmd_line), loglevel=log.loglevel_DEBUG) + p = subprocess.Popen(cmd_line, shell=False) + while self._keepalive: + gevent.sleep(1) + self.logger('terminating running PulseAudio server', loglevel=log.loglevel_DEBUG) + try: + p.terminate() + except WindowsError: + pass + + def stop_thread(self): + """\ + STILL UNDOCUMENTED + + """ + self.logger('stop_thread() method has been called', loglevel=log.loglevel_DEBUG) + self._keepalive = False + hooks/post-receive -- python-x2go.git (Python X2Go Client API) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "python-x2go.git" (Python X2Go Client API).