Skip to content

Commit

Permalink
update javbus
Browse files Browse the repository at this point in the history
  • Loading branch information
godcong committed Oct 12, 2019
1 parent bcadfb5 commit 81acbbd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
12 changes: 12 additions & 0 deletions grab_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package scrape

import (
"os"
"testing"

"github.com/javscrape/go-scrape/net"
Expand Down Expand Up @@ -32,3 +33,14 @@ func TestGrabJAVBUS_Find(t *testing.T) {
t.Fatal(err)
}
}
func TestStat(t *testing.T) {
info, e := os.Stat("grab_test.go")
t.Log(os.IsNotExist(e))
t.Log(os.IsExist(e))
t.Log(info, e)

info1, e1 := os.Stat("grab_test1.go")
t.Log(os.IsNotExist(e1))
t.Log(os.IsExist(e1))
t.Log(info1, e1)
}
5 changes: 3 additions & 2 deletions scrape.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"os"
"path/filepath"
"strconv"
"strings"

"github.com/javscrape/go-scrape/net"
)
Expand Down Expand Up @@ -111,7 +112,7 @@ func (impl *scrapeImpl) Find(name string) (msg *[]*Content, e error) {
}

func copyCache(cache *net.Cache, msg *Content, output string) (e error) {
pid := filepath.Join(output, msg.ID)
pid := filepath.Join(output, strings.ToUpper(msg.ID))
e = copyFile(cache, msg.Image, filepath.Join(pid, "image"))
if e != nil {
return e
Expand Down Expand Up @@ -140,7 +141,7 @@ func copyCache(cache *net.Cache, msg *Content, output string) (e error) {
}

func copyInfo(msg *Content, path string) error {
pid := filepath.Join(path, msg.ID)
pid := filepath.Join(path, strings.ToUpper(msg.ID))
inf := filepath.Join(pid, "inf.json")
_ = os.MkdirAll(filepath.Dir(inf), os.ModePerm)
info, e := os.Stat(inf)
Expand Down

0 comments on commit 81acbbd

Please sign in to comment.