diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-19 20:07:52 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-19 20:07:52 (GMT) |
commit | 5559994f6c1cde34cb806fbc6bcc30e0ac4751f0 (patch) | |
tree | e5c4d2a589bea324523e735ff4cd2db8f41c25c7 | |
parent | 1f3dab1eab175c4c0e4d4d6d3c339daf02899ca9 (diff) |
tested music pool import, cleaned up help output for telnet interface
-rw-r--r-- | src/helsinki.at/rhimport/importer.go | 7 | ||||
-rw-r--r-- | src/helsinki.at/rhimport/rddb.go | 4 | ||||
-rw-r--r-- | src/helsinki.at/rhimportd/ctrlTelnet.go | 53 |
3 files changed, 37 insertions, 27 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go index afe422f..1404259 100644 --- a/src/helsinki.at/rhimport/importer.go +++ b/src/helsinki.at/rhimport/importer.go @@ -106,6 +106,9 @@ func (ctx *ImportContext) SanityCheck() error { if !ismusic { return fmt.Errorf("supplied GroupName is not a music pool") } + if ctx.Cart != 0 || ctx.Cut != 0 { + return fmt.Errorf("Cart and Cut must not be supplied when importing into a music group") + } return nil } if ctx.Cart == 0 { @@ -193,6 +196,8 @@ func (ctx *ImportContext) getMusicInfo() (err error) { ctx.AutotrimLevel = res.trim_lvl ctx.Channels = 2 ctx.UseMetaData = true + ctx.Cart = 0 + ctx.Cut = 0 return } @@ -624,7 +629,7 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { if err = ctx.getMusicInfo(); err != nil { return } - if err = remove_add_cart_cut(ctx, res); err != nil || res.ResponseCode != http.StatusOK { + if err = add_cart_cut(ctx, res); err != nil || res.ResponseCode != http.StatusOK { return } rmCartOnErr = true diff --git a/src/helsinki.at/rhimport/rddb.go b/src/helsinki.at/rhimport/rddb.go index 28fa6bd..25ef876 100644 --- a/src/helsinki.at/rhimport/rddb.go +++ b/src/helsinki.at/rhimport/rddb.go @@ -247,7 +247,7 @@ func (self *RdDb) getShowInfo(showid uint) (result getShowInfoResult) { func (self *RdDb) checkMusicGroup(group string) (result checkMusicGroupResult) { var cnt int - if result.err = self.getMusicInfoStmt.QueryRow(group).Scan(&cnt); result.err != nil { + if result.err = self.checkMusicGroupStmt.QueryRow(group).Scan(&cnt); result.err != nil { if result.err == sql.ErrNoRows { result.err = nil result.ismusic = false @@ -259,7 +259,7 @@ func (self *RdDb) checkMusicGroup(group string) (result checkMusicGroupResult) { } func (self *RdDb) getMusicInfo(group string) (result getMusicInfoResult) { - result.err = self.checkMusicGroupStmt.QueryRow(group).Scan(&result.norm_lvl, &result.trim_lvl) + result.err = self.getMusicInfoStmt.QueryRow(group).Scan(&result.norm_lvl, &result.trim_lvl) if result.err != nil { if result.err == sql.ErrNoRows { result.err = fmt.Errorf("music pool '%s' not found", group) diff --git a/src/helsinki.at/rhimportd/ctrlTelnet.go b/src/helsinki.at/rhimportd/ctrlTelnet.go index b73d8db..eb3c607 100644 --- a/src/helsinki.at/rhimportd/ctrlTelnet.go +++ b/src/helsinki.at/rhimportd/ctrlTelnet.go @@ -75,40 +75,44 @@ func (c *TelnetClient) handle_cmd_help(args []string) { c.say(" this sets the import parameter <param> to <value>.") c.say("") c.say(" available parameters:") - c.say(" UserName string username to use for requests to rivendell rdxport interface") - c.say(" Password string password to use for requests to rivendell rdxport interface") + c.say(" UserName string username to use for rdxport interface") + c.say(" Password string password to use for rdxport interface") c.say(" SourceUri string uri to the file to import") c.say(" ShowId uint the RHRD show id to import to") - c.say(" ClearShowCarts bool tells the importer to clear all show-carts before importing to a show") + c.say(" ClearShowCarts bool clear all show-carts before importing?") c.say(" GroupName string name of music-pool group to import to") c.say(" Cart uint cart to import to") - c.say(" ClearCart bool remove all existing cuts from cart before importing?") + c.say(" ClearCart bool remove/add cart before import") c.say(" Cut uint cut to import to") - c.say(" Channels uint number of audio channels (defaults to: %v)", c.conf.ImportParamDefaults.Channels) - c.say(" NormalizationLevel int normalization level in dB (defaults to: %v)", c.conf.ImportParamDefaults.NormalizationLevel) - c.say(" AutotrimLevel int autotrim level in dB (defaults to: %v)", c.conf.ImportParamDefaults.AutotrimLevel) - c.say(" UseMetaData bool extract meta data from source file (defaults to: %v)", c.conf.ImportParamDefaults.UseMetaData) + c.say(" Channels uint number of audio channels (default: %v)", c.conf.ImportParamDefaults.Channels) + c.say(" NormalizationLevel int normalization level in dB (default: %v)", c.conf.ImportParamDefaults.NormalizationLevel) + c.say(" AutotrimLevel int autotrim level in dB (default: %v)", c.conf.ImportParamDefaults.AutotrimLevel) + c.say(" UseMetaData bool extract meta data from file (default: %v)", c.conf.ImportParamDefaults.UseMetaData) c.say("") c.say(" UserName, Password and SourceUri are mandatory parameters.") c.say("") - c.say(" If ShowId is supplied GroupName, Channels, NomalizationLevel, AutorimLevel, UseMetaData") - c.say(" and Cut will be ignored. The values from the shows' dropbox will be used instead. Cart may") - c.say(" be specified but must point to an empty cart within that show. If ClearCut is true the") - c.say(" specified cart will get deleted before importing. If Cart is 0 the next free cart in the") - c.say(" show will be used. Show carts will always be imported into cut 1.") + c.say(" If ShowId is supplied GroupName, Channels, NomalizationLevel, AutorimLevel,") + c.say(" UseMetaData and Cut will be ignored. The values from the shows' dropbox will") + c.say(" be used instead. Cart may be specified but must point to an empty cart within") + c.say(" that show. If ClearCut is true the specified cart will get deleted before") + c.say(" importing. If Cart is 0 the next free cart in the show will be used. Show") + c.say(" carts will always be imported into cut 1.") c.say("") - c.say(" If GroupName is supplied Channels, NomalizationLevel, AutorimLevel, UseMetaData, Cut and") - c.say(" Cart will be ignored. The values from the music pools' dropbox will be used instead. The") - c.say(" file will always be imported into cut 1 of the first free cart within the music pool.") + c.say(" If GroupName is supplied Channels, NomalizationLevel, AutorimLevel,") + c.say(" UseMetaData, Cut, Cart and ClearCart will be ignored. The values from") + c.say(" the music pools' dropbox will be used instead. The file will always be") + c.say(" imported into cut 1 of the first free cart within the music pool.") c.say("") - c.say(" If ShowId and GroupName are omitted a Cart must be specified. Cut may be supplied in which") - c.say(" case both cart and cut must already exist. The import will then replace the contents of the") - c.say(" current data stored in Cart/Cut. If only Cart and no Cut is supplied and ClearCut is false the") - c.say(" file will either get imported into the next cut of an existing cart or the cart will be created") - c.say(" and the file will be imported into cut 1 of this cart.") + c.say(" If ShowId and GroupName are omitted a Cart must be specified. Cut may be") + c.say(" supplied in which case both cart and cut must already exist. The import will") + c.say(" then replace the contents of the current data stored in Cart/Cut. If only Cart") + c.say(" and no Cut is supplied and ClearCut is false the file will either get imported") + c.say(" into the next cut of an existing cart or the cart will be created and the file") + c.say(" will be imported into cut 1 of this cart.") c.say("") - c.say(" In case of an error carts/cuts which might got created will be removed. Carts which got") - c.say(" deleted because of ClearShowCarts or ClearCart are however gone for good.") + c.say(" In case of an error carts/cuts which might got created will be removed. Carts") + c.say(" which got deleted because of ClearShowCarts or ClearCart are however gone for") + c.say(" good.") return case "show": c.say("usage: show") @@ -120,7 +124,8 @@ func (c *TelnetClient) handle_cmd_help(args []string) { return case "run": c.say("usage: run") - c.say(" this starts the fetch/import process according to the current import parameters.") + c.say(" this starts the fetch/import process according to the current") + c.say(" import parameters.") return } fallthrough |