downloader_test.go 970 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package main
  2. import (
  3. "github.com/allanpk716/ChineseSubFinder/common"
  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. //dirRoot := "X:\\电影\\Oslo (2021)"
  28. //dirRoot := "X:\\电影\\The Devil All the Time (2020)"
  29. dirRoot := "X:\\电影\\冰海陷落 (2018)"
  30. dl := NewDownloader(common.ReqParam{
  31. SaveMultiSub: true,
  32. })
  33. err = dl.DownloadSub(dirRoot)
  34. if err != nil {
  35. t.Fatal(err)
  36. }
  37. }