shooter_test.go 1.7 KB

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