diff --git a/internal/download.go b/internal/download.go index 7c3c711..7ad3753 100644 --- a/internal/download.go +++ b/internal/download.go @@ -6,7 +6,7 @@ import ( "log" "net/http" "os" - "path" + "path/filepath" "sync" ) @@ -56,8 +56,8 @@ func download(link, output string) error { } defer resp.Body.Close() - _, fileName := path.Split(link) - file, err := os.Create(path.Join(output, fileName)) + _, fileName := filepath.Split(link) + file, err := os.Create(filepath.Join(output, fileName)) if err != nil { return err } diff --git a/output.go b/output.go index b8924e6..88a1988 100644 --- a/output.go +++ b/output.go @@ -5,7 +5,7 @@ import ( "fmt" "io/ioutil" "os" - "path" + "path/filepath" "github.com/yyoshiki41/radigo/internal" ) @@ -18,7 +18,7 @@ func initTempAACDir() (string, error) { return "", err } - aacResultFile = path.Join(aacDir, "result.aac") + aacResultFile = filepath.Join(aacDir, "result.aac") return aacDir, nil } diff --git a/rec.go b/rec.go index 63d6177..8b1bd91 100644 --- a/rec.go +++ b/rec.go @@ -5,7 +5,7 @@ import ( "flag" "fmt" "os" - "path" + "path/filepath" "strings" "time" @@ -125,7 +125,7 @@ func (c *recCommand) Run(args []string) int { return 1 } - outputFile := path.Join(radigoPath, "output", + outputFile := filepath.Join(radigoPath, "output", fmt.Sprintf("%s-%s.%s", startTime.In(location).Format(datetimeLayout), stationID, fileType, )) diff --git a/rec_live.go b/rec_live.go index 2ce8e85..094747f 100644 --- a/rec_live.go +++ b/rec_live.go @@ -5,7 +5,7 @@ import ( "flag" "fmt" "os" - "path" + "path/filepath" "strings" "time" @@ -99,7 +99,7 @@ func (c *recLiveCommand) Run(args []string) int { tempDir, removeTempDir := internal.CreateTempDir() defer removeTempDir() - swfPlayer := path.Join(tempDir, "myplayer.swf") + swfPlayer := filepath.Join(tempDir, "myplayer.swf") if err := radiko.DownloadPlayer(swfPlayer); err != nil { c.ui.Error(fmt.Sprintf( "Failed to download swf player. %s", err)) @@ -135,12 +135,12 @@ func (c *recLiveCommand) Run(args []string) int { var outputFile string if outputFilename == "" { - outputFile = path.Join(radigoPath, "output", + outputFile = filepath.Join(radigoPath, "output", fmt.Sprintf("%s-%s.mp3", time.Now().In(location).Format(datetimeLayout), stationID, )) } else { - outputFile = path.Join(radigoPath, "output", + outputFile = filepath.Join(radigoPath, "output", fmt.Sprintf("%s", outputFilename)) }