downloader_test.go 825 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package ChineseSubFinder
  2. import (
  3. "github.com/allanpk716/ChineseSubFinder/model"
  4. shooter2 "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.searchMatchedVideoFile(dirRoot)
  12. if err != nil {
  13. t.Fatal(err)
  14. }
  15. sp := shooter2.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. var err error
  26. dirRoot := "X:\\电影\\Spiral From the Book of Saw (2021)"
  27. dl := NewDownloader(model.ReqParam{DebugMode: true})
  28. err = dl.DownloadSub(dirRoot)
  29. if err != nil {
  30. t.Fatal(err)
  31. }
  32. }