summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--importer.go7
-rw-r--r--rddb.go4
2 files changed, 8 insertions, 3 deletions
diff --git a/importer.go b/importer.go
index afe422f..1404259 100644
--- a/importer.go
+++ b/importer.go
@@ -106,6 +106,9 @@ func (ctx *ImportContext) SanityCheck() error {
if !ismusic {
return fmt.Errorf("supplied GroupName is not a music pool")
}
+ if ctx.Cart != 0 || ctx.Cut != 0 {
+ return fmt.Errorf("Cart and Cut must not be supplied when importing into a music group")
+ }
return nil
}
if ctx.Cart == 0 {
@@ -193,6 +196,8 @@ func (ctx *ImportContext) getMusicInfo() (err error) {
ctx.AutotrimLevel = res.trim_lvl
ctx.Channels = 2
ctx.UseMetaData = true
+ ctx.Cart = 0
+ ctx.Cut = 0
return
}
@@ -624,7 +629,7 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) {
if err = ctx.getMusicInfo(); err != nil {
return
}
- if err = remove_add_cart_cut(ctx, res); err != nil || res.ResponseCode != http.StatusOK {
+ if err = add_cart_cut(ctx, res); err != nil || res.ResponseCode != http.StatusOK {
return
}
rmCartOnErr = true
diff --git a/rddb.go b/rddb.go
index 28fa6bd..25ef876 100644
--- a/rddb.go
+++ b/rddb.go
@@ -247,7 +247,7 @@ func (self *RdDb) getShowInfo(showid uint) (result getShowInfoResult) {
func (self *RdDb) checkMusicGroup(group string) (result checkMusicGroupResult) {
var cnt int
- if result.err = self.getMusicInfoStmt.QueryRow(group).Scan(&cnt); result.err != nil {
+ if result.err = self.checkMusicGroupStmt.QueryRow(group).Scan(&cnt); result.err != nil {
if result.err == sql.ErrNoRows {
result.err = nil
result.ismusic = false
@@ -259,7 +259,7 @@ func (self *RdDb) checkMusicGroup(group string) (result checkMusicGroupResult) {
}
func (self *RdDb) getMusicInfo(group string) (result getMusicInfoResult) {
- result.err = self.checkMusicGroupStmt.QueryRow(group).Scan(&result.norm_lvl, &result.trim_lvl)
+ result.err = self.getMusicInfoStmt.QueryRow(group).Scan(&result.norm_lvl, &result.trim_lvl)
if result.err != nil {
if result.err == sql.ErrNoRows {
result.err = fmt.Errorf("music pool '%s' not found", group)