Ejemplo n.º 1
0
    def __init__(self, config, core):
        super(MpdFrontend, self).__init__()

        self.hostname = network.format_hostname(config['mpd']['hostname'])
        self.port = config['mpd']['port']

        self.zeroconf_name = config['mpd']['zeroconf']
        self.zeroconf_service = None

        try:
            network.Server(
                self.hostname, self.port,
                protocol=session.MpdSession,
                protocol_kwargs={
                    'config': config,
                    'core': core,
                },
                max_connections=config['mpd']['max_connections'],
                timeout=config['mpd']['connection_timeout'])
        except IOError as error:
            raise exceptions.FrontendError(
                'MPD server startup failed: %s' %
                encoding.locale_decode(error))

        logger.info('MPD server running at [%s]:%s', self.hostname, self.port)
Ejemplo n.º 2
0
    def __init__(self):
        hostname = network.format_hostname(settings.MPD_SERVER_HOSTNAME)
        port = settings.MPD_SERVER_PORT

        try:
            network.Server(hostname,
                           port,
                           protocol=MpdSession,
                           max_connections=settings.MPD_SERVER_MAX_CONNECTIONS)
        except IOError, e:
            logger.error(u'MPD server startup failed: %s', e)
            sys.exit(1)
Ejemplo n.º 3
0
    def __init__(self):
        super(MpdFrontend, self).__init__()
        hostname = network.format_hostname(settings.MPD_SERVER_HOSTNAME)
        port = settings.MPD_SERVER_PORT

        try:
            network.Server(hostname,
                           port,
                           protocol=MpdSession,
                           max_connections=settings.MPD_SERVER_MAX_CONNECTIONS)
        except IOError as error:
            logger.error(u'MPD server startup failed: %s',
                         locale_decode(error))
            sys.exit(1)

        logger.info(u'MPD server running at [%s]:%s', hostname, port)
Ejemplo n.º 4
0
    def __init__(self, core):
        super(MpdFrontend, self).__init__()
        hostname = network.format_hostname(settings.MPD_SERVER_HOSTNAME)
        port = settings.MPD_SERVER_PORT

        # NOTE kwargs dict keys must be bytestrings to work on Python < 2.6.5
        # See https://github.com/mopidy/mopidy/issues/302 for details.
        try:
            network.Server(hostname,
                           port,
                           protocol=session.MpdSession,
                           protocol_kwargs={b'core': core},
                           max_connections=settings.MPD_SERVER_MAX_CONNECTIONS,
                           timeout=settings.MPD_SERVER_CONNECTION_TIMEOUT)
        except IOError as error:
            logger.error('MPD server startup failed: %s',
                         encoding.locale_decode(error))
            sys.exit(1)

        logger.info('MPD server running at [%s]:%s', hostname, port)
Ejemplo n.º 5
0
    def __init__(self, config, core):
        super(MpdFrontend, self).__init__()
        hostname = network.format_hostname(config['mpd']['hostname'])
        port = config['mpd']['port']

        try:
            network.Server(
                hostname, port,
                protocol=session.MpdSession,
                protocol_kwargs={
                    'config': config,
                    'core': core,
                },
                max_connections=config['mpd']['max_connections'],
                timeout=config['mpd']['connection_timeout'])
        except IOError as error:
            logger.error(
                'MPD server startup failed: %s',
                encoding.locale_decode(error))
            sys.exit(1)

        logger.info('MPD server running at [%s]:%s', hostname, port)
Ejemplo n.º 6
0
    def __init__(self, config, core):
        super(MpdFrontend, self).__init__()
        hostname = network.format_hostname(config['mpd']['hostname'])
        port = config['mpd']['port']

        # NOTE kwargs dict keys must be bytestrings to work on Python < 2.6.5
        # See https://github.com/mopidy/mopidy/issues/302 for details.
        try:
            network.Server(hostname,
                           port,
                           protocol=session.MpdSession,
                           protocol_kwargs={
                               b'config': config,
                               b'core': core,
                           },
                           max_connections=config['mpd']['max_connections'],
                           timeout=config['mpd']['connection_timeout'])
        except IOError as error:
            logger.error('MPD server startup failed: %s',
                         encoding.locale_decode(error))
            sys.exit(1)

        logger.info('MPD server running at [%s]:%s', hostname, port)