Esempio n. 1
0
def main():
    from gonium.fdm import ED_get
    import argparse

    p = argparse.ArgumentParser()
    p.add_argument('--cd')

    args = p.parse_args()

    if (args.cd):
        os.chdir(args.cd)

    ed = ED_get()()

    fg = FileGazer(ed)
    fg.start_stdio()
    fg.scan_dir(b'.')

    ed.event_loop()
Esempio n. 2
0
def _selftest(target, nick='Zanaffar', username='******', realname=b'? ? ?',
      channels=()):
   import pprint
   from gonium.fdm import ED_get
   from gonium._debugging import streamlogger_setup
   
   logging.getLogger('IRCClientConnection').setLevel(20)
   
   def link():
      for chan in channels:
         irccc._send_msg(b'JOIN', chan)
   
   streamlogger_setup()
   ed = ED_get()()
   irccc = IRCClientConnection.irc_build_sock_connect(ed, target, nick=nick,
      username=username, realname=realname)
   irccc.em_shutdown.new_listener(ccd(1)(ed.shutdown))
   irccc.em_link_finish.new_listener(ccd(1)(link))
   
   query_specs = (
      (2, b'LINKS'),
      (3, b'LIST'),
      (4, b'MAP')
   )
   
   queries_answered = 0
   def cb_print(query):
      nonlocal queries_answered
      print(query)
      pprint.pprint(query.rv[:20])
      queries_answered += 1
      if (queries_answered == len(query_specs)):
         print('All done. Shutting down.')
         ed.shutdown()
   
   for (d, cmd) in query_specs:
      ed.set_timer(d, irccc.put_msg, args=(IRCMessage(None, cmd,()), cb_print))
   
   if (channels):
      #__ChanEcho(irccc, channels[0])
      pass
   
   ed.event_loop()
Esempio n. 3
0
def main():
  from gonium.fdm import ED_get
  import argparse

  p = argparse.ArgumentParser()
  p.add_argument('--cd')

  args = p.parse_args()

  if (args.cd):
    os.chdir(args.cd)

  ed = ED_get()()

  fg = FileGazer(ed)
  fg.start_stdio()
  fg.scan_dir(b'.')
  
  ed.event_loop()