def parse_lib(conf,opt,val): """parse the lib into a list""" val = val.replace('\n','') # paths are separated by semi-colon entries = util.split_strip(val,';') lib = [] for entry in entries: if entry=='': continue if ',' in entry: if not util.has_module('smbc'): conf.log('warning','Ignoring share "%s" (missing smbc)' % entry) continue # samba share parameters are separated by comma params = util.split_strip(entry,',') item = {'server':params[0], 'share':params[1], 'username':None, 'password':None} if len(params)>2: item['username'] = params[2] if len(params)>3: item['password'] = Password(params[3]) else: item = entry lib.append(item) return lib
def valid(conf, echo): """check for lxml""" if (not echo) or util.has_module('lxml'): return True conf.log('error', "Can't find module lxml; link_echo will be disabled") return False
def valid(conf,echo): """check for lxml""" if (not echo) or util.has_module('lxml'): return True conf.log('error',"Can't find module lxml; link_echo will be disabled") return False
def init(bot): """create the pending_room variable to enable chat responses""" bot.add_var('pending_room', {}) bot.add_var('pending_tell', [], persist=True) bot.add_var('triggers', {}) try: bot.triggers = trigger_read(bot) except Exception as e: log.error('Failed to parse trigger_file') log.debug(e.message) if not util.has_module('lxml'): log.debug("Can't find module lxml; unregistering link_echo hook") del bot.hooks['group']['room.link_echo']
def init(bot): """create the pending_room variable to enable chat responses""" bot.add_var('pending_room',{}) bot.add_var('pending_tell',[],persist=True) bot.add_var('triggers',{}) try: bot.triggers = trigger_read(bot) except Exception as e: log.error('Failed to parse trigger_file') log.debug(e.message) if not util.has_module('lxml'): log.debug("Can't find module lxml; unregistering link_echo hook") del bot.hooks['group']['room.link_echo']
def init(bot): """create libraries and threading""" bot.add_var('lib_last_rebuilt') bot.add_var('lib_last_elapsed',0) bot.add_var('lib_audio_dir') bot.add_var('lib_audio_file') bot.add_var('lib_video_dir') bot.add_var('lib_video_file') bot.add_var('lib_lock',threading.Lock()) bot.add_var('lib_last_op') bot.add_var('lib_pending_send',Queue.Queue()) if os.path.isfile(bot.opt('library.file')): Library(bot,None,['load']).run() #bot.run_cmd('library',['load']) else: Library(bot,None,['rebuild']).run() #bot.run_cmd('library',['rebuild']) if util.has_module('smbc'): import smbc # account for older versions of pysmbc that don't specify these FILE = 8 if hasattr(smbc,'FILE'): FILE = smbc.FILE DIR = 7 if hasattr(smbc,'DIR'): DIR = smbc.DIR bot.add_var('smbc_file',FILE) bot.add_var('smbc_dir',DIR) else: log.warning("Can't find module smbc; network shares will be disabled") # check for filename unicode support enc = sys.getfilesystemencoding() if enc!='UTF-8': log.warning('Missing unicode support (filesystemencoding=%s)' % enc) log.warning(' more details: ' 'https://github.com/TheSchwa/sibyl/wiki/Library' '#unicode-considerations') bot.error('Unicode file names not supported','library')