From a4ca5df0fb2f7178b607db7a95a990d2d5372ee1 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Thu, 29 Dec 2016 00:30:35 +0100 Subject: add user-defined to pool cart list 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 { -- cgit v0.10.2