fix: downloaded media detail screen clear logo
This commit is contained in:
@@ -21,6 +21,7 @@ import '../i18n/strings.g.dart';
|
|||||||
import '../widgets/plex_optimized_image.dart';
|
import '../widgets/plex_optimized_image.dart';
|
||||||
import '../utils/plex_image_helper.dart';
|
import '../utils/plex_image_helper.dart';
|
||||||
import '../../services/plex_client.dart';
|
import '../../services/plex_client.dart';
|
||||||
|
import '../services/plex_api_cache.dart';
|
||||||
import '../models/plex_metadata.dart';
|
import '../models/plex_metadata.dart';
|
||||||
import '../utils/content_utils.dart';
|
import '../utils/content_utils.dart';
|
||||||
import '../utils/rating_utils.dart';
|
import '../utils/rating_utils.dart';
|
||||||
@@ -768,10 +769,14 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> with WatchStateAw
|
|||||||
_isLoadingMetadata = true;
|
_isLoadingMetadata = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Offline mode: use passed metadata directly, load seasons from downloads
|
// Offline mode: try to load full metadata from cache (has clearLogo, summary, etc.)
|
||||||
if (widget.isOffline) {
|
if (widget.isOffline) {
|
||||||
|
final cachedMetadata = await PlexApiCache.instance.getMetadata(
|
||||||
|
widget.metadata.serverId ?? '',
|
||||||
|
widget.metadata.ratingKey,
|
||||||
|
);
|
||||||
setState(() {
|
setState(() {
|
||||||
_fullMetadata = widget.metadata;
|
_fullMetadata = cachedMetadata ?? widget.metadata;
|
||||||
_isLoadingMetadata = false;
|
_isLoadingMetadata = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ class PlexApiCache {
|
|||||||
final cached = await get(serverId, '/library/metadata/$ratingKey');
|
final cached = await get(serverId, '/library/metadata/$ratingKey');
|
||||||
final json = PlexCacheParser.extractFirstMetadata(cached);
|
final json = PlexCacheParser.extractFirstMetadata(cached);
|
||||||
if (json == null) return null;
|
if (json == null) return null;
|
||||||
return PlexMetadata.fromJson(json).copyWith(serverId: serverId);
|
return PlexMetadata.fromJsonWithImages(json).copyWith(serverId: serverId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clear all cached data (useful for debugging/testing)
|
/// Clear all cached data (useful for debugging/testing)
|
||||||
|
|||||||
Reference in New Issue
Block a user