Files
plezy/lib/utils/plex_cache_parser.dart
edde746 4eaf4423a1 refactor: share focus chrome and simplify the TV picker and browse paths
Focus chrome was implemented twice, once in the focusable wrapper and once
in the focus builders; both now go through FocusChrome. TvColorPicker's
channel row was a copy of TvNumberSpinner and is now that widget in compact
density.

Also trims unused helpers and fields and simplifies the Jellyfin browse
paths.
2026-07-26 06:09:49 +02:00

22 lines
769 B
Dart

/// Utility class for parsing Plex API cache responses
///
/// Provides consistent extraction of MediaContainer data across the codebase.
class PlexCacheParser {
PlexCacheParser._();
static Map<String, dynamic>? extractMediaContainer(Map<String, dynamic>? cached) {
final container = cached?['MediaContainer'];
return container is Map<String, dynamic> ? container : null;
}
static List<dynamic>? extractMetadataList(Map<String, dynamic>? cached) {
return extractMediaContainer(cached)?['Metadata'] as List?;
}
static Map<String, dynamic>? extractFirstMetadata(Map<String, dynamic>? cached) {
final list = extractMetadataList(cached);
if (list == null || list.isEmpty) return null;
return list.first as Map<String, dynamic>;
}
}