|
@@ -2,8 +2,8 @@ package subhd
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
series_helper2 "github.com/allanpk716/ChineseSubFinder/internal/logic/series_helper"
|
|
series_helper2 "github.com/allanpk716/ChineseSubFinder/internal/logic/series_helper"
|
|
|
- "github.com/allanpk716/ChineseSubFinder/internal/pkg/config"
|
|
|
|
|
- "github.com/allanpk716/ChineseSubFinder/internal/types"
|
|
|
|
|
|
|
+ "github.com/allanpk716/ChineseSubFinder/internal/pkg/unit_test_helper"
|
|
|
|
|
+ "path/filepath"
|
|
|
"testing"
|
|
"testing"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
@@ -11,13 +11,16 @@ func TestSupplier_GetSubListFromFile(t *testing.T) {
|
|
|
|
|
|
|
|
//movie1 := "X:\\电影\\The Devil All the Time (2020)\\The Devil All the Time (2020) WEBDL-1080p.mkv"
|
|
//movie1 := "X:\\电影\\The Devil All the Time (2020)\\The Devil All the Time (2020) WEBDL-1080p.mkv"
|
|
|
//movie1 := "X:\\电影\\Luca (2021)\\Luca (2021) WEBDL-1080p.mkv"
|
|
//movie1 := "X:\\电影\\Luca (2021)\\Luca (2021) WEBDL-1080p.mkv"
|
|
|
- movie1 := "X:\\电影\\The Boss Baby Family Business (2021)\\The Boss Baby Family Business (2021) WEBDL-1080p.mkv"
|
|
|
|
|
|
|
+ //movie1 := "X:\\电影\\The Boss Baby Family Business (2021)\\The Boss Baby Family Business (2021) WEBDL-1080p.mkv"
|
|
|
//movie1 := "X:\\电影\\Oslo (2021)\\Oslo (2021) WEBDL-1080p.mkv"
|
|
//movie1 := "X:\\电影\\Oslo (2021)\\Oslo (2021) WEBDL-1080p.mkv"
|
|
|
//movie1 := "X:\\电影\\Spiral From the Book of Saw (2021)\\Spiral From the Book of Saw (2021) WEBDL-1080p.mkv"
|
|
//movie1 := "X:\\电影\\Spiral From the Book of Saw (2021)\\Spiral From the Book of Saw (2021) WEBDL-1080p.mkv"
|
|
|
//movie1 := "X:\\电影\\消失爱人 (2016)\\消失爱人 (2016) 720p AAC.rmvb"
|
|
//movie1 := "X:\\电影\\消失爱人 (2016)\\消失爱人 (2016) 720p AAC.rmvb"
|
|
|
//movie1 := "X:\\电影\\机动战士Z高达:星之继承者 (2005)\\机动战士Z高达:星之继承者 (2005) 1080p TrueHD.mkv"
|
|
//movie1 := "X:\\电影\\机动战士Z高达:星之继承者 (2005)\\机动战士Z高达:星之继承者 (2005) 1080p TrueHD.mkv"
|
|
|
//movie1 := "X:\\连续剧\\The Bad Batch\\Season 1\\The Bad Batch - S01E01 - Aftermath WEBDL-1080p.mkv"
|
|
//movie1 := "X:\\连续剧\\The Bad Batch\\Season 1\\The Bad Batch - S01E01 - Aftermath WEBDL-1080p.mkv"
|
|
|
- subhd := NewSupplier(getReqParam())
|
|
|
|
|
|
|
+
|
|
|
|
|
+ rootDir := unit_test_helper.GetTestDataResourceRootPath([]string{"zimuku"}, 5, true)
|
|
|
|
|
+ movie1 := filepath.Join(rootDir, "movies", "The Devil All the Time (2020)", "The Devil All the Time (2020) WEBDL-1080p.mkv")
|
|
|
|
|
+ subhd := NewSupplier()
|
|
|
outList, err := subhd.getSubListFromFile4Movie(movie1)
|
|
outList, err := subhd.getSubListFromFile4Movie(movie1)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Error(err)
|
|
t.Error(err)
|
|
@@ -36,17 +39,19 @@ func TestSupplier_GetSubListFromFile(t *testing.T) {
|
|
|
func TestSupplier_GetSubListFromFile4Series(t *testing.T) {
|
|
func TestSupplier_GetSubListFromFile4Series(t *testing.T) {
|
|
|
|
|
|
|
|
//ser := "X:\\连续剧\\The Bad Batch" // tt12708542
|
|
//ser := "X:\\连续剧\\The Bad Batch" // tt12708542
|
|
|
- ser := "X:\\连续剧\\瑞克和莫蒂 (2013)" //
|
|
|
|
|
|
|
+ //ser := "X:\\连续剧\\瑞克和莫蒂 (2013)" //
|
|
|
//ser := "X:\\连续剧\\杀死伊芙 (2018)" // tt7016936
|
|
//ser := "X:\\连续剧\\杀死伊芙 (2018)" // tt7016936
|
|
|
//ser := "X:\\连续剧\\Money.Heist"
|
|
//ser := "X:\\连续剧\\Money.Heist"
|
|
|
//ser := "X:\\连续剧\\黑钱胜地 (2017)"
|
|
//ser := "X:\\连续剧\\黑钱胜地 (2017)"
|
|
|
|
|
|
|
|
|
|
+ rootDir := unit_test_helper.GetTestDataResourceRootPath([]string{"zimuku"}, 5, true)
|
|
|
|
|
+ ser := filepath.Join(rootDir, "series", "黄石 (2018)")
|
|
|
// 读取本地的视频和字幕信息
|
|
// 读取本地的视频和字幕信息
|
|
|
seriesInfo, err := series_helper2.ReadSeriesInfoFromDir(ser, nil, false)
|
|
seriesInfo, err := series_helper2.ReadSeriesInfoFromDir(ser, nil, false)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
t.Fatal(err)
|
|
|
}
|
|
}
|
|
|
- s := NewSupplier(getReqParam())
|
|
|
|
|
|
|
+ s := NewSupplier()
|
|
|
outList, err := s.GetSubListFromFile4Series(seriesInfo)
|
|
outList, err := s.GetSubListFromFile4Series(seriesInfo)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
t.Fatal(err)
|
|
@@ -66,7 +71,7 @@ func TestSupplier_getSubListFromKeyword4Movie(t *testing.T) {
|
|
|
//imdbID := "tt6468322" // 纸钞屋
|
|
//imdbID := "tt6468322" // 纸钞屋
|
|
|
//imdbID := "tt15299712" // 云南虫谷
|
|
//imdbID := "tt15299712" // 云南虫谷
|
|
|
//imdbID := "tt3626476" // Vacation Friends (2021)
|
|
//imdbID := "tt3626476" // Vacation Friends (2021)
|
|
|
- subhd := NewSupplier(getReqParam())
|
|
|
|
|
|
|
+ subhd := NewSupplier()
|
|
|
subInfos, err := subhd.getSubListFromKeyword4Movie(imdbID)
|
|
subInfos, err := subhd.getSubListFromKeyword4Movie(imdbID)
|
|
|
if err != nil {
|
|
if err != nil {
|
|
|
t.Fatal(err)
|
|
t.Fatal(err)
|
|
@@ -75,13 +80,3 @@ func TestSupplier_getSubListFromKeyword4Movie(t *testing.T) {
|
|
|
println(i, sublist.Name, sublist.Ext, sublist.Language.String(), sublist.Score, len(sublist.Data))
|
|
println(i, sublist.Name, sublist.Ext, sublist.Language.String(), sublist.Score, len(sublist.Data))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
-func getReqParam() types.ReqParam {
|
|
|
|
|
-
|
|
|
|
|
- config := config.GetConfig()
|
|
|
|
|
- req := types.ReqParam{}
|
|
|
|
|
- if config.UseProxy == true {
|
|
|
|
|
- req.HttpProxy = config.HttpProxy
|
|
|
|
|
- }
|
|
|
|
|
- return req
|
|
|
|
|
-}
|
|
|