notes

package
v0.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package notes keeps meeting transcripts: the on-disk store of each room's last meeting, its Markdown rendering and expiry. The phrases come from the notes bot of the kunveno-notes add-on.

Index

Constants

View Source
const (
	KindHeader  = "header"
	KindPhrase  = "phrase"
	KindPaused  = "paused"
	KindResumed = "resumed"
	KindEnd     = "end"
)

Line kinds of a transcript file.

View Source
const MergeGap = 30 * time.Second

MergeGap: consecutive phrases of one speaker no further apart than this share a paragraph.

Variables

View Source
var (
	ErrBadSlug = errors.New("notes: bad room slug")
	ErrNoNotes = errors.New("notes: none ready for this room")
	ErrNotOpen = errors.New("notes: the room has no open transcript")
	// ErrRecording: the room's notes are still being recorded and cannot be deleted.
	ErrRecording = errors.New("notes: still being recorded")
)
View Source
var (
	ErrNoSummary = errors.New("notes: no summary for this meeting")
	// ErrStale: the meeting has no ready notes that ended at the given time.
	ErrStale = errors.New("notes: these notes are no longer the meeting's")
)

Functions

func FileName

func FileName(slug string, start time.Time, loc *time.Location) string

FileName is the download's name: the room and the meeting's start.

func Lang

func Lang(s string) string

Lang returns a language Markdown has labels for: ru, en or es; anything else is ru.

func Markdown

func Markdown(t Transcript, lang string, loc *time.Location) []byte

Markdown renders a transcript: a title with the room, the date and time span with everyone who spoke, then one paragraph per run of one speaker and a line per pause or resumption (a pause at the very end is left out).

func ParseKeep

func ParseKeep(s string) (time.Duration, error)

ParseKeep reads notes.keep: a positive whole number and exactly one unit, m, h or d ("90m", "12h", "1d", "2d"). Anything else ("2d12h", "1w", "0d", "1.5h", "") is an error.

func SummaryFileName added in v0.6.0

func SummaryFileName(slug string, start time.Time, loc *time.Location) string

SummaryFileName is the summary download's name: the room, the meeting's start and "summary".

func SummaryMarkdown added in v0.6.0

func SummaryMarkdown(sm Summary, lang string, loc *time.Location) []byte

SummaryMarkdown is the summary file: a title with the room, the meeting's date and time span, a note that it was written automatically, then the add-on's Markdown as it came.

Types

type Event

type Event struct {
	Kind string
	At   time.Time
}

Event is a pause (KindPaused) or a resumption (KindResumed) of the recording.

type Gone added in v0.7.0

type Gone struct {
	Slug    string
	Meeting int64
}

Gone names notes the expiry sweep removed.

type Kept added in v0.7.0

type Kept struct {
	Meeting int64     // the meeting's start, Unix ms
	Ended   time.Time // when its notes ended
	Until   time.Time // until when they are kept
}

Kept describes one meeting's ready notes.

type Pending added in v0.6.0

type Pending struct {
	Slug    string
	Meeting int64 // the meeting's start, Unix ms
	End     int64 // the notes' end, Unix ms
}

Pending names a meeting's ready notes that wait for a summary.

type Phrase

type Phrase struct {
	Name       string
	Start, End time.Time
	Text       string
}

Phrase is one recognised utterance.

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store keeps the transcript of every meeting of every room as dir/<slug>/<meeting>.jsonl, one JSON object per line, appended as the meeting goes; a restart loses nothing already written. Each transcript is kept for keep after it ends. Safe for concurrent use.

func Open

func Open(dir string, keep time.Duration, now func() time.Time) (*Store, error)

Open reads the transcripts in dir (a missing dir holds none), after moving the files of the layout that kept only each room's last meeting (migrate.go). A file without an end line was cut off by a restart: it gets one at the time of its last line. A file that cannot be read is logged and skipped, left on disk as it is; only a failure to list dir is an error.

func (*Store) Begin

func (s *Store) Begin(slug, room string, start time.Time) error

Begin starts the transcript of a meeting that starts at start. The room's earlier meetings stay; a transcript of the same meeting (gone or expired meanwhile) is started again.

func (*Store) Bytes added in v0.7.0

func (s *Store) Bytes() int64

Bytes is how much the notes and summaries take on disk.

func (*Store) Current added in v0.7.0

func (s *Store) Current(slug string) (int64, bool)

Current returns the meeting the room's notes were last begun for; false when none.

func (*Store) Delete

func (s *Store) Delete(slug string) error

Delete removes everything the room keeps, for a deleted room. The room is forgotten even when its directory cannot be removed (the error is returned), so a room created again under the same slug never inherits the old notes while the server runs; Open reads what stayed after a restart, and it expires by its own end times.

func (*Store) DeleteEnded added in v0.3.3

func (s *Store) DeleteEnded(slug string, meeting int64) error

DeleteEnded removes one meeting's ready notes at a person's request: ErrRecording while they are open, ErrNoNotes when there are none or they have expired. The meeting's summary stays. When the file cannot be removed the notes stay listed and the error is returned, so the request can be repeated.

