feat: sync rules for downloads

close #867
This commit is contained in:
edde746
2026-04-16 12:52:48 +02:00
parent c369f2c3d7
commit 360741674d
47 changed files with 2546 additions and 154 deletions
+13
View File
@@ -152,6 +152,15 @@ class PlexMetadata with MultiServerFields {
/// Global unique identifier across all servers (serverId:ratingKey)
String get globalKey => serverId != null ? buildGlobalKey(serverId!, ratingKey) : ratingKey;
/// Parent rating keys for hierarchical invalidation.
/// For an episode: [seasonRatingKey, showRatingKey]
/// For a season: [showRatingKey]
/// For a movie: []
List<String> get parentChain => [
?parentRatingKey,
?grandparentRatingKey,
];
/// Whether this item represents a library section (shared whole-library, not a media item).
/// These have keys like `/library/sections/5/all` instead of `/library/metadata/12345`.
bool get isLibrarySection => key != null && key!.startsWith('/library/sections/');
@@ -520,6 +529,10 @@ class PlexMetadata with MultiServerFields {
return viewOffset! > 0 && viewOffset! < duration!;
}
/// Returns true if this container (show/season) has some but not all episodes watched
bool get isPartiallyWatched =>
viewedLeafCount != null && leafCount != null && viewedLeafCount! > 0 && viewedLeafCount! < leafCount!;
// Helper to determine if content is watched
bool get isWatched {
// For series/seasons, check if all episodes are watched