tree checksum vpatch file split hunks
all signers: asciilifeform diana_coman lobbes
antecedents: logotron_genesis.kv line_wraps.kv
press order:
patch:
(5 . 3)(5 . 4)
5 589783 irssi2tmsr diana_coman "Converter of irssi logs to the tmsr format used by the logotron. Added authors in MANIFEST.TXT."
6 590448 uniturds_etc asciilifeform "Phf's algo for uniturd digestion; cosmetic improvements to WWW displayer."
7 590458 line_wraps asciilifeform "Trinque's method to force wrap in long lines; Removed some commented rubbish from reader.py."
8 590714 znc2tmsr_etc lobbes "Converter of znc logs to the tmsr format used by the logotron. Small fixes to eat_dump.py."
- 5614D6523B1512656953C12732DB5DAA56B49288251B879427A9B8E33DA7DB95847E441D2AD007896182C5ACB27F0ED808B072A25C12B4789CF85CC186E68F68(62 . 9)(62 . 16)
13 if speaker == "*":
14 spl = payload.split(' ', 1)
15 speaker = spl[0]
16 payload = spl[1]
17 try:
18 payload = spl[1]
19 except IndexError:
20 payload = ""
21 self_speak = True
22
23
24 ## Handle uniturds using the phf algorithm
25 payload = payload.decode('latin-1')
26 payload = payload.encode('utf-8')
27
28 ## Put in DB:
29 try:
30 exec_db('''insert into loglines (idx, t, chan, era, speaker, self, payload)
-(0 . 0)(1 . 58)
35 #!/usr/bin/env python
36
37 from os import listdir
38 from os.path import isfile, join
39 from datetime import datetime
40
41 # Set the dir you'd like to eat, the suffix of each file, and the filename to shit into
42 dir_to_eat = '/path/to/eat/dir/'
43 dir_files_end_with = '.log'
44 shit_into = '/path/to/shitfile.txt'
45
46 # Set the top limit of the line index
47 archive_top_inx = 999999
48
49 # Leave these variables alone
50 archive_bottom_inx = 0
51 dir_data = [f for f in listdir(dir_to_eat) if isfile(join(dir_to_eat, f))]
52 logline_array = []
53
54 # Sort the dir_data in chronological order
55 date_format = '%Y-%m-%d'
56 dir_data_chrono = []
57 for logfile in dir_data:
58 if dir_files_end_with in logfile:
59 logdate = logfile.replace('.log','')
60 dir_data_chrono.append(logdate)
61 dir_data_chrono = sorted(dir_data_chrono, key=lambda d:datetime.strptime(d,date_format))
62
63 # Shit lines into a single file
64 def shit_lines(line_inx):
65 f = open(shit_into, 'a')
66 for line in logline_array:
67 indexed_line = ('%s;%s') % (line_inx,line)
68 f.write(indexed_line)
69 line_inx = line_inx + 1
70 f.close()
71
72 # Eat each file in the dir
73 for logfile in dir_data_chrono:
74 logfile_full_path = join(dir_to_eat,('%s.log' % logfile))
75 with open(logfile_full_path, 'r') as logfile_data:
76 for logline in logfile_data:
77 znc_timestamp = ('%s %s') % (logfile, logline[1:9])
78 znc_datetimestamp = datetime.strptime(znc_timestamp, '%Y-%m-%d %H:%M:%S')
79 epoch_datetimestamp = znc_datetimestamp.strftime('%s')
80 if '<' in logline[11:12]:
81 #normal line
82 speaker = logline[12:logline.find('>')]
83 logline_array.append(('%s;%s;%s') % (epoch_datetimestamp, speaker, logline[logline.find('>')+2:]))
84 elif '*' in logline[12:13]:
85 #connectolade; ignore
86 pass
87 else:
88 #action
89 logline_array.append(('%s;*;%s') % (epoch_datetimestamp, logline[13:]))
90 archive_bottom_inx = archive_top_inx - (len(logline_array) - 1)
91 shit_lines(archive_bottom_inx)
92 logline_array = []