func (*Store) DeleteSummary added in v0.6.0

func (s *Store) DeleteSummary(slug string, meeting int64) error

DeleteSummary deletes the meeting's summary at a person's request, whether it is written, still pending or failed; the notes stay, and while they do no summary is written for them again. ErrNoSummary when there is nothing to delete.

func (*Store) End

func (s *Store) End(slug string, at time.Time) error

End closes the room's open transcript: it is ready for download until at plus keep.

func (*Store) EndedAt added in v0.6.0

func (s *Store) EndedAt(slug string, meeting int64) (int64, bool)

EndedAt returns the end of the meeting's ready notes in Unix ms; false when there are none.

func (*Store) FailSummary added in v0.6.0

func (s *Store) FailSummary(slug string, meeting, end int64) error

FailSummary records that the add-on gave up on the meeting's notes that ended at end, until a restart.

func (*Store) Has added in v0.7.0

func (s *Store) Has(slug string, meeting int64) bool

Has reports whether the meeting still keeps notes (open or ready) or a summary.

func (*Store) Latest added in v0.7.0

func (s *Store) Latest(slug string) (int64, bool)

Latest returns the room's newest meeting with ready notes.

func (*Store) LatestSummary added in v0.7.0

func (s *Store) LatestSummary(slug string) (int64, bool)

LatestSummary returns the room's newest meeting that has a summary in any state.

func (*Store) List added in v0.7.0

func (s *Store) List(slug string) []Kept

List returns the room's ready notes, newest meeting first.

func (*Store) Load

func (s *Store) Load(slug string, meeting int64) (Transcript, error)

Load reads the meeting's ready notes; ErrNoNotes when there are none to download.

func (*Store) LoadSummary added in v0.6.0

func (s *Store) LoadSummary(slug string, meeting int64) (Summary, error)

LoadSummary reads the meeting's stored summary; ErrNoSummary when there is none.

func (*Store) Meeting added in v0.4.0

func (s *Store) Meeting(slug string) (time.Time, bool)

Meeting returns the start of the meeting of the room's newest ready notes.

func (*Store) MeetingEndedAt added in v0.7.0

func (s *Store) MeetingEndedAt(slug string, end int64) (int64, bool)

MeetingEndedAt finds the room's meeting whose ready notes ended at end.

func (*Store) Pause

func (s *Store) Pause(slug string, at time.Time) error

Pause records that the notes were switched off.

func (*Store) PendingSummaries added in v0.6.0

func (s *Store) PendingSummaries() []Pending

PendingSummaries lists the ready notes with no summary that nobody deleted and the add-on has not given up on, by room and meeting.

func (*Store) Phrase

func (s *Store) Phrase(slug string, p Phrase) error

Phrase appends a phrase to the room's open transcript.

func (*Store) PutSummary added in v0.6.0

func (s *Store) PutSummary(slug string, meeting, end int64, body []byte) error

PutSummary stores the summary of the meeting's ready notes that ended at end; ErrStale for any other notes or a summary a person deleted.

func (*Store) Resume

func (s *Store) Resume(slug string, at time.Time) error

Resume records that the notes were switched on again; it reopens the room's last transcript when it has ended.

func (*Store) SummaryMeetings added in v0.7.0

func (s *Store) SummaryMeetings(slug string) []int64

SummaryMeetings lists the room's meetings that have a summary in any state, newest first.

func (*Store) SummaryState added in v0.6.0

func (s *Store) SummaryState(slug string, meeting int64) SummaryState

SummaryState says what the meeting has of a summary.

func (*Store) SummaryUntil added in v0.6.0

func (s *Store) SummaryUntil(slug string, meeting int64) (time.Time, bool)

SummaryUntil is until when the meeting shows its summary: a stored one until its expiry, a pending or failed one as long as its notes; false for SummaryNone.

func (*Store) Sweep

func (s *Store) Sweep() []Gone

Sweep deletes expired notes and returns them, sorted; it also deletes expired summaries and the directories of rooms left with nothing.

func (*Store) Until

func (s *Store) Until(slug string) (time.Time, bool)

Until reports until when the room's newest ready notes are kept; false when it has none.

type Summary added in v0.6.0

type Summary struct {
	Room       string
	Start, End time.Time
	Body       []byte
}

Summary is a meeting's summary with what its file's header needs.

type SummaryState added in v0.6.0

type SummaryState string

SummaryState is what a meeting has of a summary.

const (
	SummaryNone    SummaryState = ""        // no summary and no ready notes waiting for one
	SummaryPending SummaryState = "pending" // ready notes, the summary not written yet
	SummaryReady   SummaryState = "ready"
	SummaryFailed  SummaryState = "failed" // the add-on gave up on these notes
)

type Transcript

type Transcript struct {
	Slug, Room string
	Start, End time.Time
	Phrases    []Phrase
	Events     []Event
}

Transcript is one meeting's notes as read back from the store.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL