shooter_test.go 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package shooter
  2. import (
  3. "github.com/allanpk716/ChineseSubFinder/internal/logic/file_downloader"
  4. "github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
  5. "github.com/allanpk716/ChineseSubFinder/internal/pkg/settings"
  6. "github.com/allanpk716/ChineseSubFinder/internal/pkg/unit_test_helper"
  7. "path/filepath"
  8. "testing"
  9. )
  10. func TestNewSupplier(t *testing.T) {
  11. //movie1 := "X:\\电影\\The Devil All the Time (2020)\\The Devil All the Time (2020) WEBDL-1080p.mkv"
  12. //movie1 := "X:\\电影\\龙猫 (1988)\\龙猫 (1988) 1080p DTS.mkv"
  13. //movie1 := "X:\\电影\\消失爱人 (2016)\\消失爱人 (2016) 720p AAC.rmvb"
  14. //movie1 := "X:\\电影\\机动战士Z高达:星之继承者 (2005)\\机动战士Z高达:星之继承者 (2005) 1080p TrueHD.mkv"
  15. //movie1 := "X:\\连续剧\\The Bad Batch\\Season 1\\The Bad Batch - S01E01 - Aftermath WEBDL-1080p.mkv"
  16. //movie1 := "X:\\电影\\An Invisible Sign (2010)\\An Invisible Sign (2010) 720p AAC.mp4"
  17. //movie1 := "X:\\连续剧\\少年间谍 (2020)\\Season 2\\Alex Rider - S02E01 - Episode One WEBDL-1080p.mkv"
  18. //movie1 := "X:\\连续剧\\黄石 (2018)\\Season 4\\Yellowstone (2018) - S04E05 - Under a Blanket of Red WEBDL-2160p.mkv"
  19. //movie1 := "X:\\连续剧\\瑞克和莫蒂 (2013)\\Season 5\\Rick and Morty - S05E09 - Forgetting Sarick Mortshall WEBRip-1080p.mkv"
  20. rootDir := unit_test_helper.GetTestDataResourceRootPath([]string{"sub_spplier"}, 5, true)
  21. rootDir = filepath.Join(rootDir, "shooter")
  22. gVideoFPath, err := unit_test_helper.GenerateShooterVideoFile(rootDir)
  23. if err != nil {
  24. t.Fatal(err)
  25. }
  26. shooter := NewSupplier(file_downloader.NewFileDownloader(settings.NewSettings(), log_helper.GetLogger4Tester()))
  27. outList, err := shooter.getSubListFromFile(gVideoFPath)
  28. if err != nil {
  29. t.Error(err)
  30. }
  31. println(outList)
  32. for i, sublist := range outList {
  33. println(i, sublist.Name, sublist.Ext, sublist.Language.String(), sublist.Score, sublist.FileUrl, len(sublist.Data))
  34. }
  35. alive, _ := shooter.CheckAlive()
  36. if alive == false {
  37. t.Fatal("CheckAlive == false")
  38. }
  39. }