def start_services(self): for key, value in settings.services.iteritems(): settings.services[key].running = False for file in [file for file in os.listdir('services') if file.startswith( 'web__') and file.endswith('.py')]: service_name = file.replace('.py', '') if not service_name in self.assigned_services: continue self.services.append(service_name) settings.services[service_name] = Service(service_name) settings.services[service_name].daemon = True settings.services[service_name].start()
def start_services(self): for key, value in settings.services.iteritems(): settings.services[key].running = False for file in [file for file in os.listdir('services') if file.startswith( 'web__') and file.endswith('.py')]: service_name = file.replace('.py', '') if not service_name in self.assigned_services: continue self.services.append(service_name) settings.services[service_name] = Service(service_name) settings.services[service_name].daemon = True settings.services[service_name].start()
def start_services(self): for file in [file for file in os.listdir('services') if file.startswith( 'web__') and file.endswith('.py')]: service_name = file.replace('.py', '') if not service_name in self.services: self.new_services += 1 self.services.append(service_name) settings.services[service_name] = Service(service_name) settings.services[service_name].daemon = True settings.services[service_name].start() settings.services[service_name].read_urls() settings.services[service_name].get_data() settings.irc_bot.send('PRIVMSG', 'Found {new_services} new services'.format( new_services=self.new_services), settings.irc_channel_bot) self.new_services = 0 if not settings.get_urls: settings.get_urls = Urls() settings.get_urls.daemon = True settings.get_urls.start() self.distribute_services()
def start_services(self): for file in [file for file in os.listdir('services') if file.startswith( 'web__') and file.endswith('.py')]: service_name = file.replace('.py', '') if not service_name in self.services: self.new_services += 1 self.services.append(service_name) settings.services[service_name] = Service(service_name) settings.services[service_name].daemon = True settings.services[service_name].start() settings.services[service_name].read_urls() settings.services[service_name].get_data() settings.irc_bot.send('PRIVMSG', 'Found {new_services} new services'.format( new_services=self.new_services), settings.irc_channel_bot) self.new_services = 0 if not settings.get_urls: settings.get_urls = Urls() settings.get_urls.daemon = True settings.get_urls.start() self.distribute_services()
def saveDataFile(dataName, content): file.replace('/data/' + dataName + "_en.csv", csv.stringify(content, 'en')) file.replace('/data/' + dataName + "_de.csv", csv.stringify(content, 'de'))
'sortie': sortie } def saveDataFile(dataName, content): file.replace('/data/' + dataName + "_en.csv", csv.stringify(content, 'en')) file.replace('/data/' + dataName + "_de.csv", csv.stringify(content, 'de')) print("Create Data Directory") if not os.path.exists("data"): os.mkdir("data") allData = [] for key, value in parsers.items(): print("Loading " + key) content = value.load(DROPTABLE_URL) if len(content) == 0: raise RuntimeError("Error, " + key + " table is empty.") print("Writing " + str(len(content)) + " lines to /data/" + key + ".csv") saveDataFile(key, content) for line in content: line['type'] = key allData.append(line) print("Writing files to /data/all.csv") saveDataFile('all', allData) file.replace('/data/.updateTime', datetime.datetime.now().strftime("%Y-%m-%dT%T%z"))