summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimport/core.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/helsinki.at/rhimport/core.go')
-rw-r--r--src/helsinki.at/rhimport/core.go26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/helsinki.at/rhimport/core.go b/src/helsinki.at/rhimport/core.go
index bb92d30..9927be9 100644
--- a/src/helsinki.at/rhimport/core.go
+++ b/src/helsinki.at/rhimport/core.go
@@ -51,17 +51,17 @@ func init() {
fetcherInit()
}
-type ImportProgressCB func(step int, stepName string, progress float64, userdata interface{}) bool
-type ImportDoneCB func(ImportResult, interface{}) bool
+type ProgressCB func(step int, stepName string, progress float64, userdata interface{}) bool
+type DoneCB func(Result, interface{}) bool
-type ImportResult struct {
+type Result struct {
ResponseCode int
ErrorString string
Cart uint
Cut uint
}
-type ImportContext struct {
+type Context struct {
conf *Config
rddb *RdDbChan
UserName string
@@ -81,13 +81,13 @@ type ImportContext struct {
SourceFile string
DeleteSourceFile bool
DeleteSourceDir bool
- ProgressCallBack ImportProgressCB
+ ProgressCallBack ProgressCB
ProgressCallBackData interface{}
Cancel <-chan bool
}
-func NewImportContext(conf *Config, rddb *RdDbChan, user string) *ImportContext {
- ctx := new(ImportContext)
+func NewContext(conf *Config, rddb *RdDbChan, user string) *Context {
+ ctx := new(Context)
ctx.conf = conf
ctx.rddb = rddb
ctx.UserName = user
@@ -112,7 +112,7 @@ func NewImportContext(conf *Config, rddb *RdDbChan, user string) *ImportContext
return ctx
}
-func (ctx *ImportContext) SanityCheck() error {
+func (ctx *Context) SanityCheck() error {
if ctx.UserName == "" {
return fmt.Errorf("empty Username is not allowed")
}
@@ -156,28 +156,28 @@ func (ctx *ImportContext) SanityCheck() error {
return nil
}
-func (ctx *ImportContext) getPassword(cached bool) (err error) {
+func (ctx *Context) getPassword(cached bool) (err error) {
ctx.Password, err = ctx.rddb.GetPassword(ctx.UserName, cached)
return
}
-func (ctx *ImportContext) getGroupOfCart() (err error) {
+func (ctx *Context) getGroupOfCart() (err error) {
ctx.GroupName, err = ctx.rddb.GetGroupOfCart(ctx.Cart)
return
}
-func (ctx *ImportContext) getShowInfo() (carts []uint, err error) {
+func (ctx *Context) getShowInfo() (carts []uint, err error) {
ctx.GroupName, ctx.NormalizationLevel, ctx.AutotrimLevel, carts, err = ctx.rddb.GetShowInfo(ctx.ShowId)
ctx.Channels = 2
ctx.UseMetaData = true
return
}
-func (ctx *ImportContext) checkMusicGroup() (bool, error) {
+func (ctx *Context) checkMusicGroup() (bool, error) {
return ctx.rddb.CheckMusicGroup(ctx.GroupName)
}
-func (ctx *ImportContext) getMusicInfo() (err error) {
+func (ctx *Context) getMusicInfo() (err error) {
ctx.NormalizationLevel, ctx.AutotrimLevel, err = ctx.rddb.GetMusicInfo(ctx.GroupName)
ctx.Channels = 2
ctx.UseMetaData = true