Skip to content

Commit

Permalink
Merge pull request yyoshiki41#19 from yyoshiki41/feature/filepath
Browse files Browse the repository at this point in the history
feat(filepath): Use the path/filepath package
  • Loading branch information
yyoshiki41 committed Oct 24, 2017
2 parents 896e983 + 4629f8c commit 5aae456
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions internal/download.go
Expand Up @@ -6,7 +6,7 @@ import (
"log"
"net/http"
"os"
"path"
"path/filepath"
"sync"
)

Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions output.go
Expand Up @@ -5,7 +5,7 @@ import (
"fmt"
"io/ioutil"
"os"
"path"
"path/filepath"

"github.com/yyoshiki41/radigo/internal"
)
Expand All @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions rec.go
Expand Up @@ -5,7 +5,7 @@ import (
"flag"
"fmt"
"os"
"path"
"path/filepath"
"strings"
"time"

Expand Down Expand Up @@ -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,
))
Expand Down
8 changes: 4 additions & 4 deletions rec_live.go
Expand Up @@ -5,7 +5,7 @@ import (
"flag"
"fmt"
"os"
"path"
"path/filepath"
"strings"
"time"

Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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))
}

Expand Down

0 comments on commit 5aae456

Please sign in to comment.