Commit Graph

21 Commits

Author SHA1 Message Date
Matthieu B
6cb00478da Merge pull request #1203 from wizarrrr/fix/1121-watch-time-calculation
fix: use playback position instead of file duration for watch time
2026-03-29 16:25:47 +02:00
Matthieu B
73c29458fe fix: resolve all test failures, linting errors, and type errors
- Fix 55 test failures caused by missing request contexts and incorrect
  session_transaction() usage across 8 test files
- Fix ruff import sorting errors and unused imports
- Fix 122 type errors: rename method override parameters to match base
  classes, add None guards for fetchone()/datetime, widen dict type
  annotations, add type: ignore for SQLAlchemy stub limitations
- Add [tool.ty.rules] config to suppress unsupported-base warnings
- Fix _ variable shadowing gettext in wizard routes
- Add noqa: ARG002 for unused method arguments required by base class
2026-03-29 16:20:23 +02:00
Matthieu B
65ed356d62 fix: use playback position instead of file duration for watch time (#1121)
Jellyfin and Emby collectors were recording RunTimeTicks (total file
runtime) as the session duration, causing severe overestimation when
users stopped partway through long titles.

- JellyfinCollector._emit_session_event: on session_end, use position_ms
  (last known playback position) as duration_ms; fall back to
  raw_duration_ms only when position_ms is unavailable or zero.
- EmbyCollector._emit_session_event: identical fix (shared API shape).
- JellyfinHistoricalImporter._process_item: for partially-watched items
  (UserData.Played == false) use PlaybackPositionTicks; keep RunTimeTicks
  only for fully-played items where position has already been reset.
- historical_duration_source metadata field now accurately reflects
  which source was used (runtime_ticks, playback_position_ticks, or
  runtime_ticks_fallback).

Plex was already correct via elapsed-time tracking in SessionManager.
2026-03-29 16:15:56 +02:00
Matthieu B
da8d008398 feat: revamp activity measurement and display 2025-11-04 18:55:11 +01:00
Matthieu B
c915e3c530 refactor: remove PlexCollector and update monitoring to use PollingCollector for Plex 2025-11-04 18:03:56 +01:00
Matthieu B
d8bdc832c9 test: add assertions to ensure WizardStep retrieval after edits 2025-11-03 17:45:10 +01:00
Matthieu B
ff92ad1c54 feat: enhance Plex session management with Tautulli-inspired polling and immediate enrichment 2025-11-03 15:33:26 +01:00
Matthieu B
3d97dda0fb fix: error in nwo playing cards 2025-10-23 20:10:04 +02:00
Matthieu B
9b5aa0972a refactor: remove slop from media and new linting rules 2025-10-23 18:33:50 +02:00
Matthieu B
1618ce7791 feat: enhance session management with Tautulli-inspired enrichment and validation for statistics 2025-10-22 12:49:57 +02:00
Matthieu B
07166a1a80 refactor: update Emby collector to use Sessions API polling instead of WebSocket
fix: correct key for transcoding info in admin routes
feat: enhance Jellyfin client to extract additional session and media details
fix: update template to reflect changes in transcoding info structure
chore: update submodule reference for plus
2025-10-21 11:48:07 +02:00
Matthieu B
55bdcd10ba fix: Enhance session data validation and logging for incomplete data handling 2025-10-20 12:12:35 +02:00
Matthieu B
e184b0a676 fix: Add session re-fetching capability in PlexCollector for incomplete data handling 2025-10-20 11:42:23 +02:00
Matthieu B
9ea2fa10b2 fix: Improve Plex server connection logging to include account username 2025-10-19 17:02:56 +02:00
Matthieu B
6ab5e024db Revert "Merge pull request #925 from wizarrrr/chore/python-3.14-upgrade"
This reverts commit 35dde7c19a, reversing
changes made to c8cf9905ba.
2025-10-19 14:05:59 +02:00
Matthieu B
36227c762b refactor: Update type hints for user details methods and other functions for improved clarity 2025-10-18 17:42:26 +02:00
Matthieu B
3965444133 refactor: Rename environment variable for enabling Plus features to improve clarity 2025-10-18 16:15:48 +02:00
Matthieu B
c6db372e70 Update app/activity/monitoring/collectors/__init__.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-18 12:59:21 +02:00
Matthieu B
1437895e0b fix: Update server name references in Emby collector and activity templates
feat: Implement numbered pagination component in activity table
2025-10-18 12:41:32 +02:00
Matthieu B
f886db9124 feat(audiobookshelf): Track session start times and calculate elapsed duration for events 2025-10-17 12:04:12 +02:00
Matthieu B
0ac98355dd feat(activity): Implement activity ingestion, identity resolution, and maintenance services
- Added `identity_resolution.py` for resolving Wizarr users and identities.
- Created `ingestion.py` to handle recording and updating activity events.
- Introduced `maintenance.py` for cleanup and session management tasks.
- Developed `queries.py` for read-oriented operations on activity sessions.
- Implemented background tasks in `activity.py` for scheduled maintenance.
- Added tests for activity services and blueprint to ensure functionality.
2025-10-16 15:18:31 +02:00