Add chapter data type (#6)
This commit is contained in:
parent
79c304493c
commit
b84a0f711f
@ -318,6 +318,8 @@ type SQLiteData (conn : SqliteConnection, log : ILogger<SQLiteData>, ser : JsonS
|
|||||||
Subtitle = Map.tryString "subtitle" epRdr
|
Subtitle = Map.tryString "subtitle" epRdr
|
||||||
Explicit = Map.tryString "explicit" epRdr
|
Explicit = Map.tryString "explicit" epRdr
|
||||||
|> Option.map ExplicitRating.parse
|
|> Option.map ExplicitRating.parse
|
||||||
|
Chapters = Map.tryString "chapters" epRdr
|
||||||
|
|> Option.map (Utils.deserialize<Chapter list> ser)
|
||||||
ChapterFile = Map.tryString "chapter_file" epRdr
|
ChapterFile = Map.tryString "chapter_file" epRdr
|
||||||
ChapterType = Map.tryString "chapter_type" epRdr
|
ChapterType = Map.tryString "chapter_type" epRdr
|
||||||
TranscriptUrl = Map.tryString "transcript_url" epRdr
|
TranscriptUrl = Map.tryString "transcript_url" epRdr
|
||||||
|
@ -161,6 +161,41 @@ module ExplicitRating =
|
|||||||
| x -> raise (invalidArg "rating" $"{x} is not a valid explicit rating")
|
| 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
|
open NodaTime.Text
|
||||||
|
|
||||||
/// A podcast episode
|
/// A podcast episode
|
||||||
@ -186,6 +221,9 @@ type Episode =
|
|||||||
/// This episode's explicit rating (overrides podcast rating if present)
|
/// This episode's explicit rating (overrides podcast rating if present)
|
||||||
Explicit : ExplicitRating option
|
Explicit : ExplicitRating option
|
||||||
|
|
||||||
|
/// Chapters for this episode
|
||||||
|
Chapters : Chapter list option
|
||||||
|
|
||||||
/// A link to a chapter file
|
/// A link to a chapter file
|
||||||
ChapterFile : string option
|
ChapterFile : string option
|
||||||
|
|
||||||
@ -229,6 +267,7 @@ module Episode =
|
|||||||
ImageUrl = None
|
ImageUrl = None
|
||||||
Subtitle = None
|
Subtitle = None
|
||||||
Explicit = None
|
Explicit = None
|
||||||
|
Chapters = None
|
||||||
ChapterFile = None
|
ChapterFile = None
|
||||||
ChapterType = None
|
ChapterType = None
|
||||||
TranscriptUrl = None
|
TranscriptUrl = None
|
||||||
|
@ -788,6 +788,7 @@ type EditPostModel =
|
|||||||
ImageUrl = noneIfBlank this.ImageUrl
|
ImageUrl = noneIfBlank this.ImageUrl
|
||||||
Subtitle = noneIfBlank this.Subtitle
|
Subtitle = noneIfBlank this.Subtitle
|
||||||
Explicit = noneIfBlank this.Explicit |> Option.map ExplicitRating.parse
|
Explicit = noneIfBlank this.Explicit |> Option.map ExplicitRating.parse
|
||||||
|
Chapters = match post.Episode with Some e -> e.Chapters | None -> None
|
||||||
ChapterFile = noneIfBlank this.ChapterFile
|
ChapterFile = noneIfBlank this.ChapterFile
|
||||||
ChapterType = noneIfBlank this.ChapterType
|
ChapterType = noneIfBlank this.ChapterType
|
||||||
TranscriptUrl = noneIfBlank this.TranscriptUrl
|
TranscriptUrl = noneIfBlank this.TranscriptUrl
|
||||||
|
Loading…
Reference in New Issue
Block a user