From f23ab5b96e59b5df19829f04191f07d3f67d1c8a Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Tue, 18 Nov 2025 19:03:17 +0100 Subject: [PATCH] fix: media card playlist compatibility --- lib/models/plex_playlist.dart | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/lib/models/plex_playlist.dart b/lib/models/plex_playlist.dart index 7799c3ff..6e788473 100644 --- a/lib/models/plex_playlist.dart +++ b/lib/models/plex_playlist.dart @@ -45,9 +45,40 @@ class PlexPlaylist { /// Helper to get display image (composite or thumb) String? get displayImage => composite ?? thumb; + /// Helper to get display title (consistent with PlexMetadata) + String get displayTitle => title; + /// Helper to determine if playlist is editable bool get isEditable => !smart; + // Properties for MediaCard compatibility with PlexMetadata interface + + /// Playlists are not "watched" in the traditional sense + bool get isWatched => false; + + /// Playlists don't have resume positions + int? get viewOffset => null; + + /// Playlists don't have parent/episode indices + int? get parentIndex => null; + int? get index => null; + + /// Playlists don't have parent titles or subtitles + String? get parentTitle => null; + String? get displaySubtitle => null; + + /// Playlists don't have year, rating, or content metadata + int? get year => null; + String? get contentRating => null; + double? get rating => null; + String? get studio => null; + + /// Use leafCount as the equivalent of childCount + int? get childCount => leafCount; + + /// Playlists don't track viewed leaf count + int? get viewedLeafCount => null; + factory PlexPlaylist.fromJson(Map json) => _$PlexPlaylistFromJson(json);