Skip to content

Commit

Permalink
use go mod
Browse files Browse the repository at this point in the history
  • Loading branch information
sangazh committed Jan 5, 2021
1 parent 9b59051 commit 3bd9ca0
Show file tree
Hide file tree
Showing 13 changed files with 38 additions and 21 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
.vscode
config.toml
log/*
go.sum
3 changes: 2 additions & 1 deletion app/config.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package app

import (
"github.com/theherk/viper"
"log"
"path/filepath"
"strings"

"github.com/spf13/viper"
)

// Initialize config.toml config. Fatal if not exist.
Expand Down
11 changes: 6 additions & 5 deletions app/temp.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package app

import (
"xiamiToLastfm/xiami"
"os"
"encoding/json"
"log"
"fmt"
"bufio"
"encoding/json"
"errors"
"fmt"
"log"
"os"

"xiamiToLastfm/xiami"
)

var file = "temp.txt"
Expand Down
3 changes: 2 additions & 1 deletion app/temp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ package app

import (
"testing"
"xiamiToLastfm/xiami"

"github.com/stretchr/testify/assert"
"xiamiToLastfm/xiami"
)

func TestTempStore(t *testing.T) {
Expand Down
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module xiamiToLastfm

go 1.14

require (
github.com/PuerkitoBio/goquery v1.6.0
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.6.1
)
2 changes: 1 addition & 1 deletion lastfm/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"sort"
"time"

"github.com/theherk/viper"
"github.com/spf13/viper"
)

var (
Expand Down
3 changes: 2 additions & 1 deletion lastfm/lastfm.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ import (
"net/http"
"net/url"
"os"
"xiamiToLastfm/xiami"

"xiamiToLastfm/musicbrainz"
"xiamiToLastfm/xiami"
)

// QuitChan: an empty channel used to signal main channel to stop.
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package main

import (
"flag"
"fmt"
"log"
"os"
"os/signal"
"syscall"
"time"
"log"
"flag"

"github.com/spf13/viper"
"xiamiToLastfm/app"
"xiamiToLastfm/lastfm"
"xiamiToLastfm/xiami"
"github.com/theherk/viper"
)

var debug bool
Expand Down
9 changes: 5 additions & 4 deletions musicbrainz/mbid.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package musicbrainz

import (
"encoding/xml"
"fmt"
"net/url"
"io/ioutil"
"log"
"net/http"
"io/ioutil"
"encoding/xml"
"github.com/theherk/viper"
"net/url"

"github.com/spf13/viper"
)

// get record's MBID from its title, artist and album.
Expand Down
1 change: 1 addition & 0 deletions musicbrainz/mbid_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package musicbrainz

import (
"testing"

"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion xiami/xiami.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"time"

"github.com/PuerkitoBio/goquery"
"github.com/theherk/viper"
"github.com/spf13/viper"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions xiami/xiami_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ func TestGetAlbum(t *testing.T) {
url := "https://www.xiami.com/song/mSJtnV7aa77?spm=a1z1s.6626017.0.0.nGwy1E"
artist, album, ok := album(url)
assert.True(t, ok)
assert.Equal(t, "川井憲次" ,artist)
assert.Equal(t, "NHKスペシャル「人体 神秘の巨大ネットワーク」オリジナル・サウンドトラック" ,album)
assert.Equal(t, "川井憲次", artist)
assert.Equal(t, "NHKスペシャル「人体 神秘の巨大ネットワーク」オリジナル・サウンドトラック", album)
}
5 changes: 3 additions & 2 deletions xiami_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ package main

import (
"testing"
"xiamiToLastfm/xiami"

"xiamiToLastfm/app"
"xiamiToLastfm/xiami"
)

func TestGetTracks(t *testing.T) {
app.InitConfig()
app.InitConfig("config.toml")
xiami.Init()

nowPlayingChan := make(chan xiami.Track)
Expand Down

0 comments on commit 3bd9ca0

Please sign in to comment.