diff options
Diffstat (limited to 'rhimport')
-rw-r--r-- | rhimport/converter.go | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/rhimport/converter.go b/rhimport/converter.go index 6c63657..c4d8301 100644 --- a/rhimport/converter.go +++ b/rhimport/converter.go @@ -76,9 +76,9 @@ type NullFetchConverter struct { func NewNullFetchConverter(filename string, metadata map[string]string, samplerate, channels uint) (n *NullFetchConverter, newFilename string, err error) { n = &NullFetchConverter{} - rhl.Printf("null-converter: opening file '%s'", filename) - newFilename = filename - n.file, err = os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600) + newFilename = filepath.Dir(filename) + "/conv-null" + filepath.Ext(filename) + rhl.Printf("null-converter: opening file '%s' -> '%s'", filename, newFilename) + n.file, err = os.OpenFile(newFilename, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600) return } @@ -106,9 +106,8 @@ type FFMpegFetchConverter struct { func NewFFMpegFetchConverter(filename string, metadata map[string]string, samplerate, channels uint) (ff *FFMpegFetchConverter, filenameFlac string, err error) { ff = &FFMpegFetchConverter{} - ext := filepath.Ext(filename) - filenameFlac = strings.TrimSuffix(filename, ext) + ".flac" - rhl.Printf("ffmpeg-converter: starting ffmpeg for file '%s' (had extension: '%s')", filenameFlac, ext) + filenameFlac = filepath.Dir(filename) + "/conv-ffmpeg.flac" + rhl.Printf("ffmpeg-converter: starting ffmpeg for file '%s' -> '%s'", filename, filenameFlac) ff.cmd = exec.Command("ffmpeg", "-loglevel", "warning", "-i", "-", "-map_metadata", "0") if metadata != nil { for key, value := range metadata { @@ -166,9 +165,9 @@ type BS1770FetchConverter struct { func NewBS1770FetchConverter(filename string, metadata map[string]string, samplerate, channels uint) (bs *BS1770FetchConverter, newFilename string, err error) { bs = &BS1770FetchConverter{} - rhl.Printf("bs1770-converter: starting bs1770gain for file '%s'", filename) - newFilename = filename - bs.file, err = os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600) + newFilename = filepath.Dir(filename) + "/conv-bs1770" + filepath.Ext(filename) + rhl.Printf("bs1770-converter: starting bs1770gain for file '%s' -> '%s'", filename, newFilename) + bs.file, err = os.OpenFile(newFilename, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0600) bs.cmd = exec.Command("bs1770gain", "--ebu", "-i", "--xml", "-") if bs.pipe, err = bs.cmd.StdinPipe(); err != nil { @@ -244,9 +243,8 @@ type FFMpegBS1770FetchConverter struct { func NewFFMpegBS1770FetchConverter(filename string, metadata map[string]string, samplerate, channels uint) (ff *FFMpegBS1770FetchConverter, filenameFlac string, err error) { ff = &FFMpegBS1770FetchConverter{} - ext := filepath.Ext(filename) - filenameFlac = strings.TrimSuffix(filename, ext) + ".flac" - rhl.Printf("ffmpeg-bs1770-converter: starting ffmpeg and bs1770gain for file '%s' (had extension: '%s')", filenameFlac, ext) + filenameFlac = filepath.Dir(filename) + "/conv-ffmpeg-bs1770.flac" + rhl.Printf("ffmpeg-bs1770-converter: starting ffmpeg and bs1770gain for file '%s' -> '%s'", filename, filenameFlac) ff.ffmpeg = exec.Command("ffmpeg", "-loglevel", "warning", "-i", "pipe:0", "-map_metadata", "0") if metadata != nil { for key, value := range metadata { |