|
|
@@ -3,10 +3,10 @@ package subhd
|
|
|
import (
|
|
|
"fmt"
|
|
|
commonValue "github.com/allanpk716/ChineseSubFinder/internal/common"
|
|
|
- series_helper2 "github.com/allanpk716/ChineseSubFinder/internal/logic/series_helper"
|
|
|
+ "github.com/allanpk716/ChineseSubFinder/internal/logic/series_helper"
|
|
|
+ "github.com/allanpk716/ChineseSubFinder/internal/pkg/settings"
|
|
|
"github.com/allanpk716/ChineseSubFinder/internal/pkg/something_static"
|
|
|
"github.com/allanpk716/ChineseSubFinder/internal/pkg/unit_test_helper"
|
|
|
- "github.com/allanpk716/ChineseSubFinder/internal/types"
|
|
|
"path/filepath"
|
|
|
"testing"
|
|
|
)
|
|
|
@@ -25,7 +25,7 @@ func TestSupplier_GetSubListFromFile(t *testing.T) {
|
|
|
rootDir := unit_test_helper.GetTestDataResourceRootPath([]string{"sub_spplier"}, 5, true)
|
|
|
movie1 := filepath.Join(rootDir, "zimuku", "movies", "消失爱人 (2016)", "消失爱人 (2016) 720p AAC.rmvb")
|
|
|
|
|
|
- subhd := NewSupplier(types.ReqParam{DebugMode: true})
|
|
|
+ subhd := NewSupplier(*settings.NewSettings())
|
|
|
outList, err := subhd.getSubListFromFile4Movie(movie1)
|
|
|
if err != nil {
|
|
|
t.Error(err)
|
|
|
@@ -39,6 +39,11 @@ func TestSupplier_GetSubListFromFile(t *testing.T) {
|
|
|
for i, sublist := range outList {
|
|
|
println(i, sublist.Name, sublist.Ext, sublist.Language.String(), sublist.Score, sublist.FileUrl, len(sublist.Data))
|
|
|
}
|
|
|
+
|
|
|
+ alive, _ := subhd.CheckAlive()
|
|
|
+ if alive == false {
|
|
|
+ t.Fatal("CheckAlive == false")
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 无需关注这个测试用例,这个方案暂时弃用
|
|
|
@@ -53,11 +58,11 @@ func TestSupplier_GetSubListFromFile4Series(t *testing.T) {
|
|
|
rootDir := unit_test_helper.GetTestDataResourceRootPath([]string{"sub_spplier"}, 5, true)
|
|
|
ser := filepath.Join(rootDir, "zimuku", "series", "黄石 (2018)")
|
|
|
// 读取本地的视频和字幕信息
|
|
|
- seriesInfo, err := series_helper2.ReadSeriesInfoFromDir(ser, nil, false)
|
|
|
+ seriesInfo, err := series_helper.ReadSeriesInfoFromDir(ser, nil, false)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
}
|
|
|
- s := NewSupplier(types.ReqParam{DebugMode: true})
|
|
|
+ s := NewSupplier(*settings.NewSettings())
|
|
|
outList, err := s.GetSubListFromFile4Series(seriesInfo)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
|
@@ -79,7 +84,7 @@ func TestSupplier_getSubListFromKeyword4Movie(t *testing.T) {
|
|
|
//imdbID := "tt15299712" // 云南虫谷
|
|
|
//imdbID := "tt3626476" // Vacation Friends (2021)
|
|
|
getCode()
|
|
|
- subhd := NewSupplier(types.ReqParam{DebugMode: true})
|
|
|
+ subhd := NewSupplier(*settings.NewSettings())
|
|
|
subInfos, err := subhd.getSubListFromKeyword4Movie(imdbID)
|
|
|
if err != nil {
|
|
|
t.Fatal(err)
|