summaryrefslogtreecommitdiff
path: root/rhimport/importer.go
diff options
context:
space:
mode:
Diffstat (limited to 'rhimport/importer.go')
-rw-r--r--rhimport/importer.go30
1 files changed, 15 insertions, 15 deletions
diff --git a/rhimport/importer.go b/rhimport/importer.go
index 9b29e97..4b06724 100644
--- a/rhimport/importer.go
+++ b/rhimport/importer.go
@@ -46,7 +46,7 @@ func (res *Result) fromRDWebResult(rdres *RDWebResult) {
}
func addCart(ctx *Context, res *Result) (err error) {
- rhdl.Printf("importer: addCart() called for cart: %d", ctx.Cart)
+ ctx.dbglog.Printf("importer: addCart() called for cart: %d", ctx.Cart)
if ctx.GroupName == "" {
if err = ctx.getGroupOfCart(); err != nil {
@@ -106,7 +106,7 @@ func addCart(ctx *Context, res *Result) (err error) {
}
func addCut(ctx *Context, res *Result) (err error) {
- rhdl.Printf("importer: addCut() called for cart/cut: %d/%d", ctx.Cart, ctx.Cut)
+ ctx.dbglog.Printf("importer: addCut() called for cart/cut: %d/%d", ctx.Cart, ctx.Cut)
var b bytes.Buffer
w := multipart.NewWriter(&b)
@@ -153,7 +153,7 @@ func addCut(ctx *Context, res *Result) (err error) {
}
func removeCart(ctx *Context, res *Result) (err error) {
- rhdl.Printf("importer: removeCart() called for cart: %d", ctx.Cart)
+ ctx.dbglog.Printf("importer: removeCart() called for cart: %d", ctx.Cart)
var b bytes.Buffer
w := multipart.NewWriter(&b)
@@ -187,7 +187,7 @@ func removeCart(ctx *Context, res *Result) (err error) {
}
func removeCut(ctx *Context, res *Result) (err error) {
- rhdl.Printf("importer: removeCut() called for cart/cut: %d/%d", ctx.Cart, ctx.Cut)
+ ctx.dbglog.Printf("importer: removeCut() called for cart/cut: %d/%d", ctx.Cart, ctx.Cut)
var b bytes.Buffer
w := multipart.NewWriter(&b)
@@ -278,7 +278,7 @@ func importAudioCreateRequest(ctx *Context, easy *curl.CURL) (form *curl.Form, e
}
func importAudio(ctx *Context, res *Result) (err error) {
- rhdl.Printf("importer: importAudio() called for cart/cut: %d/%d", ctx.Cart, ctx.Cut)
+ ctx.dbglog.Printf("importer: importAudio() called for cart/cut: %d/%d", ctx.Cart, ctx.Cut)
easy := curl.EasyInit()
if easy != nil {
@@ -318,7 +318,7 @@ func importAudio(ctx *Context, res *Result) (err error) {
if err = easy.Perform(); err != nil {
if res.ResponseCode == http.StatusNoContent {
- rhl.Printf("import to cart/cat %d/%d got canceled", ctx.Cart, ctx.Cut)
+ ctx.stdlog.Printf("import to cart/cat %d/%d got canceled", ctx.Cart, ctx.Cut)
res.Cart = ctx.Cart
res.Cut = ctx.Cut
err = nil
@@ -404,16 +404,16 @@ func addShowCartCut(ctx *Context, res *Result, carts []uint) (err error) {
func cleanupFiles(ctx *Context, res *Result) {
if ctx.DeleteSourceFile {
- rhdl.Printf("importer: removing file: %s", ctx.SourceFile)
+ ctx.dbglog.Printf("importer: removing file: %s", ctx.SourceFile)
if err := os.Remove(ctx.SourceFile); err != nil {
- rhl.Printf("importer: error removing source file: %s", err)
+ ctx.stdlog.Printf("importer: error removing source file: %s", err)
return
}
if ctx.DeleteSourceDir {
dir := path.Dir(ctx.SourceFile)
- rhdl.Printf("importer: also removing directory: %s", dir)
+ ctx.dbglog.Printf("importer: also removing directory: %s", dir)
if err := os.Remove(dir); err != nil {
- rhl.Printf("importer: error removing source directory: %s", err)
+ ctx.stdlog.Printf("importer: error removing source directory: %s", err)
}
}
} else {
@@ -426,7 +426,7 @@ func ImportFile(ctx *Context) (res *Result, err error) {
res = &Result{ResponseCode: http.StatusOK}
defer cleanupFiles(ctx, res)
- rhl.Printf("importer: ImportFile called with: show-id: %d, pool-name: '%s', cart/cut: %d/%d", ctx.ShowId, ctx.GroupName, ctx.Cart, ctx.Cut)
+ ctx.stdlog.Printf("importer: ImportFile called with: show-id: %d, pool-name: '%s', cart/cut: %d/%d", ctx.ShowId, ctx.GroupName, ctx.Cart, ctx.Cut)
// TODO: on trusted interfaces we should call getPassword again with cached=false after 401's
if ctx.Trusted {
@@ -480,9 +480,9 @@ func ImportFile(ctx *Context) (res *Result, err error) {
if ctx.Cart != 0 && ctx.Cut != 0 { // Import to specific Cut within Cart
if err = importAudio(ctx, res); err != nil || res.ResponseCode != http.StatusOK {
if err != nil {
- rhl.Printf("Fileimport has failed (Cart/Cut %d/%d): %s", ctx.Cart, ctx.Cut, err)
+ ctx.stdlog.Printf("Fileimport has failed (Cart/Cut %d/%d): %s", ctx.Cart, ctx.Cut, err)
} else {
- rhl.Printf("Fileimport has failed (Cart/Cut %d/%d): %s", res.Cart, res.Cut, res.ErrorString)
+ ctx.stdlog.Printf("Fileimport has failed (Cart/Cut %d/%d): %s", res.Cart, res.Cut, res.ErrorString)
}
// Try to clean up after failed import
if rmCartOnErr {
@@ -496,9 +496,9 @@ func ImportFile(ctx *Context) (res *Result, err error) {
}
} else {
if err := ctx.updateCutCartTitle(); err != nil {
- rhl.Printf("Warning: error while updating Cart/Cut Title: %v", err)
+ ctx.stdlog.Printf("Warning: error while updating Cart/Cut Title: %v", err)
}
- rhl.Printf("File got succesfully imported into Cart/Cut %d/%d", res.Cart, res.Cut)
+ ctx.stdlog.Printf("File got succesfully imported into Cart/Cut %d/%d", res.Cart, res.Cut)
}
} else {
res.ResponseCode = http.StatusBadRequest