assrt_test.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package assrt
  2. import (
  3. "testing"
  4. "github.com/ChineseSubFinder/ChineseSubFinder/pkg"
  5. "github.com/ChineseSubFinder/ChineseSubFinder/pkg/logic/file_downloader"
  6. "github.com/ChineseSubFinder/ChineseSubFinder/pkg/cache_center"
  7. "github.com/ChineseSubFinder/ChineseSubFinder/pkg/log_helper"
  8. "github.com/ChineseSubFinder/ChineseSubFinder/pkg/random_auth_key"
  9. )
  10. var assrtInstance *Supplier
  11. func defInstance() {
  12. pkg.ReadCustomAuthFile(log_helper.GetLogger4Tester())
  13. authKey := random_auth_key.AuthKey{
  14. BaseKey: pkg.BaseKey(),
  15. AESKey16: pkg.AESKey16(),
  16. AESIv16: pkg.AESIv16(),
  17. }
  18. assrtInstance = NewSupplier(file_downloader.NewFileDownloader(
  19. cache_center.NewCacheCenter("test", log_helper.GetLogger4Tester()), authKey))
  20. }
  21. func TestSupplier_getSubListFromFile(t *testing.T) {
  22. //videoFPath := "X:\\电影\\失控玩家 (2021)\\失控玩家 (2021).mp4"
  23. //isMovie := true
  24. defInstance()
  25. //videoFPath := "X:\\连续剧\\杀死伊芙 (2018)\\Season 4\\Killing Eve - S04E08 - Hello, Losers WEBDL-1080p.mkv"
  26. //videoFPath := "X:\\连续剧\\Why Didn’t They Ask Evans!\\Season 1\\Why Didn’t They Ask Evans! - S01E01 - Episode 1 WEBRip-1080p.mp4"
  27. videoFPath := "X:\\连续剧\\Pantheon\\Season 1\\Pantheon - S01E03 - Reign of Winter WEBDL-1080p.mkv"
  28. //videoFPath := "X:\\连续剧\\风骚律师 (2015)\\Season 6\\Better Call Saul - S06E05 - Black and Blue WEBDL-1080p.mkv"
  29. isMovie := false
  30. got, err := assrtInstance.getSubListFromFile(videoFPath, isMovie)
  31. if err != nil {
  32. t.Error(err)
  33. }
  34. for i, info := range got {
  35. println(i, info.Name, info.FileUrl)
  36. }
  37. }
  38. func TestSupplier_CheckAlive(t *testing.T) {
  39. defInstance()
  40. bok, speed := assrtInstance.CheckAlive()
  41. println(bok, speed)
  42. }