finish setup data insertion, add world insertion

This commit is contained in:
lbenedar
2026-04-22 18:18:43 +03:00
parent 21abe68858
commit f46ff8333e
66 changed files with 2257 additions and 676 deletions

View File

@@ -20,28 +20,30 @@ type Playlist struct {
// Flags any `json:"flags,omitempty"`
}
func (p *Playlist) ToDB(dest *db.Playlist) bool {
func (p *Playlist) ToDB(dest **db.Playlist) bool {
if dest == nil {
return false
}
dest.Name = p.Name
dest.ID = p.ID
dest.Mode = p.Mode
dest.Playing = p.Playing
dest.Fade = p.Fade
dest.Folder = p.Folder
dest.Sorting = p.Sorting
dest.Seed = p.Seed
dest.Sort = p.Sort
dest.Description = p.Description
dest.Channel = p.Channel
playlist := &db.Playlist{
Name: p.Name,
ID: p.ID,
Mode: p.Mode,
Playing: p.Playing,
Fade: p.Fade,
Folder: p.Folder,
Sorting: p.Sorting,
Seed: p.Seed,
Sort: p.Sort,
Description: p.Description,
Channel: p.Channel,
}
p.Stats.ToDB(&dest.Stats)
p.Stats.ToDB(&playlist.Stats)
OwnershipToDB(&dest.Ownership, p.Ownership)
OwnershipToDB(&playlist.Ownership, p.Ownership)
CopySliceToDB(&dest.Sounds, p.Sounds)
CopySliceToDB(&playlist.Sounds, p.Sounds)
return true
}
@@ -61,22 +63,26 @@ type Sound struct {
// Flags any `json:"flags"`
}
func (s *Sound) ToDB(dest *db.Sound) bool {
func (s *Sound) ToDB(dest **db.Sound) bool {
if dest == nil {
return false
}
dest.Name = s.Name
dest.Path = s.Path
dest.ID = s.ID
dest.Playing = s.Playing
dest.PausedTime = s.PausedTime
dest.Repeat = s.Repeat
dest.Volume = s.Volume
dest.Fade = s.Fade
dest.Sort = s.Sort
dest.Channel = s.Channel
dest.Description = s.Description
sound := &db.Sound{
Name: s.Name,
Path: s.Path,
ID: s.ID,
Playing: s.Playing,
PausedTime: s.PausedTime,
Repeat: s.Repeat,
Volume: s.Volume,
Fade: s.Fade,
Sort: s.Sort,
Channel: s.Channel,
Description: s.Description,
}
*dest = sound
return true
}