Do a more generic plugin : page_to_hit
This commit is contained in:
13
iwla.py
13
iwla.py
@@ -1,11 +1,8 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import time
|
||||
import glob
|
||||
import imp
|
||||
import pickle
|
||||
import gzip
|
||||
import importlib
|
||||
@@ -126,7 +123,7 @@ class IWLA(object):
|
||||
remote_addr = hit['remote_addr']
|
||||
|
||||
if not remote_addr in self.current_analysis['visits'].keys():
|
||||
self._createUser(hit)
|
||||
self._createVisitor(hit)
|
||||
return
|
||||
|
||||
super_hit = self.current_analysis['visits'][remote_addr]
|
||||
@@ -160,7 +157,7 @@ class IWLA(object):
|
||||
else:
|
||||
super_hit[hit_key] += 1
|
||||
|
||||
def _createUser(self, hit):
|
||||
def _createVisitor(self, hit):
|
||||
super_hit = self.current_analysis['visits'][hit['remote_addr']] = {}
|
||||
super_hit['remote_addr'] = hit['remote_addr']
|
||||
super_hit['viewed_pages'] = 0
|
||||
@@ -347,7 +344,7 @@ class IWLA(object):
|
||||
else:
|
||||
if not self.analyse_started:
|
||||
if time.mktime(cur_time) >= time.mktime(t):
|
||||
return
|
||||
return False
|
||||
else:
|
||||
self.analyse_started = True
|
||||
if cur_time.tm_mon != t.tm_mon:
|
||||
@@ -370,7 +367,7 @@ class IWLA(object):
|
||||
def start(self):
|
||||
self.cache_plugins = preloadPlugins(self.plugins, self)
|
||||
|
||||
print '==> Analysing log'
|
||||
print '==> Analyse previous database'
|
||||
|
||||
self.meta_infos = self._deserialize(conf.META_PATH) or self._clearMeta()
|
||||
if self.meta_infos['last_time']:
|
||||
@@ -378,6 +375,8 @@ class IWLA(object):
|
||||
else:
|
||||
self._clearVisits()
|
||||
|
||||
print '==> Analysing log'
|
||||
|
||||
with open(conf.analyzed_filename) as f:
|
||||
for l in f:
|
||||
# print "line " + l
|
||||
|
||||
Reference in New Issue
Block a user