diff options
Diffstat (limited to 'src/helsinki.at/rhimport/importer.go')
-rw-r--r-- | src/helsinki.at/rhimport/importer.go | 72 |
1 files changed, 8 insertions, 64 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go index 7ce4033..28ca55a 100644 --- a/src/helsinki.at/rhimport/importer.go +++ b/src/helsinki.at/rhimport/importer.go @@ -142,84 +142,28 @@ func (ctx *ImportContext) SanityCheck() error { } func (ctx *ImportContext) getPassword(cached bool) (err error) { - res_ch := make(chan getPasswordResult) - req := getPasswordRequest{} - req.username = ctx.UserName - req.cached = cached - req.response = res_ch - ctx.rddb.getPasswordChan <- req - - res := <-res_ch - if res.err != nil { - return res.err - } - ctx.Password = res.password - return nil + ctx.Password, err = ctx.rddb.GetPassword(ctx.UserName, cached) + return } -func (ctx *ImportContext) getGroupOfCart() error { - res_ch := make(chan getGroupOfCartResult) - req := getGroupOfCartRequest{} - req.cart = ctx.Cart - req.response = res_ch - ctx.rddb.getGroupOfCartChan <- req - - res := <-res_ch - if res.err != nil { - return res.err - } - ctx.GroupName = res.group - return nil +func (ctx *ImportContext) getGroupOfCart() (err error) { + ctx.GroupName, err = ctx.rddb.GetGroupOfCart(ctx.Cart) + return } func (ctx *ImportContext) getShowInfo() (carts []uint, err error) { - res_ch := make(chan getShowInfoResult) - req := getShowInfoRequest{} - req.showid = ctx.ShowId - req.response = res_ch - ctx.rddb.getShowInfoChan <- req - - res := <-res_ch - if res.err != nil { - err = res.err - return - } - ctx.GroupName = res.group - ctx.NormalizationLevel = res.norm_lvl - ctx.AutotrimLevel = res.trim_lvl + ctx.GroupName, ctx.NormalizationLevel, ctx.AutotrimLevel, carts, err = ctx.rddb.GetShowInfo(ctx.ShowId) ctx.Channels = 2 ctx.UseMetaData = true - carts = res.carts return } func (ctx *ImportContext) checkMusicGroup() (bool, error) { - res_ch := make(chan checkMusicGroupResult) - req := checkMusicGroupRequest{} - req.group = ctx.GroupName - req.response = res_ch - ctx.rddb.checkMusicGroupChan <- req - - res := <-res_ch - if res.err != nil { - return false, res.err - } - return res.ismusic, nil + return ctx.rddb.CheckMusicGroup(ctx.GroupName) } func (ctx *ImportContext) getMusicInfo() (err error) { - res_ch := make(chan getMusicInfoResult) - req := getMusicInfoRequest{} - req.group = ctx.GroupName - req.response = res_ch - ctx.rddb.getMusicInfoChan <- req - - res := <-res_ch - if res.err != nil { - return res.err - } - ctx.NormalizationLevel = res.norm_lvl - ctx.AutotrimLevel = res.trim_lvl + ctx.NormalizationLevel, ctx.AutotrimLevel, err = ctx.rddb.GetMusicInfo(ctx.GroupName) ctx.Channels = 2 ctx.UseMetaData = true ctx.Cart = 0 |