Skip to content

Commit

Permalink
Merge pull request #177 from camphor-/set-accept-language
Browse files Browse the repository at this point in the history
AcceptLanguageを設定して、日本語で曲情報を取得するようにする
  • Loading branch information
p1ass authored Aug 4, 2020
2 parents 2c9a632 + aca81bd commit e0a2197
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ require (
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f // indirect
google.golang.org/appengine v1.6.6 // indirect
)

replace github.com/zmb3/spotify => github.com/p1ass/spotify v0.0.0-20200804070451-35a3efb1eefb
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHX
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-sqlite3 v1.11.0 h1:LDdKkqtYlom37fkvqs8rMPFKAMe8+SgjbwZ6ex1/A/Q=
github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/p1ass/spotify v0.0.0-20200804070451-35a3efb1eefb h1:1SzuWPo6QDjBEDEh4e13eVpP917MMl0uoQV0yEShGEg=
github.com/p1ass/spotify v0.0.0-20200804070451-35a3efb1eefb/go.mod h1:CYu0Uo+YYMlUX39zUTsCU9j3SpK3l1eB8oLykXF7R7w=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/poy/onpar v0.0.0-20190519213022-ee068f8ea4d1 h1:oL4IBbcqwhhNWh31bjOX8C/OCy0zs9906d/VUru+bqg=
Expand Down
2 changes: 2 additions & 0 deletions spotify/track.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func (c *Client) Search(ctx context.Context, q string) ([]*entity.Track, error)
}

cli := c.auth.NewClient(token)
cli.AcceptLanguage = "ja,en;q=0.9"
result, err := cli.Search(q, spotify.SearchTypeTrack)
if err != nil {
return nil, fmt.Errorf("search q=%s: %w", q, err)
Expand All @@ -37,6 +38,7 @@ func (c *Client) GetTracksFromURI(ctx context.Context, trackURIs []string) ([]*e
return nil, fmt.Errorf("token not found")
}
cli := c.auth.NewClient(token)
cli.AcceptLanguage = "ja,en;q=0.9"

ids := make([]spotify.ID, len(trackURIs))
for i, trackURI := range trackURIs {
Expand Down

0 comments on commit e0a2197

Please sign in to comment.