From 55a7cdc36f8a79a57aca6c651109eb7ec957d961 Mon Sep 17 00:00:00 2001 From: Tordarus Date: Wed, 15 Jan 2025 15:01:28 +0100 Subject: [PATCH] add mp3 file extension --- .gitignore | 2 ++ main.go | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6eab256 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.env +music-library \ No newline at end of file diff --git a/main.go b/main.go index 70e0711..6b728b2 100644 --- a/main.go +++ b/main.go @@ -65,8 +65,8 @@ func main() { } func TranscodeFile(file string) error { - relPath := strings.TrimPrefix(file, FlagSourceDir) - newPath := filepath.Join(FlagTargetDir, relPath) + relPath := strings.TrimPrefix(file[:len(file)-len(filepath.Ext(file))], FlagSourceDir) + newPath := filepath.Join(FlagTargetDir, relPath+".mp3") newDir := filepath.Dir(newPath) fmt.Printf("check '%s'\n", relPath)