chore(player): report marker counts when loading playback extras

The extras loader logged only the chapter count, so a user report of
"auto skip never fires" could not be told apart from "the server has no
intro marker for this item" — the two need opposite fixes. Log the
marker count and types on all three load paths, including the cache-only
one that previously logged nothing at all.

Drop PlexVideoPlaybackData.markers while here: the playback-start parse
filled it on every item and no caller ever read it, because the player
controls fetch their own PlaybackExtras.

Document why getPlaybackExtras may serve the shared metadata cache row
without a freshness check: getPlaybackInitialization refreshes that row
network-first before the controls mount. That ordering is what makes
cache-first correct, and nothing said so.
This commit is contained in:
edde746
2026-08-02 04:55:54 +02:00
parent 957711a650
commit f78f65faf5
4 changed files with 35 additions and 10 deletions
@@ -30,7 +30,7 @@ class VideoControlsPlaybackExtrasLoader {
forceChapterFallback: settings.read(SettingsService.forceSkipMarkerFallback),
forceRefresh: forceRefresh,
);
appLogger.d('_loadPlaybackExtras: got ${extras.chapters.length} chapters');
appLogger.d('_loadPlaybackExtras: got ${_describe(extras)}');
return extras;
} catch (e, stack) {
appLogger.d('_loadPlaybackExtras: network path failed, trying cache fallback');
@@ -43,7 +43,7 @@ class VideoControlsPlaybackExtrasLoader {
forceChapterFallback: settings.read(SettingsService.forceSkipMarkerFallback),
);
if (extras != null) {
appLogger.d('_loadPlaybackExtras: loaded ${extras.chapters.length} chapters from cache');
appLogger.d('_loadPlaybackExtras: loaded ${_describe(extras)} from cache');
return extras;
}
} catch (cacheError) {
@@ -61,7 +61,7 @@ class VideoControlsPlaybackExtrasLoader {
}
try {
final settings = await SettingsService.getInstance();
return CachedPlaybackMetadataService.fetchPlaybackExtras(
final extras = await CachedPlaybackMetadataService.fetchPlaybackExtras(
backend: metadata.backend,
cacheServerId: cacheServerId,
itemId: metadata.id,
@@ -69,12 +69,27 @@ class VideoControlsPlaybackExtrasLoader {
creditsPattern: settings.read(SettingsService.creditsPattern),
forceChapterFallback: settings.read(SettingsService.forceSkipMarkerFallback),
);
appLogger.d(
extras == null
? '_loadPlaybackExtras: no cached extras for ${metadata.id}'
: '_loadPlaybackExtras: cache-only ${_describe(extras)}',
);
return extras;
} catch (e) {
appLogger.d('_loadPlaybackExtras: cache-only path failed', error: e);
return null;
}
}
/// Marker counts are the difference between "the server has no intro data"
/// and "auto-skip never fired", which is otherwise indistinguishable in a
/// user-supplied log.
static String _describe(PlaybackExtras extras) {
final markerTypes = extras.markers.map((m) => m.type).join(',');
return '${extras.chapters.length} chapters, ${extras.markers.length} markers'
'${markerTypes.isEmpty ? '' : ' ($markerTypes)'}';
}
Future<String?> _resolveCacheServerId() async {
final serverId = metadata.serverId;
if (serverId == null) return null;