Overview
Notifications types track new episodes and videos for items in the user’s library, extracted from addon responses.NotificationsBucket
Container for all notifications using thelastVideos resource from addons.
User ID (Option<UserId>) - None if not authenticated
Nested map of notifications: meta item ID → video ID → notification item
Timestamp when notifications were last pulled from addons
Timestamp when the notification bucket was initialized
Methods
new<E: Env + 'static>(uid: UID, items: Vec<NotificationItem>) -> Self
Create a new notifications bucket from a user ID and list of notification items.
Behavior:
- Deduplicates items by meta ID and video ID
- If duplicate video IDs exist for the same meta item, keeps the first occurrence
- Initializes
last_updatedas None - Sets
createdto current timestamp
NotificationItem
Represents a notification for a new video/episode.Meta item identifier (type alias for String)
Video identifier (type alias for String)
When the video was released
Usage
Notifications are automatically pulled for library items that meet certain criteria (seeLibraryItem::should_pull_notifications):
- Item type is not “other” or “movie” (typically series)
- No default video ID set in behavior hints
- Item is not removed or temporary
- Notifications are not disabled (
no_notifis false)
- Querying addons’
lastVideosresource for items in the user’s library - Comparing released dates to determine which videos are new
- Storing notifications in the bucket keyed by meta ID and video ID
- Tracking when notifications were last updated
Example Structure
Type Aliases
MetaItemId
VideoId
Related Types
See Library Types forLibraryItem::should_pull_notifications() which determines when notifications are pulled for an item.