diff options
Diffstat (limited to 'rhimport')
-rw-r--r-- | rhimport/converter.go | 10 | ||||
-rw-r--r-- | rhimport/fetcher.go | 6 |
2 files changed, 8 insertions, 8 deletions
diff --git a/rhimport/converter.go b/rhimport/converter.go index 418d27b..a451e24 100644 --- a/rhimport/converter.go +++ b/rhimport/converter.go @@ -43,12 +43,12 @@ type ConverterResult struct { err error } -func NewFetchConverter(convType, filename string) (FetchConverter, string, error) { +func NewFetchConverter(convType, filename string, metadata map[string]string) (FetchConverter, string, error) { switch convType { case "null": - return NewNullFetchConverter(filename) + return NewNullFetchConverter(filename, metadata) case "ffmpeg": - return NewFFMpegFetchConverter(filename) + return NewFFMpegFetchConverter(filename, metadata) } return nil, "", errors.New("unknown fetch converter type: " + convType) } @@ -61,7 +61,7 @@ type NullFetchConverter struct { file *os.File } -func NewNullFetchConverter(filename string) (n *NullFetchConverter, newFilename string, err error) { +func NewNullFetchConverter(filename string, metadata map[string]string) (n *NullFetchConverter, newFilename string, err error) { n = &NullFetchConverter{} rhl.Printf("null-converter: opening file '%s'", filename) newFilename = filename @@ -91,7 +91,7 @@ type FFMpegFetchConverter struct { result chan ConverterResult } -func NewFFMpegFetchConverter(filename string) (ff *FFMpegFetchConverter, filenameFlac string, err error) { +func NewFFMpegFetchConverter(filename string, metadata map[string]string) (ff *FFMpegFetchConverter, filenameFlac string, err error) { ff = &FFMpegFetchConverter{} ext := filepath.Ext(filename) filenameFlac = strings.TrimSuffix(filename, ext) + ".flac" diff --git a/rhimport/fetcher.go b/rhimport/fetcher.go index 1cc6439..c2e4604 100644 --- a/rhimport/fetcher.go +++ b/rhimport/fetcher.go @@ -79,7 +79,7 @@ func curlWriteCallback(ptr []byte, userdata interface{}) bool { } data.filename = filepath.Join(data.basepath, name) } - conv, newFilename, err := NewFetchConverter(data.ctx.FetchConverter, data.filename) + conv, newFilename, err := NewFetchConverter(data.ctx.FetchConverter, data.filename, nil) if err != nil { rhl.Printf("Unable to create converter for file %s: %s", data.filename, err) data.writeError = err @@ -348,7 +348,7 @@ func fetchFileDirConvert(ctx *Context, res *Result, origSrc *os.File, sizeTotal origDir, origFile := path.Split(ctx.SourceFile) var conv FetchConverter - if conv, ctx.SourceFile, err = NewFetchConverter(ctx.FetchConverter, filepath.Join(basepath, origFile)); err != nil { + if conv, ctx.SourceFile, err = NewFetchConverter(ctx.FetchConverter, filepath.Join(basepath, origFile), nil); err != nil { rhl.Printf("Unable to create converter for file %s: %s", origDir+origFile, err) return } @@ -583,7 +583,7 @@ func fetchFileAttachment(ctx *Context, res *Result, uri *url.URL) error { var conv FetchConverter var newFilename string - if conv, newFilename, err = NewFetchConverter(ctx.FetchConverter, ctx.SourceFile); err != nil { + if conv, newFilename, err = NewFetchConverter(ctx.FetchConverter, ctx.SourceFile, nil); err != nil { rhl.Printf("Unable to create converter for file %s: %s", ctx.SourceFile, err) return err } |