Source

pythaules / pythaules / database / backend.py

Full commit
#!/usr/bin/env python

from SimpleXMLRPCServer import SimpleXMLRPCServer as Server

from pythaules.conf import PythaulesConf as conf
import pythaules.database
import pythaules.database.database as database

class PythaulesBackend(object):
    def __init__(self):
        print "Welcome to Pythaules database backend"
        print "Establishing connection to database..."
        self.__db = database.collectionDatabase(conf.PATH_TO_DB_FILE)
        #print "Creating empty database..."
        #self.__db.createEmptyDatabase()
        #print "Filling database..."
        #self.__db.fillDatabase(["/home/sven/collection", "/home/sven/Hoerspiele", "/home/sven/Musike_Kevin"])
        ##ct = collection.Collection(db, ["artist", "album"], "Sven's collection")
        
        print "Starting XML-RPC server..."
        self.__server = Server(addr = (conf.BACKEND_DB_RPC['host'], conf.BACKEND_DB_RPC['port']), allow_none = True, logRequests=False)
        self.__server.register_instance(self.__db)
        print "At your service..."
        self.__server.serve_forever()