# encoding: utf-8 # vi:si:et:sw=4:sts=4:ts=4 import os import sys import gobject gobject.threads_init() from twisted.internet import glib2reactor glib2reactor.install() from twisted.web.server import Site from twisted.internet import reactor from backend import Backend from server import Server import api from version import __version__ def db_path(): #use something like http://pypi.python.org/pypi/appdirs/? if sys.platform == 'darwin': path = os.path.expanduser('~/Library/Application Support/pandora/local.db') elif sys.platform == 'win32': path = os.path.expanduser('~\\AppData\\pandora\\local.db') else: path = os.path.expanduser('~/.local/share/pandora/local.db') return path def main(config): base = os.path.abspath(os.path.dirname(__file__)) backend = Backend(config) root = Server(base, backend) site = Site(root) port = int(backend.get('port', '2620')) interface = backend.get('port', '127.0.0.1') reactor.listenTCP(port, site, interface=interface) reactor.run()