From 87da5b400e4403dbc735ad05ef06f071794cd888 Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Wed, 1 Apr 2026 16:05:36 +0200 Subject: [PATCH] chore: remove tune debug logging --- lib/screens/video_player_screen.dart | 8 ++++++-- lib/services/plex_client.dart | 26 ++------------------------ 2 files changed, 8 insertions(+), 26 deletions(-) diff --git a/lib/screens/video_player_screen.dart b/lib/screens/video_player_screen.dart index a3743803..7042dfef 100644 --- a/lib/screens/video_player_screen.dart +++ b/lib/screens/video_player_screen.dart @@ -1051,12 +1051,16 @@ class VideoPlayerScreenState extends State with WidgetsBindin : null; _transcodeSessionId = PlexClient.generateSessionIdentifier(); - // Show "Watch from Start" dialog when program has been on for >60s + // Show "Watch from Start" dialog when an existing capture session has >60s of history. + // On a fresh tune (no active recording), the buffer is empty so this won't trigger. int? offsetSeconds; if (_captureBuffer != null && _programBeginsAt != null) { final nowEpoch = DateTime.now().millisecondsSinceEpoch ~/ 1000; final effectiveStart = max(_captureBuffer!.seekableStartEpoch, _programBeginsAt!); - if (nowEpoch - effectiveStart > 60) { + final elapsed = nowEpoch - effectiveStart; + appLogger.d('Time-shift: buffer=${_captureBuffer!.seekableDurationSeconds}s, ' + 'beginsAt=$_programBeginsAt, elapsed=${elapsed}s (need >60 for dialog)'); + if (elapsed > 60) { final watchFromStart = await _showWatchFromStartDialog(effectiveStart, nowEpoch); if (!mounted) return; if (watchFromStart == true) { diff --git a/lib/services/plex_client.dart b/lib/services/plex_client.dart index 7bdd3ab4..b480e8db 100644 --- a/lib/services/plex_client.dart +++ b/lib/services/plex_client.dart @@ -2518,13 +2518,6 @@ class PlexClient { final container = _getMediaContainer(response); if (container == null) return null; - // Log the full container keys and types for debugging - appLogger.d('Tune response keys: ${container.keys.toList()}'); - for (final key in container.keys) { - final val = container[key]; - appLogger.d(' $key: ${val.runtimeType} = ${val is List ? '[${val.length} items]' : val is Map ? '{${val.keys.toList()}}' : val}'); - } - final containerStatus = container['status']; final statusInt = containerStatus is num ? containerStatus.toInt() : containerStatus is String ? int.tryParse(containerStatus) : null; if (statusInt != null && statusInt != 0 && statusInt != 200) { @@ -2534,25 +2527,22 @@ class PlexClient { } // Metadata is nested: MediaSubscription[0].MediaGrabOperation[0].Metadata + // Both may be a List or single Map depending on the response format. Map? metadataJson; int? beginsAt; final subscriptions = container['MediaSubscription']; - appLogger.d('MediaSubscription type: ${subscriptions.runtimeType}'); final subList = subscriptions is List ? subscriptions : subscriptions is Map ? [subscriptions] : null; if (subList != null && subList.isNotEmpty) { final sub = subList.first as Map; final ops = sub['MediaGrabOperation']; - appLogger.d('MediaGrabOperation type: ${ops.runtimeType}'); final opList = ops is List ? ops : ops is Map ? [ops] : null; if (opList != null && opList.isNotEmpty) { final op = opList.first as Map; - appLogger.d('GrabOperation keys: ${op.keys.toList()}'); final rawBeginsAt = op['beginsAt']; beginsAt = rawBeginsAt is num ? rawBeginsAt.toInt() : rawBeginsAt is String ? int.tryParse(rawBeginsAt) : null; final nested = op['Metadata']; - appLogger.d('Metadata type: ${nested.runtimeType}'); if (nested is Map) { metadataJson = nested; } else if (nested is List && nested.isNotEmpty) { @@ -2562,7 +2552,6 @@ class PlexClient { } if (metadataJson == null) { final fallback = container['Metadata']; - appLogger.d('Fallback Metadata type: ${fallback.runtimeType}'); if (fallback is List && fallback.isNotEmpty) { metadataJson = fallback.first as Map; } else if (fallback is Map) { @@ -2576,20 +2565,9 @@ class PlexClient { } // Tune response may return XML-style string values where fromJson expects nums. - // Coerce known numeric fields so the generated deserializer doesn't choke. _coerceNumericFields(metadataJson); - PlexMetadata metadata; - try { - metadata = _createTaggedMetadata(metadataJson); - } catch (e, st) { - appLogger.e('Tune metadata parse failed. Keys: ${metadataJson.keys.toList()}'); - for (final entry in metadataJson.entries) { - appLogger.d(' ${entry.key}: ${entry.value.runtimeType} = ${entry.value}'); - } - appLogger.e('Stack: $st'); - rethrow; - } + final metadata = _createTaggedMetadata(metadataJson); final sessionPath = metadataJson['key'] as String?; if (sessionPath == null) {