Revision 1a481d7b lib/peerstreamer_logs.py

View differences:

lib/peerstreamer_logs.py
5 5
	return filename[:17]
6 6

  
7 7
def time_from_filename(filename):
8
	if is_source_from_filename(filename):
9
		return filename[25:35]
10
	else:
11
		return filename[31:41]
8
	return filename.split('.')[0][-10:]
9
#	if is_source_from_filename(filename):
10
#		return filename[25:35]
11
#	else:
12
#		return filename[31:41]
12 13

  
13 14
def is_source_from_filename(filename):
14 15
	if "source" in filename:
......
16 17
	else:
17 18
		return False
18 19

  
19
nicks = {\
20
		'0000000000c5_0058': 's0',\
21
		'0000000000c5_0068': 's1',\
22
		'0000000000c5_0066': 's2',\
23
		'0000000000c5_0055': 's3',\
24
		'0000000000c5_0067': 's4',\
25
		'0000000000c5_0065': 's5',\
26
		'0000000000c5_0057': 's6',\
27
		'0000000000c5_0056': 's7',\
28
		'0000000000c5_00ab': 's8',\
29
		'0000000000c5_00aa': 's9',\
30
		'0000000000c5_0082': 's10',\
31
		'0000000000c5_008c': 's11',\
32
		'0000000000c5_0080': 's12',\
33
		'0000000000c5_00c6': 's13',\
34
		'0000000000c5_0097': 's14',\
35
		'0000000000c5_0096': 's15',\
36
}
20
nicks = {}
21
#		'0000000000c5_0058': 's0',\
22
#		'0000000000c5_0068': 's1',\
23
#		'0000000000c5_0066': 's2',\
24
#		'0000000000c5_0055': 's3',\
25
#		'0000000000c5_0067': 's4',\
26
#		'0000000000c5_0065': 's5',\
27
#		'0000000000c5_0057': 's6',\
28
#		'0000000000c5_0056': 's7',\
29
#		'0000000000c5_00ab': 's8',\
30
#		'0000000000c5_00aa': 's9',\
31
#		'0000000000c5_0082': 's10',\
32
#		'0000000000c5_008c': 's11',\
33
#		'0000000000c5_0080': 's12',\
34
#		'0000000000c5_00c6': 's13',\
35
#		'0000000000c5_0097': 's14',\
36
#		'0000000000c5_0096': 's15',\
37
#}
37 38
def purify_hostname(name):
38 39
# 00000000008e_0034
39
	if name not in nicks.keys():
40
		return ("s"+name[-2:]+name[10:12]).lower()
40
	if name:
41
		if name not in nicks.keys():
42
			return ("s"+name[-2:]+name[10:12]).lower()
43
		else:
44
			return nicks[name]
41 45
	else:
42
		return nicks[name]
46
		return str(name)
43 47

  
44 48
def purify_address(folder,name):
45 49
	mapfile = read_csv(folder+"/hostnames2address.exp").set_index('address')

Also available in: Unified diff