def get_channels_stats(log_dir): activity_counts = [] stats = {} for log_data in ircloglib.all_logs(log_dir): # print log_data.path channel_stats = stats.get((log_data.server, log_data.channel), {}) year_stats = channel_stats.get(log_data.start_time.year, {}) month_stats = year_stats.get(log_data.start_time.month, {}) activity_count = get_activity_count(log_data.path) month_stats[log_data.start_time.day] = activity_count activity_counts.append(activity_count) year_stats[log_data.start_time.month] = month_stats channel_stats[log_data.start_time.year] = year_stats stats[(log_data.server, log_data.channel)] = channel_stats return {"channel_stats": stats, "activity_count": sorted(activity_counts)}
def get_channels_stats(log_dir): activity_counts = [] stats = {} for log_data in ircloglib.all_logs(log_dir): sc_key = '%s:%s' % (log_data.server, log_data.channel) channel_stats = stats.get(sc_key, {}) year_stats = channel_stats.get(str(log_data.start_time.year), {}) month_stats = year_stats.get(str(log_data.start_time.month), {}) activity_count = get_activity_count(log_data.path) month_stats[str(log_data.start_time.day)] = activity_count activity_counts.append(activity_count) year_stats[str(log_data.start_time.month)] = month_stats channel_stats[str(log_data.start_time.year)] = year_stats stats[sc_key] = channel_stats return {'channel_stats': stats, 'activity_counts': sorted(activity_counts)}
def get_channels_stats(log_dir): activity_counts = [] stats = {} for log_data in ircloglib.all_logs(log_dir): #print log_data.path channel_stats = stats.get((log_data.server, log_data.channel), {}) year_stats = channel_stats.get(log_data.start_time.year, {}) month_stats = year_stats.get(log_data.start_time.month, {}) activity_count = get_activity_count(log_data.path) month_stats[log_data.start_time.day] = activity_count activity_counts.append(activity_count) year_stats[log_data.start_time.month] = month_stats channel_stats[log_data.start_time.year] = year_stats stats[(log_data.server, log_data.channel)] = channel_stats return { 'channel_stats': stats, 'activity_count': sorted(activity_counts) }