summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-12-28 23:30:35 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-12-28 23:30:35 (GMT)
commita4ca5df0fb2f7178b607db7a95a990d2d5372ee1 (patch)
tree4c61cbc3ebe5d45ad4e3170b57a665969acf4f2a
parent61c2fe8fa55e1406b0d3903f7433d6b841fdcb44 (diff)
add user-defined to pool cart list
-rw-r--r--rddb/rddb.go21
1 files changed, 11 insertions, 10 deletions
diff --git a/rddb/rddb.go b/rddb/rddb.go
index 2a1c743..f2a44a7 100644
--- a/rddb/rddb.go
+++ b/rddb/rddb.go
@@ -295,12 +295,13 @@ type CutListEntry struct {
}
type CartListEntry struct {
- Number uint
- Exists bool
- Artist string
- Title string
- Album string
- Cuts []CutListEntry
+ Number uint
+ Exists bool
+ Artist string
+ Title string
+ Album string
+ UserDefined string
+ Cuts []CutListEntry
}
type getShowCartListResult struct {
@@ -492,7 +493,7 @@ func (d *db) init() (err error) {
if d.getPoolListStmt, err = d.dbh.Prepare("select GROUPS.NAME,DROPBOXES.SET_USER_DEFINED,DROPBOXES.PATH,GROUPS.DESCRIPTION from USER_PERMS, DROPBOXES, GROUPS where USER_PERMS.USER_NAME = ? and DROPBOXES.GROUP_NAME = USER_PERMS.GROUP_NAME and DROPBOXES.GROUP_NAME = GROUPS.NAME and DROPBOXES.STATION_NAME = ?;"); err != nil {
return
}
- if d.getPoolCartsStmt, err = d.dbh.Prepare("select CART.NUMBER,CART.ARTIST,CART.TITLE,CART.ALBUM,CUTS.CUT_NAME,CUTS.EVERGREEN,CUTS.DESCRIPTION,CUTS.LENGTH,CUTS.ORIGIN_DATETIME,CUTS.PLAY_COUNTER,CUTS.LAST_PLAY_DATETIME from CUTS,CART where CUTS.CART_NUMBER = CART.NUMBER and CART.GROUP_NAME = ?;"); err != nil {
+ if d.getPoolCartsStmt, err = d.dbh.Prepare("select CART.NUMBER,CART.ARTIST,CART.TITLE,CART.ALBUM,CART.USER_DEFINED,CUTS.CUT_NAME,CUTS.EVERGREEN,CUTS.DESCRIPTION,CUTS.LENGTH,CUTS.ORIGIN_DATETIME,CUTS.PLAY_COUNTER,CUTS.LAST_PLAY_DATETIME from CUTS,CART where CUTS.CART_NUMBER = CART.NUMBER and CART.GROUP_NAME = ?;"); err != nil {
return
}
if d.getGroupDefaultTitleStmt, err = d.dbh.Prepare("select DEFAULT_TITLE from GROUPS where NAME = ?;"); err != nil {
@@ -800,9 +801,9 @@ func (d *db) getPoolCartList(pool PoolListEntry) (result getPoolCartListResult)
var cut CutListEntry
var cart, length uint
var cutName, evergreen string
- var artist, title, album sql.NullString
+ var artist, title, album, userDefined sql.NullString
- if result.err = rows.Scan(&cart, &artist, &title, &album, &cutName, &evergreen, &cut.Description, &length, &cut.Imported, &cut.NumPlayed, &cut.LastPlayed); result.err != nil {
+ if result.err = rows.Scan(&cart, &artist, &title, &album, &userDefined, &cutName, &evergreen, &cut.Description, &length, &cut.Imported, &cut.NumPlayed, &cut.LastPlayed); result.err != nil {
return
}
@@ -825,7 +826,7 @@ func (d *db) getPoolCartList(pool PoolListEntry) (result getPoolCartListResult)
cut.Duration = time.Duration(length) * time.Millisecond
if c, exists := result.carts[cart]; !exists {
- c = CartListEntry{cart, true, artist.String, title.String, album.String, nil}
+ c = CartListEntry{cart, true, artist.String, title.String, album.String, userDefined.String, nil}
c.Cuts = append(c.Cuts, cut)
result.carts[cart] = c
} else {