summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimport
diff options
context:
space:
mode:
Diffstat (limited to 'src/helsinki.at/rhimport')
-rw-r--r--src/helsinki.at/rhimport/importer.go7
-rw-r--r--src/helsinki.at/rhimport/rddb.go4
2 files changed, 8 insertions, 3 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go
index afe422f..1404259 100644
--- a/src/helsinki.at/rhimport/importer.go
+++ b/src/helsinki.at/rhimport/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/src/helsinki.at/rhimport/rddb.go b/src/helsinki.at/rhimport/rddb.go
index 28fa6bd..25ef876 100644
--- a/src/helsinki.at/rhimport/rddb.go
+++ b/src/helsinki.at/rhimport/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)