downloader_test.go 791 B

12345678910111213141516171819202122232425262728293031323334353637
  1. package ChineseSubFinder
  2. import (
  3. "github.com/allanpk716/ChineseSubFinder/common"
  4. "github.com/allanpk716/ChineseSubFinder/sub_supplier/shooter"
  5. "testing"
  6. )
  7. func TestDownloader_searchFile(t *testing.T) {
  8. //dirRoot := "X:\\动漫\\EVA"
  9. dirRoot := "X:\\电影\\Spiral From the Book of Saw (2021)"
  10. dl := NewDownloader()
  11. files, err := dl.searchFile(dirRoot)
  12. if err != nil {
  13. t.Fatal(err)
  14. }
  15. sp := shooter.NewSupplier()
  16. for i, file := range files {
  17. println(i, file)
  18. _, err := sp.ComputeFileHash(file)
  19. if err != nil {
  20. t.Fatal(err)
  21. }
  22. }
  23. }
  24. func TestDownloader_DownloadSub(t *testing.T) {
  25. dirRoot := "X:\\电影\\Spiral From the Book of Saw (2021)"
  26. dl := NewDownloader(common.ReqParam{DebugMode: true})
  27. err := dl.DownloadSub(dirRoot)
  28. if err != nil {
  29. t.Fatal(err)
  30. }
  31. }