diff options
author | Christian Pointner <equinox@spreadspace.org> | 2015-12-14 01:57:21 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@spreadspace.org> | 2015-12-14 01:57:21 (GMT) |
commit | 4583360e526e25e7886f6257b1ae5c2745af4b8f (patch) | |
tree | d75832d378e0c5ffb32f27a87857cb6de26191f6 /src/helsinki.at/rhimport/importer.go | |
parent | 377fe22c006a992a2b547bf5bab894161afb7ab6 (diff) |
fetch Music Pool import-params
Diffstat (limited to 'src/helsinki.at/rhimport/importer.go')
-rw-r--r-- | src/helsinki.at/rhimport/importer.go | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go index 9a254fc..61c2b64 100644 --- a/src/helsinki.at/rhimport/importer.go +++ b/src/helsinki.at/rhimport/importer.go @@ -177,6 +177,21 @@ func (ctx *ImportContext) checkMusicGroup() (bool, error) { return res.ismusic, nil } +func (ctx *ImportContext) getMusicInfo() (err error) { + req := getMusicInfoRequest{} + req.group = ctx.GroupName + req.response = make(chan getMusicInfoResult) + ctx.RdDb.getMusicInfoChan <- req + + res := <-req.response + if res.err != nil { + return res.err + } + ctx.NormalizationLevel = res.norm_lvl + ctx.AutotrimLevel = res.trim_lvl + return +} + type ImportResult struct { ResponseCode int ErrorString string @@ -460,10 +475,10 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { res.ResponseCode = 500 res.ErrorString = "Importing to shows using the show-id is not yet implemented" // TODO: fetch info from dropboxes (cartlist, groupname, import-params) + // - if (ctx.Cart not in cartlist) -> Error // - if (ClearShowCarts == true): foreach(cart in cartlist): remove_cart(cart) [200 || 404 -> OK] // - add_cart(ctx, res) [200 -> OK] // - add_cut(ctx, res) [200 -> OK] - // - import_audio(ctx, res) [200 -> OK] return } else if ctx.GroupName != "" { res.ResponseCode = 500 @@ -471,7 +486,7 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { // TODO: fetch info from dropboxes (import-params) // - add_cart(ctx, res) [200 -> OK] // - add_cut(ctx, res) [200 -> OK] - // - import_audio(ctx, res) [200 -> OK] + return } else if ctx.Cart != 0 && ctx.Cut == 0 { res.ResponseCode = 500 res.ErrorString = "Importing to a Cart which might not exist is not yet implemented" @@ -480,8 +495,10 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { // - remove_cart(ctx, res) [200 || 404 -> OK] // - add_cart(ctx, res) [200 -> OK] // - add_cut(ctx, res) [200 -> OK] - // - import_audio(ctx, res) [200 -> OK] - } else if ctx.Cart != 0 && ctx.Cut != 0 { + return + } + + if ctx.Cart != 0 && ctx.Cut != 0 { if err = import_audio(ctx, res); err != nil { return } |