feat: daily vani
This commit is contained in:
@@ -12,6 +12,7 @@ type VaniPayload struct {
|
|||||||
Subtitle string `json:"subtitle"` // short excerpt or date · place
|
Subtitle string `json:"subtitle"` // short excerpt or date · place
|
||||||
Href string `json:"href"` // in-app path to open the item
|
Href string `json:"href"` // in-app path to open the item
|
||||||
BookTitle string `json:"book_title,omitempty"` // e.g. "Bhagavad-gītā As It Is"
|
BookTitle string `json:"book_title,omitempty"` // e.g. "Bhagavad-gītā As It Is"
|
||||||
|
Date string `json:"date,omitempty"` // transcript date, for the "Lecture • DATE" line
|
||||||
}
|
}
|
||||||
|
|
||||||
// VaniPick is one persisted day's choice. RefID is `<kind>:<mongo _id hex>` and
|
// VaniPick is one persisted day's choice. RefID is `<kind>:<mongo _id hex>` and
|
||||||
|
|||||||
@@ -145,28 +145,20 @@ func transcriptPick(t *repository.TranscriptionDoc, day time.Time) *model.VaniPi
|
|||||||
if t.Type == "conversation" {
|
if t.Type == "conversation" {
|
||||||
label = "Conversation"
|
label = "Conversation"
|
||||||
}
|
}
|
||||||
// Prefer a date · place line; fall back to the first spoken line.
|
date := ""
|
||||||
var bits []string
|
if t.Date != nil {
|
||||||
if t.Date != nil && *t.Date != "" {
|
date = *t.Date
|
||||||
bits = append(bits, *t.Date)
|
|
||||||
}
|
|
||||||
if t.Place != nil && *t.Place != "" {
|
|
||||||
bits = append(bits, *t.Place)
|
|
||||||
}
|
|
||||||
subtitle := strings.Join(bits, " · ")
|
|
||||||
if subtitle == "" && len(t.Content) > 0 {
|
|
||||||
subtitle = excerpt(t.Content[0].Text, 140)
|
|
||||||
}
|
}
|
||||||
return &model.VaniPick{
|
return &model.VaniPick{
|
||||||
Day: day,
|
Day: day,
|
||||||
Kind: "transcript",
|
Kind: "transcript",
|
||||||
RefID: "transcript:" + t.ID.Hex(),
|
RefID: "transcript:" + t.ID.Hex(),
|
||||||
Payload: model.VaniPayload{
|
Payload: model.VaniPayload{
|
||||||
Kind: "transcript",
|
Kind: "transcript",
|
||||||
Label: label,
|
Label: label,
|
||||||
Title: t.Name,
|
Title: t.Name,
|
||||||
Subtitle: subtitle,
|
Href: "/transcriptions/" + t.Slug,
|
||||||
Href: "/transcriptions/" + t.Slug,
|
Date: date,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user