瀏覽代碼

修复,字幕名称生成函数的bug;
修复,修正字幕时间轴没有继承 default 关键词的问题;

Signed-off-by: 716 <[email protected]>

716 4 年之前
父節點
當前提交
753d2db70a

+ 2 - 3
internal/logic/emby_helper/embyhelper.go

@@ -8,7 +8,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_parser_hub"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/emby"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/language"
-	"github.com/allanpk716/ChineseSubFinder/internal/types/subparser"
 	"github.com/panjf2000/ants/v2"
 	"golang.org/x/net/context"
 	"path"
@@ -345,8 +344,8 @@ func (em *EmbyHelper) GetInternalEngSubAndExChineseEnglishSub(videoId string) (b
 
 				tmpFileName := filepath.Base(stream.Path)
 				// 去除 .default 或者 .forced
-				tmpFileName = strings.ReplaceAll(tmpFileName, subparser.Sub_Ext_Mark_Default, "")
-				tmpFileName = strings.ReplaceAll(tmpFileName, subparser.Sub_Ext_Mark_Forced, "")
+				//tmpFileName = strings.ReplaceAll(tmpFileName, subparser.Sub_Ext_Mark_Default, "")
+				//tmpFileName = strings.ReplaceAll(tmpFileName, subparser.Sub_Ext_Mark_Forced, "")
 				tmpFileNameWithOutExt = strings.ReplaceAll(tmpFileName, path.Ext(tmpFileName), "")
 				exSubList = append(exSubList, *emby.NewSubInfo(tmpFileNameWithOutExt+"."+stream.Codec, "."+stream.Codec, stream.Index))
 			} else {

+ 1 - 1
internal/logic/sub_timeline_fixer/sub_timeline_fixer_helper_test.go

@@ -25,7 +25,7 @@ func TestSubTimelineFixerHelper_fixOneVideoSub(t *testing.T) {
 	// 178071 -- The Night House
 	config := config.GetConfig()
 	fixer := NewSubTimelineFixerHelper(config.EmbyConfig, config.SubTimelineFixerConfig)
-	err := fixer.fixOneVideoSub("178071", "")
+	err := fixer.fixOneVideoSub("178071", "X:\\电影\\The Night House (2021)")
 	if err != nil {
 		t.Fatal(err)
 	}

+ 2 - 1
internal/pkg/emby_api/emby_api_test.go

@@ -57,7 +57,8 @@ func TestEmbyHelper_UpdateVideoSubList(t *testing.T) {
 	// 173354 -- 基地 S01E04
 	// 172412 -- Dan Brown's The Lost Symbol S01E01
 	// 194046 -- 窃贼军团
-	err := em.UpdateVideoSubList("194046")
+	// 178071 -- The Night House
+	err := em.UpdateVideoSubList("178071")
 	if err != nil {
 		t.Fatal(err)
 	}

+ 1 - 1
internal/pkg/sub_formatter/emby/emby.go

@@ -76,7 +76,7 @@ func (f Formatter) GenerateMixSubName(videoFileName, subExt string, subLang lang
 func (f Formatter) GenerateMixSubNameBase(fileNameWithOutExt, subExt string, subLang language2.MyLanguage, extraSubPreName string) (string, string, string) {
 	// 这里传入字幕后缀名的时候,可能会带有 default 或者 forced 字段,需要剔除
 	nowSubExt := strings.ReplaceAll(subExt, subparser.Sub_Ext_Mark_Default, "")
-	nowSubExt = strings.ReplaceAll(subExt, subparser.Sub_Ext_Mark_Forced, "")
+	nowSubExt = strings.ReplaceAll(nowSubExt, subparser.Sub_Ext_Mark_Forced, "")
 	note := ""
 	// extraSubPreName 那个字幕网站下载的
 	if extraSubPreName != "" {

+ 1 - 1
internal/pkg/sub_formatter/normal/normal.go

@@ -87,7 +87,7 @@ func (f Formatter) GenerateMixSubName(videoFileName, subExt string, subLang lang
 func (f Formatter) GenerateMixSubNameBase(fileNameWithOutExt, subExt string, subLang languageConst.MyLanguage, extraSubPreName string) (string, string, string) {
 	// 这里传入字幕后缀名的时候,可能会带有 default 或者 forced 字段,需要剔除
 	nowSubExt := strings.ReplaceAll(subExt, subparser.Sub_Ext_Mark_Default, "")
-	nowSubExt = strings.ReplaceAll(subExt, subparser.Sub_Ext_Mark_Forced, "")
+	nowSubExt = strings.ReplaceAll(nowSubExt, subparser.Sub_Ext_Mark_Forced, "")
 
 	subNewName := fileNameWithOutExt + "." + languageConst.ISO_639_1_Chinese + nowSubExt
 	subNewNameWithDefault := fileNameWithOutExt + "." + languageConst.ISO_639_1_Chinese + subparser.Sub_Ext_Mark_Default + nowSubExt