summaryrefslogtreecommitdiff
path: root/rddb
diff options
context:
space:
mode:
Diffstat (limited to 'rddb')
-rw-r--r--rddb/rddb.go38
1 files changed, 36 insertions, 2 deletions
diff --git a/rddb/rddb.go b/rddb/rddb.go
index 29a87af..638c360 100644
--- a/rddb/rddb.go
+++ b/rddb/rddb.go
@@ -29,6 +29,7 @@ import (
"fmt"
"regexp"
"strings"
+ "time"
"github.com/ziutek/mymysql/godrv"
)
@@ -99,10 +100,25 @@ type getMusicInfoRequest struct {
response chan<- getMusicInfoResult
}
+type CutListEntry struct {
+ Number uint
+ Description string
+}
+
+type CartListEntry struct {
+ Number uint
+ Title string
+ Duration time.Duration
+ Imported time.Time
+ NumPlayed uint
+ LastPlayed time.Time
+ Cuts []*CutListEntry
+}
+
type ShowListEntry struct {
ID uint
Title string
- Carts []uint
+ Carts []*CartListEntry
}
type getShowListResult struct {
@@ -294,6 +310,13 @@ func (db *DB) getMusicInfo(group string) (result getMusicInfoResult) {
return
}
+func (db *DB) getCartInfo(cart uint) (c *CartListEntry, err error) {
+ c = &CartListEntry{}
+ c.Number = cart
+ c.Title = fmt.Sprintf("Title of Cart: %d", cart)
+ return
+}
+
func (db *DB) getShowList(username string) (result getShowListResult) {
var rows *sql.Rows
if rows, result.err = db.getShowListStmt.Query(username, dropboxPseudoStation); result.err != nil {
@@ -310,7 +333,18 @@ func (db *DB) getShowList(username string) (result getShowListResult) {
return
}
- show.Carts, result.err = db.getShowCarts(showMacroRe.FindStringSubmatch(macros)[1], lowCart, highCart)
+ var carts []uint
+ if carts, result.err = db.getShowCarts(showMacroRe.FindStringSubmatch(macros)[1], lowCart, highCart); result.err != nil {
+ return
+ }
+
+ for _, cart := range carts {
+ var c *CartListEntry
+ if c, result.err = db.getCartInfo(cart); result.err != nil {
+ return
+ }
+ show.Carts = append(show.Carts, c)
+ }
result.shows = append(result.shows, show)
}