Overview
TheCalendar model displays upcoming episode releases for content in the user’s library. It loads meta items from addons, organizes them by release date, and provides a month-based calendar interface for browsing upcoming content.
Structure
Fields
Currently selected year and month
Navigation options for previous and next month
Meta items loaded from addons for library content
Information about the selected month (days, first weekday, today)
Calendar items organized by day, containing videos releasing that day
Selected
Month number (1-12)
Year
Conversion
The type can be created from:NaiveDateDateTime<Utc>Option<DateTime<Utc>>(defaults to default values if None)
src/models/calendar.rs:37
Selectable
Previous month selection
Next month selection
MonthInfo
Current day of month if the selected month is the current month
Number of days in the selected month (28-31)
Weekday of the first day (0=Monday, 6=Sunday)
src/models/calendar.rs:98
Item
The date for this calendar day
Videos releasing on this date
FullDate
ContentItem
The meta item (series) this video belongs to
The video (episode) releasing on this date
Update Implementation
ImplementsUpdateWithCtx<E> for calendar operations:
Supported Messages
Action::Load::Calendar
Action::Load::Calendar
Loads calendar for a specific month (or current month if None):
- Loads meta items for library content (once)
- Sets selected month
- Computes month info
- Organizes videos by release date
- Updates navigation options
src/models/calendar.rs:119Action::Unload
Action::Unload
Clears all calendar state:
- Clears meta items
- Resets selection
- Clears month info
- Clears items
src/models/calendar.rs:139Internal::ResourceRequestResult
Internal::ResourceRequestResult
Processes meta item responses:
- Updates meta_items with loaded data
- Reorganizes items by date
src/models/calendar.rs:152Loading Meta Items
Meta items are loaded once using theCALENDAR_IDS_EXTRA_PROP:
Source:
src/models/calendar.rs:288
Items Organization
Videos are organized by release date:
Source:
src/models/calendar.rs:239
Month Selection
When loading:- If a specific month is provided, use it
- Otherwise, default to current month and year
- Compute month info (days, first weekday, today marker)
- Calculate prev/next month for navigation
src/models/calendar.rs:172
Usage Example
Caching Strategy
Meta items are loaded once when the calendar is first loaded and cached for the entire session. Changing months does not reload meta items, only reorganizes them by date.
Limitations
Constants
CALENDAR_IDS_EXTRA_PROP- Extra property name for requesting by IDsCALENDAR_ITEMS_COUNT- Maximum number of meta items to load
src/constants.rs
Month Navigation
Previous/next month calculation useschrono::Months:
src/models/calendar.rs:220
See Also
- MetaItem - Meta item structure
- Video - Video structure with release dates
- LibraryBucket - Library data source
