refactor: trakt/download hardening and cleanup sweep

This commit is contained in:
edde746
2026-04-21 13:57:03 +02:00
parent 93d196572f
commit ee020d81bd
66 changed files with 1526 additions and 2167 deletions
-25
View File
@@ -21,35 +21,10 @@ class PlexCacheParser {
return list.first as Map<String, dynamic>;
}
/// Check if a cached response has valid metadata
static bool hasMetadata(Map<String, dynamic>? cached) {
final list = extractMetadataList(cached);
return list != null && list.isNotEmpty;
}
/// Extract Directory list from a cached response (for libraries, playlists)
static List<dynamic>? extractDirectoryList(Map<String, dynamic>? cached) {
if (cached == null) return null;
return cached['MediaContainer']?['Directory'] as List?;
}
/// Extract Hub list from a cached response
static List<dynamic>? extractHubList(Map<String, dynamic>? cached) {
if (cached == null) return null;
return cached['MediaContainer']?['Hub'] as List?;
}
/// Extract Chapter list from the first metadata item
static List<dynamic>? extractChapters(Map<String, dynamic>? cached) {
final metadata = extractFirstMetadata(cached);
if (metadata == null) return null;
return metadata['Chapter'] as List?;
}
/// Extract Marker list from the first metadata item
static List<dynamic>? extractMarkers(Map<String, dynamic>? cached) {
final metadata = extractFirstMetadata(cached);
if (metadata == null) return null;
return metadata['Marker'] as List?;
}
}