Files
radiantwave-legacy/internal/db/Schema.go
T
NeilClack 91711eef93 Replace AudioFile with AudioTrack, fix download+orphan+MD5 sync, always play original audio fallback
AudioTrack table replaces AudioFile (Filename, Name, AssignedFrequency,
MD5, Selected, Order) — fixes relative-path bug in scrollerPage.go that
caused "file not found" for single-track selection.

Download goroutine now:
  - Accepts *gorm.DB and updates AudioTrack.MD5 after each download.
  - Treats checksums.md5 as source of truth: removes local files and DB
    records not in the manifest (orphans).
  - Strips "./" prefix from manifest filenames (GNU md5sum format).

AudioOptions.go seeds 14 AudioTrack records matching server checksums.md5.
List background quad width matches the widest item (+ padding), centered.

scrollerPage.go switchAudioForFrequency falls back to original/selected
audio when a frequency has no matching track or file.  playOriginalAudio
is a no-op on repeat calls to avoid 5-second audio restart loop.

Fixes progress display: passes Max=0 during downloads so Home page shows
"x / X Files Downloaded" text instead of bogus "100.0%" percentage.

Downstream audio switching (DynamicAudio) verifies an AudioTrack exists
for the frequency before assigning it to a stream — frequencies without
a track (e.g. 528 Hz) gracefully use original audio instead.
2026-07-29 16:19:15 -05:00

62 lines
1.6 KiB
Go

// schema.go defines the database schema for the GORM models.
package db
import "gorm.io/gorm"
type AppConfig struct {
gorm.Model
DataDir string
AssetsDir string
EmailAddress string
LicenseKey string
SystemLevel string // BASIC, ADVANCED, ELITE, COMMERCIAL
SelectedAudioDevice string // The pipewire device name
InitialFontSize int // How large to create the font atlas
StandardFontSize int // The font size used for most text rendering
LinePattern string // "fibonacci"
AudioEnabled bool
DynamicAudio bool // When true, scroller switches audio per-proclamation frequency
SavedVolume float64 // Last saved volume as a percentage
FirstRun bool // Is this the first time the application has been run?
}
type Log struct {
gorm.Model
Timestamp int64
Level string
Message string
}
type Proclamation struct {
ID string `gorm:"primaryKey"`
Name string
Content string
SolfeggioFrequencyID int
CategoryID int
Selected bool
Available bool
Price float64
}
type ProclamationCategory struct {
ID int `gorm:"primaryKey"`
Name string
ParentId int
}
type SolfeggioFrequency struct {
ID int `gorm:"primaryKey"`
Name string
Value int
}
type AudioTrack struct {
ID int `gorm:"primaryKey"`
Filename string
Name string
AssignedFrequency int
MD5 string
Selected bool
Order int
}