diff --git a/src/MyWebLog.Data/SQLiteData.fs b/src/MyWebLog.Data/SQLiteData.fs index 89caa0c..c8248a9 100644 --- a/src/MyWebLog.Data/SQLiteData.fs +++ b/src/MyWebLog.Data/SQLiteData.fs @@ -318,6 +318,8 @@ type SQLiteData (conn : SqliteConnection, log : ILogger, ser : JsonS Subtitle = Map.tryString "subtitle" epRdr Explicit = Map.tryString "explicit" epRdr |> Option.map ExplicitRating.parse + Chapters = Map.tryString "chapters" epRdr + |> Option.map (Utils.deserialize ser) ChapterFile = Map.tryString "chapter_file" epRdr ChapterType = Map.tryString "chapter_type" epRdr TranscriptUrl = Map.tryString "transcript_url" epRdr diff --git a/src/MyWebLog.Domain/SupportTypes.fs b/src/MyWebLog.Domain/SupportTypes.fs index 1ece831..fb277ba 100644 --- a/src/MyWebLog.Domain/SupportTypes.fs +++ b/src/MyWebLog.Domain/SupportTypes.fs @@ -161,6 +161,41 @@ module ExplicitRating = | x -> raise (invalidArg "rating" $"{x} is not a valid explicit rating") +/// A location (specified by Podcast Index) +type Location = + { /// The name of the location (free-form text) + Name : string + + /// A geographic coordinate string (RFC 5870) + Geo : string option + + /// An OpenStreetMap query + Osm : string option + } + + +/// A chapter in a podcast episode +type Chapter = + { /// The start time for the chapter + StartTime : Duration + + /// The title for this chapter + Title : string option + + /// A URL for an image for this chapter + ImageUrl : string option + + /// Whether this chapter is hidden + IsHidden : bool option + + /// The episode end time for the chapter + EndTime : Duration option + + /// A location that applies to a chapter + Location : Location option + } + + open NodaTime.Text /// A podcast episode @@ -186,6 +221,9 @@ type Episode = /// This episode's explicit rating (overrides podcast rating if present) Explicit : ExplicitRating option + /// Chapters for this episode + Chapters : Chapter list option + /// A link to a chapter file ChapterFile : string option @@ -229,6 +267,7 @@ module Episode = ImageUrl = None Subtitle = None Explicit = None + Chapters = None ChapterFile = None ChapterType = None TranscriptUrl = None diff --git a/src/MyWebLog.Domain/ViewModels.fs b/src/MyWebLog.Domain/ViewModels.fs index 61ece89..86f00a7 100644 --- a/src/MyWebLog.Domain/ViewModels.fs +++ b/src/MyWebLog.Domain/ViewModels.fs @@ -788,6 +788,7 @@ type EditPostModel = ImageUrl = noneIfBlank this.ImageUrl Subtitle = noneIfBlank this.Subtitle Explicit = noneIfBlank this.Explicit |> Option.map ExplicitRating.parse + Chapters = match post.Episode with Some e -> e.Chapters | None -> None ChapterFile = noneIfBlank this.ChapterFile ChapterType = noneIfBlank this.ChapterType TranscriptUrl = noneIfBlank this.TranscriptUrl