Subsonic: internet radio, chat, bookmarks, play queue, scanner status endpoints

This commit is contained in:
2026-08-23 00:21:13 -05:00
parent c6e0131984
commit d92a25b141
13 changed files with 682 additions and 2 deletions
+7 -2
View File
@@ -144,6 +144,8 @@ type Bookmark struct {
SongID string
PositionMs int
Comment string
CreatedAt time.Time
UpdatedAt time.Time
}
func SetBookmark(db *sql.DB, userID, songID string, positionMs int, comment string) error {
@@ -159,7 +161,7 @@ func DeleteBookmark(db *sql.DB, userID, songID string) error {
}
func ListBookmarks(db *sql.DB, userID string) ([]*Bookmark, error) {
rows, err := db.Query(`SELECT id, song_id, position_ms, comment FROM bookmarks WHERE user_id = ? ORDER BY updated_at DESC`, userID)
rows, err := db.Query(`SELECT id, song_id, position_ms, comment, created_at, updated_at FROM bookmarks WHERE user_id = ? ORDER BY updated_at DESC`, userID)
if err != nil {
return nil, err
}
@@ -167,9 +169,12 @@ func ListBookmarks(db *sql.DB, userID string) ([]*Bookmark, error) {
var out []*Bookmark
for rows.Next() {
var b Bookmark
if err := rows.Scan(&b.ID, &b.SongID, &b.PositionMs, &b.Comment); err != nil {
var createdAt, updatedAt string
if err := rows.Scan(&b.ID, &b.SongID, &b.PositionMs, &b.Comment, &createdAt, &updatedAt); err != nil {
return nil, err
}
b.CreatedAt, _ = parseTime(createdAt)
b.UpdatedAt, _ = parseTime(updatedAt)
out = append(out, &b)
}
return out, rows.Err()