using ErsatzTV.Application.Filler; using ErsatzTV.Application.Graphics; using ErsatzTV.Application.MediaCollections; using ErsatzTV.Application.MediaItems; using ErsatzTV.Application.Watermarks; using ErsatzTV.Core.Domain; using ErsatzTV.Core.Scheduling; namespace ErsatzTV.Application.ProgramSchedules; public abstract record ProgramScheduleItemViewModel( int Id, int Index, StartType StartType, TimeSpan? StartTime, FixedStartTimeBehavior? FixedStartTimeBehavior, PlayoutMode PlayoutMode, CollectionType CollectionType, MediaCollectionViewModel Collection, MultiCollectionViewModel MultiCollection, SmartCollectionViewModel SmartCollection, RerunCollectionViewModel RerunCollection, PlaylistViewModel Playlist, NamedMediaItemViewModel MediaItem, string SearchTitle, string SearchQuery, PlaybackOrder PlaybackOrder, MarathonGroupBy MarathonGroupBy, bool MarathonShuffleGroups, bool MarathonShuffleItems, int? MarathonBatchSize, FillWithGroupMode FillWithGroupMode, string CustomTitle, GuideMode GuideMode, FillerPresetViewModel PreRollFiller, FillerPresetViewModel MidRollFiller, FillerPresetViewModel PostRollFiller, FillerPresetViewModel TailFiller, FillerPresetViewModel FallbackFiller, List Watermarks, List GraphicsElements, string PreferredAudioLanguageCode, string PreferredAudioTitle, string PreferredSubtitleLanguageCode, ChannelSubtitleMode? SubtitleMode) { /// /// A rough estimate, in wall-clock time, of how long a single pass of this schedule item will play, /// derived from the aggregated playout runtimes of the referenced content. /// /// Semantics by : /// /// One — the average runtime of one item in the referenced collection. /// /// Multiple — the average item runtime multiplied by the configured count /// (), or the whole collection runtime for /// . An expression-based (non-integer) /// count cannot be evaluated here and yields null. /// /// Flood — always null: a flood item fills the remaining time and is unbounded. /// Duration — the explicit playoutDuration setting on the item. /// /// /// /// null whenever a bounded estimate cannot be produced — an unbounded mode (Flood), /// a referenced collection with no items that have a known positive duration, a Multiple mode other /// than Count/CollectionSize, or a collection type other than /// (smart/multi/playlist/search/rerun/show/season/artist references are not aggregated in this pass). /// Callers should treat a null as "unknown", never as zero. /// /// public TimeSpan? DurationEstimate { get; init; } public string Name => CollectionType switch { CollectionType.Collection => Collection?.Name, CollectionType.TelevisionShow => MediaItem?.Name, // $"{TelevisionShow?.Title} ({TelevisionShow?.Year})", CollectionType.TelevisionSeason => MediaItem?.Name, // $"{TelevisionSeason?.Title} ({TelevisionSeason?.Plot})", CollectionType.Artist => MediaItem?.Name, CollectionType.MultiCollection => MultiCollection?.Name, CollectionType.SmartCollection => SmartCollection?.Name, CollectionType.SearchQuery => string.IsNullOrWhiteSpace(SearchTitle) ? SearchQuery : SearchTitle, CollectionType.Playlist => Playlist?.Name, CollectionType.RerunFirstRun or CollectionType.RerunRerun => RerunCollection?.Name, _ => string.Empty }; }