summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimport/importer.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/helsinki.at/rhimport/importer.go')
-rw-r--r--src/helsinki.at/rhimport/importer.go30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go
index 5eea054..2b512ed 100644
--- a/src/helsinki.at/rhimport/importer.go
+++ b/src/helsinki.at/rhimport/importer.go
@@ -35,10 +35,11 @@ import (
type ImportContext struct {
*Config
- *RDDB
+ *RdDb
UserName string
Password string
Trusted bool
+ ShowId int
GroupName string
Cart int
Cut int
@@ -51,13 +52,14 @@ type ImportContext struct {
DeleteSourceFile bool
}
-func NewImportContext(conf *Config, rddb *RDDB, user string, group string) *ImportContext {
+func NewImportContext(conf *Config, rddb *RdDb, user string, group string) *ImportContext {
ctx := new(ImportContext)
ctx.Config = conf
- ctx.RDDB = rddb
+ ctx.RdDb = rddb
ctx.UserName = user
ctx.Password = ""
ctx.Trusted = false
+ ctx.ShowId = 0
ctx.GroupName = group
ctx.Cart = 0
ctx.Cut = 0
@@ -76,7 +78,7 @@ func (ctx *ImportContext) getPassword(cached bool) (err error) {
req.username = ctx.UserName
req.cached = cached
req.response = make(chan getPasswordResult)
- ctx.RDDB.getPasswordChan <- req
+ ctx.RdDb.getPasswordChan <- req
res := <-req.response
if res.err != nil {
@@ -87,6 +89,21 @@ func (ctx *ImportContext) getPassword(cached bool) (err error) {
return
}
+func (ctx *ImportContext) getShowInfo() (err error) {
+ req := getShowInfoRequest{}
+ req.showid = ctx.ShowId
+ req.response = make(chan getShowInfoResult)
+ ctx.RdDb.getShowInfoChan <- req
+
+ res := <-req.response
+ if res.err != nil {
+ err = res.err
+ return
+ }
+ rhdl.Printf("Title of show %d is '%s'", ctx.ShowId, res.title)
+ return
+}
+
// func import_audio(url, file string) (err error) {
// var b bytes.Buffer
@@ -142,6 +159,11 @@ func ImportFile(ctx *ImportContext) (err error) {
return
}
}
+
+ if err = ctx.getShowInfo(); err != nil {
+ return
+ }
+
rhdl.Printf("%+v", ctx)
return