chiark
/
gitweb
/
~yarrgweb
/
ypp-sc-tools.db-live.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make --debug-fd work
[ypp-sc-tools.db-live.git]
/
yoweb-scrape
diff --git
a/yoweb-scrape
b/yoweb-scrape
index 43b95225638fe6731938b7d1682adb10d83c33ba..577b3b8d50234349760b2c5b4b58d6da5aba461a 100755
(executable)
--- a/
yoweb-scrape
+++ b/
yoweb-scrape
@@
-39,7
+39,7
@@
max_pirate_namelen = 12
def debug(m):
if opts.debug > 0:
def debug(m):
if opts.debug > 0:
- print m
+ print
>>opts.debug_file,
m
def format_time_interval(ti):
if ti < 120: return '%d:%02d' % (ti / 60, ti % 60)
def format_time_interval(ti):
if ti < 120: return '%d:%02d' % (ti / 60, ti % 60)
@@
-677,6
+677,8
@@
class ChatLogTracker:
if self._lbuf.endswith('\n'):
self.chatline(self._lbuf.rstrip())
self._lbuf = ''
if self._lbuf.endswith('\n'):
self.chatline(self._lbuf.rstrip())
self._lbuf = ''
+ if opts.debug >= 2:
+ debug(self.__str__())
if progress: progress.caughtup()
def changed(self):
if progress: progress.caughtup()
def changed(self):
@@
-759,9
+761,9
@@
def prep_chat_log(args, bu,
progress.show_init(pirate, fetcher.ocean)
track = ChatLogTracker(myself, logfn)
progress.show_init(pirate, fetcher.ocean)
track = ChatLogTracker(myself, logfn)
- opts.debug -=
1
+ opts.debug -=
2
track.catchup(progress)
track.catchup(progress)
- opts.debug +=
1
+ opts.debug +=
2
track.force_redisplay()
track.force_redisplay()
@@
-913,7
+915,7
@@
display modes (for --display) apply to ship-aid:
help='cache yoweb pages in DIR')
ao('-D','--debug', action='count', dest='debug', default=0,
help='enable debugging output')
help='cache yoweb pages in DIR')
ao('-D','--debug', action='count', dest='debug', default=0,
help='enable debugging output')
- ao('--debug-fd',
action='cou
nt', dest='debug_fd',
+ ao('--debug-fd',
type='i
nt', dest='debug_fd',
help='write any debugging output to specified fd')
ao('-q','--quiet', action='store_true', dest='quiet',
help='suppress warning output')
help='write any debugging output to specified fd')
ao('-q','--quiet', action='store_true', dest='quiet',
help='suppress warning output')
@@
-933,7
+935,9
@@
display modes (for --display) apply to ship-aid:
pa.error('need a mode argument')
if opts.debug_fd is not None:
pa.error('need a mode argument')
if opts.debug_fd is not None:
- opts.debug_file = fdopen(opts.debug_fd, 'w')
+ opts.debug_file = os.fdopen(opts.debug_fd, 'w')
+ else:
+ opts.debug_file = sys.stdout
mode = args[0]
mode_fn_name = 'do_' + mode.replace('_','#').replace('-','_')
mode = args[0]
mode_fn_name = 'do_' + mode.replace('_','#').replace('-','_')