diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-14 14:48:37 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-14 14:48:37 (GMT) |
commit | 090f1621563a2b5069dd54ba7e67b7c07cc79f13 (patch) | |
tree | 9411f1d1b417ffc9fd82c90f6f02632c260da4b3 | |
parent | 6e9e940372b1e76ecde2f6918c53592d5addfaf0 (diff) |
fixed bug where some context values where not initialiized properly
-rw-r--r-- | conf.go | 12 | ||||
-rw-r--r-- | importer.go | 10 | ||||
-rw-r--r-- | rddb.go | 2 |
3 files changed, 19 insertions, 5 deletions
@@ -28,6 +28,13 @@ import ( "github.com/vaughan0/go-ini" ) +type ImportParamDefaults struct { + Channels uint + NormalizationLevel int + AutotrimLevel int + UseMetaData bool +} + type Config struct { configfile string RDXportEndpoint string @@ -36,6 +43,7 @@ type Config struct { db_user string db_passwd string db_db string + ImportParamDefaults } func get_ini_value(file ini.File, section string, key string, dflt string) string { @@ -67,5 +75,9 @@ func NewConfig(configfile, rdxport_endpoint, temp_dir *string) (conf *Config, er } conf.RDXportEndpoint = *rdxport_endpoint conf.TempDir = *temp_dir + conf.ImportParamDefaults.Channels = 2 + conf.ImportParamDefaults.NormalizationLevel = -12 + conf.ImportParamDefaults.AutotrimLevel = 0 + conf.ImportParamDefaults.UseMetaData = true return } diff --git a/importer.go b/importer.go index 925722e..aa5343d 100644 --- a/importer.go +++ b/importer.go @@ -74,10 +74,10 @@ func NewImportContext(conf *Config, rddb *RdDb, user string) *ImportContext { ctx.GroupName = "" ctx.Cart = 0 ctx.Cut = 0 - ctx.Channels = 2 - ctx.NormalizationLevel = -12 - ctx.AutotrimLevel = 0 - ctx.UseMetaData = false + ctx.Channels = conf.ImportParamDefaults.Channels + ctx.NormalizationLevel = conf.ImportParamDefaults.NormalizationLevel + ctx.AutotrimLevel = conf.ImportParamDefaults.AutotrimLevel + ctx.UseMetaData = conf.ImportParamDefaults.UseMetaData ctx.SourceFile = "" ctx.DeleteSourceFile = false ctx.DeleteSourceDir = false @@ -158,6 +158,7 @@ func (ctx *ImportContext) getShowInfo() (carts []uint, err error) { ctx.GroupName = res.group ctx.NormalizationLevel = res.norm_lvl ctx.AutotrimLevel = res.trim_lvl + ctx.Channels = 2 ctx.UseMetaData = true carts = res.carts return @@ -188,6 +189,7 @@ func (ctx *ImportContext) getMusicInfo() (err error) { } ctx.NormalizationLevel = res.norm_lvl ctx.AutotrimLevel = res.trim_lvl + ctx.Channels = 2 ctx.UseMetaData = true return } @@ -251,7 +251,7 @@ func (self *RdDb) getMusicInfo(group string) (result getMusicInfoResult) { result.err = self.checkMusicGroupStmt.QueryRow(group).Scan(&result.norm_lvl, &result.trim_lvl) if result.err != nil { if result.err == sql.ErrNoRows { - result.err = fmt.Errorf("music pool '%d' not found", group) + result.err = fmt.Errorf("music pool '%s' not found", group) } return } |