# Copyright (C) 2008, Nick Knouf, Bruno Vianna, and Luis Ayuso # # This file is part of Fluid Nexus # # Fluid Nexus 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 2 # of the License, or (at your option) any later version. # # This program 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 Street, Fifth Floor, Boston, MA 02110-1301 USA. # Standard library imports import sys import os import socket import select import md5 import time import thread # @HACK@ # Adding paths to find the modules sys.path.append('.') sys.path.append(os.getcwd()) sys.path.append('C:\\System\\Apps\\Python\\my\\') sys.path.append('E:\\System\\Apps\\Python\\my\\') sys.path.append('C:\\Python') sys.path.append('E:\\Python') from logger import Logger from database import FluidNexusDatabase from FluidNexusNetworking import FluidNexusClient # Series 60 specific imports try: # On phone? import e32 import e32db # @SEMI-HACK@ # At the moment, set global variable that determines where our data is going to live try: os.listdir('E:') dataPath = u'E:\\System\\Data\\FluidNexusData' except OSError: dataPath = u'C:\\System\\Data\\FluidNexusData' # Setup our data path if not os.path.isdir(dataPath): os.makedirs(dataPath) # Setup logging and redirect standard input and output log = Logger(dataPath + u'\\FluidNexus.log', prefix = 'FluidNexus Networking: ') sys.stderr = sys.stdout = log onPhone = True except ImportError: #from s60Compat import e32 dataPath = '.' log = Logger(os.path.join(dataPath, u'FluidNexus.log'), prefix = 'FluidNexusServer: ') #sys.stderr = sys.stdout = log onPhone = False if __name__ == "__main__": try: database = FluidNexusDatabase() client = FluidNexusClient(database = database) client.runLightblue() #thread.start_new_thread(client.runLightblue, ()) except: log.print_exception_trace()