Skip to content

Commit a755661

Browse files
author
Joshua Most
committed
uhh
1 parent 0c455b1 commit a755661

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

exporter.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,23 @@ def collect_metrics(self) -> Dict[str, Any]:
474474
except:
475475
pass
476476

477-
# Create ordered dict with all 24 hours in HH:00 format
478-
hour_labels = {}
479-
for hour in range(24):
480-
hour_label = f"{hour:02d}:00"
481-
hour_labels[hour_label] = hour_counts.get(hour, 0)
477+
# Condense into 12 time periods (2-hour blocks)
478+
time_periods = {
479+
"Midnight (12-2am)": hour_counts.get(0, 0) + hour_counts.get(1, 0),
480+
"Early Morning (2-4am)": hour_counts.get(2, 0) + hour_counts.get(3, 0),
481+
"Dawn (4-6am)": hour_counts.get(4, 0) + hour_counts.get(5, 0),
482+
"Morning (6-8am)": hour_counts.get(6, 0) + hour_counts.get(7, 0),
483+
"Late Morning (8-10am)": hour_counts.get(8, 0) + hour_counts.get(9, 0),
484+
"Midday (10am-12pm)": hour_counts.get(10, 0) + hour_counts.get(11, 0),
485+
"Afternoon (12-2pm)": hour_counts.get(12, 0) + hour_counts.get(13, 0),
486+
"Late Afternoon (2-4pm)": hour_counts.get(14, 0) + hour_counts.get(15, 0),
487+
"Evening (4-6pm)": hour_counts.get(16, 0) + hour_counts.get(17, 0),
488+
"Night (6-8pm)": hour_counts.get(18, 0) + hour_counts.get(19, 0),
489+
"Late Night (8-10pm)": hour_counts.get(20, 0) + hour_counts.get(21, 0),
490+
"Very Late (10pm-12am)": hour_counts.get(22, 0) + hour_counts.get(23, 0),
491+
}
482492

483-
metrics['jellyfin_playback_by_hour'] = hour_labels
493+
metrics['jellyfin_playback_by_hour'] = time_periods
484494
except Exception as e:
485495
logger.warning(f"Could not fetch playback stats (user_usage_stats plugin may not be installed): {e}")
486496

0 commit comments

Comments
 (0)