diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-19 20:07:52 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-19 20:07:52 (GMT) |
commit | 5559994f6c1cde34cb806fbc6bcc30e0ac4751f0 (patch) | |
tree | e5c4d2a589bea324523e735ff4cd2db8f41c25c7 /src/helsinki.at/rhimport | |
parent | 1f3dab1eab175c4c0e4d4d6d3c339daf02899ca9 (diff) |
tested music pool import, cleaned up help output for telnet interface
Diffstat (limited to 'src/helsinki.at/rhimport')
-rw-r--r-- | src/helsinki.at/rhimport/importer.go | 7 | ||||
-rw-r--r-- | src/helsinki.at/rhimport/rddb.go | 4 |
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) |