Add display only switch (-p)

This commit is contained in:
Grégory Soutadé 2016-08-20 13:11:22 +02:00
parent be67d39fb2
commit a76d8e8b69
3 changed files with 17 additions and 2 deletions

View File

@ -1,8 +1,11 @@
v0.4 (02/05/2016) v0.4 (20/08/2016)
** User ** ** User **
Remove crwalers from feed parsers
Add display only switch (-p)
** Dev ** ** Dev **
** Bugs ** ** Bugs **
for robots, we have to use not_viewed_pages (feeds plugin) for robots, we have to use not_viewed_pages (feeds plugin)
gz files were not generated due to bad time comparison
v0.3 (12/04/2016) v0.3 (12/04/2016)
** User ** ** User **

View File

@ -34,7 +34,8 @@ display_hooks = []
# Extensions that are considered as a HTML page (or result) in opposite to hits # Extensions that are considered as a HTML page (or result) in opposite to hits
pages_extensions = ['/', 'htm', 'html', 'xhtml', 'py', 'pl', 'rb', 'php'] pages_extensions = ['/', 'htm', 'html', 'xhtml', 'py', 'pl', 'rb', 'php']
# HTTP codes that are cosidered OK
# HTTP codes that are considered OK
viewed_http_codes = [200, 304] viewed_http_codes = [200, 304]
# If False, doesn't cout visitors that doesn't GET a page but resources only (images, rss...) # If False, doesn't cout visitors that doesn't GET a page but resources only (images, rss...)

11
iwla.py
View File

@ -608,6 +608,10 @@ class IWLA(object):
duplicated_stats['nb_visitors'] = stats['nb_visitors'] = len(self.valid_visitors.keys()) duplicated_stats['nb_visitors'] = stats['nb_visitors'] = len(self.valid_visitors.keys())
if args.display_only:
self._generateDisplay()
return
self._callPlugins(conf.POST_HOOK_DIRECTORY) self._callPlugins(conf.POST_HOOK_DIRECTORY)
path = self.getDBFilename(cur_time) path = self.getDBFilename(cur_time)
@ -632,6 +636,9 @@ class IWLA(object):
self._generateDisplay() self._generateDisplay()
def _generateDayStats(self): def _generateDayStats(self):
if args.display_only:
return
visits = self.current_analysis['visits'] visits = self.current_analysis['visits']
cur_time = self.meta_infos['last_time'] cur_time = self.meta_infos['last_time']
@ -835,6 +842,10 @@ if __name__ == '__main__':
default=False, default=False,
help='Don\'t compress databases (bigger but faster, not compatible with compressed databases)') help='Don\'t compress databases (bigger but faster, not compatible with compressed databases)')
parser.add_argument('-p', '--display-only', dest='display_only', action='store_true',
default=False,
help='Only generate display')
args = parser.parse_args() args = parser.parse_args()
# Load user conf # Load user conf