Prechádzať zdrojové kódy

1,新增,当一部电影根目录,一部连续剧的根目录存在 .ignore 文件,则跳过下载字幕的扫描
2,AutoDetectThenChangeTo 也判断 .ignore 文件,有则跳过字幕命名的自动修改逻辑,这里需要之一 hot fix 的逻辑是不能跳过的

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

allan716 4 rokov pred
rodič
commit
86a5ab6ce5
37 zmenil súbory, kde vykonal 167 pridanie a 131 odobranie
  1. 4 4
      cmd/chinesesubfinder/main.go
  2. 2 0
      internal/common/constvalue.go
  3. 3 3
      internal/dao/init.go
  4. 12 12
      internal/downloader.go
  5. 2 2
      internal/logic/forced_scan_and_down_sub/forced_scan_and_down_sub.go
  6. 2 2
      internal/logic/forced_scan_and_down_sub/forced_scan_and_down_sub_test.go
  7. 6 6
      internal/logic/series_helper/seriesHelper.go
  8. 2 2
      internal/logic/sub_parser/ass/ass_test.go
  9. 2 2
      internal/logic/sub_parser/srt/srt_test.go
  10. 3 3
      internal/logic/sub_supplier/shooter/shooter.go
  11. 20 0
      internal/logic/sub_supplier/subSupplierHub.go
  12. 10 10
      internal/logic/sub_supplier/subhd/subhd.go
  13. 3 3
      internal/logic/sub_supplier/xunlei/xunlei.go
  14. 12 12
      internal/logic/sub_supplier/zimuku/zimuku.go
  15. 2 2
      internal/logic/sub_timeline_fixer/sub_timeline_fixer_helper.go
  16. 4 5
      internal/pkg/archive_helper/unarchiveFile_test.go
  17. 4 4
      internal/pkg/ffmpeg_helper/ffmpeg_helper.go
  18. 2 2
      internal/pkg/ffmpeg_helper/ffmpeg_helper_test.go
  19. 5 5
      internal/pkg/ffmpeg_helper/ffmpeg_info.go
  20. 4 4
      internal/pkg/hot_fix/hot_fix_001.go
  21. 3 4
      internal/pkg/hot_fix/hot_fix_001_test.go
  22. 2 3
      internal/pkg/hot_fix/hot_fix_hub_test.go
  23. 2 2
      internal/pkg/imdb_helper/imdb.go
  24. 1 1
      internal/pkg/my_util/random.go
  25. 1 1
      internal/pkg/my_util/util.go
  26. 1 1
      internal/pkg/my_util/util_test.go
  27. 2 2
      internal/pkg/pass_water_wall/pass_water_wall.go
  28. 2 2
      internal/pkg/rod_helper/rodHelper.go
  29. 24 6
      internal/pkg/sub_formatter/sub_format_changer.go
  30. 3 4
      internal/pkg/sub_formatter/sub_format_changer_test.go
  31. 2 2
      internal/pkg/sub_helper/dialogue_merger_test.go
  32. 3 3
      internal/pkg/sub_helper/sub_helper.go
  33. 4 4
      internal/pkg/sub_helper/sub_helper_test.go
  34. 2 2
      internal/pkg/sub_parser_hub/subParserHub_test.go
  35. 3 3
      internal/pkg/sub_timeline_fixer/fixer.go
  36. 3 3
      internal/pkg/sub_timeline_fixer/fixer_test.go
  37. 5 5
      internal/pkg/sub_timeline_fixer/sub_unit.go

+ 4 - 4
cmd/chinesesubfinder/main.go

@@ -3,10 +3,10 @@ package main
 import (
 	"github.com/allanpk716/ChineseSubFinder/internal"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_timeline_fixer"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	config2 "github.com/allanpk716/ChineseSubFinder/internal/pkg/config"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/hot_fix"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/proxy_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_formatter"
@@ -22,7 +22,7 @@ func init() {
 
 	log.Infoln("ChineseSubFinder Version:", AppVersion)
 
-	if pkg.OSCheck() == false {
+	if my_util.OSCheck() == false {
 		panic(`only support Linux and Windows, if you want support MacOS, 
 you need implement getDbName() in file: internal/dao/init.go 
 and 
@@ -57,11 +57,11 @@ func main() {
 	}
 
 	// 判断文件夹是否存在
-	if pkg.IsDir(config.MovieFolder) == false {
+	if my_util.IsDir(config.MovieFolder) == false {
 		log.Errorln("MovieFolder not found --", config.MovieFolder)
 		return
 	}
-	if pkg.IsDir(config.SeriesFolder) == false {
+	if my_util.IsDir(config.SeriesFolder) == false {
 		log.Errorln("SeriesFolder not found --", config.SeriesFolder)
 		return
 	}

+ 2 - 0
internal/common/constvalue.go

@@ -35,3 +35,5 @@ const (
 	TimeFormatAss = "15:04:05.00"
 	TimeFormatSrt = "15:04:05,000"
 )
+
+const Ignore = ".ignore"

+ 3 - 3
internal/dao/init.go

@@ -4,8 +4,8 @@ import (
 	"errors"
 	"fmt"
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sqlite"
 	"gorm.io/gorm"
 	"os"
@@ -46,7 +46,7 @@ func DeleteDbFile() error {
 	// 如果是 Linux 则在 /config 目录下
 	nowDbFileName := getDbName()
 
-	if pkg.IsFile(nowDbFileName) == true {
+	if my_util.IsFile(nowDbFileName) == true {
 		return os.Remove(nowDbFileName)
 	}
 	return nil
@@ -63,7 +63,7 @@ you need implement getDbName() in file: internal/dao/init.go `))
 	}
 
 	dbDir := filepath.Dir(nowDbFileName)
-	if pkg.IsDir(dbDir) == false {
+	if my_util.IsDir(dbDir) == false {
 		_ = os.MkdirAll(dbDir, os.ModePerm)
 	}
 	db, err = gorm.Open(sqlite.Open(nowDbFileName), &gorm.Config{})

+ 12 - 12
internal/downloader.go

@@ -11,9 +11,9 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_supplier/shooter"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_supplier/xunlei"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_supplier/zimuku"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	subcommon "github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_formatter/common"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/types"
@@ -153,7 +153,7 @@ func (d Downloader) RefreshEmbySubList() error {
 func (d Downloader) DownloadSub4Movie(dir string) error {
 	defer func() {
 		// 所有的电影字幕下载完成,抉择完成,需要清理缓存目录
-		err := pkg.ClearRootTmpFolder()
+		err := my_util.ClearRootTmpFolder()
 		if err != nil {
 			d.log.Error("ClearRootTmpFolder", err)
 		}
@@ -164,7 +164,7 @@ func (d Downloader) DownloadSub4Movie(dir string) error {
 	// 优先判断特殊的操作
 	if d.needForcedScanAndDownSub == true {
 		// 全扫描
-		d.movieFileFullPathList, err = pkg.SearchMatchedVideoFile(dir)
+		d.movieFileFullPathList, err = my_util.SearchMatchedVideoFile(dir)
 		if err != nil {
 			return err
 		}
@@ -172,7 +172,7 @@ func (d Downloader) DownloadSub4Movie(dir string) error {
 		// 是否是通过 emby_helper api 获取的列表
 		if d.embyHelper == nil {
 			// 没有填写 emby_helper api 的信息,那么就走常规的全文件扫描流程
-			d.movieFileFullPathList, err = pkg.SearchMatchedVideoFile(dir)
+			d.movieFileFullPathList, err = my_util.SearchMatchedVideoFile(dir)
 			if err != nil {
 				return err
 			}
@@ -268,7 +268,7 @@ func (d Downloader) DownloadSub4Series(dir string) error {
 	var err error
 	defer func() {
 		// 所有的连续剧字幕下载完成,抉择完成,需要清理缓存目录
-		err := pkg.ClearRootTmpFolder()
+		err := my_util.ClearRootTmpFolder()
 		if err != nil {
 			d.log.Error("ClearRootTmpFolder", err)
 		}
@@ -337,7 +337,7 @@ func (d Downloader) DownloadSub4Series(dir string) error {
 				continue
 			}
 			// 匹配对应的 Eps 去处理
-			seasonEpsKey := pkg.GetEpisodeKeyName(episodeInfo.Season, episodeInfo.Episode)
+			seasonEpsKey := my_util.GetEpisodeKeyName(episodeInfo.Season, episodeInfo.Episode)
 			d.oneVideoSelectBestSub(episodeInfo.FileFullPath, fullSeasonSubDict[seasonEpsKey])
 		}
 		// 是否清理全季的缓存字幕文件夹
@@ -520,7 +520,7 @@ func (d Downloader) saveFullSeasonSub(seriesInfo *series.SeriesInfo, organizeSub
 	var fullSeasonSubDict = make(map[string][]string)
 
 	for _, season := range seriesInfo.SeasonDict {
-		seasonKey := pkg.GetEpisodeKeyName(season, 0)
+		seasonKey := my_util.GetEpisodeKeyName(season, 0)
 		subs, ok := organizeSubFiles[seasonKey]
 		if ok == false {
 			continue
@@ -530,7 +530,7 @@ func (d Downloader) saveFullSeasonSub(seriesInfo *series.SeriesInfo, organizeSub
 			newSeasonSubRootPath := filepath.Join(seriesInfo.DirPath, "Sub_"+seasonKey)
 			_ = os.MkdirAll(newSeasonSubRootPath, os.ModePerm)
 			newSubFullPath := filepath.Join(newSeasonSubRootPath, subFileName)
-			err := pkg.CopyFile(sub, newSubFullPath)
+			err := my_util.CopyFile(sub, newSubFullPath)
 			if err != nil {
 				d.log.Errorln("saveFullSeasonSub", subFileName, err)
 				continue
@@ -541,7 +541,7 @@ func (d Downloader) saveFullSeasonSub(seriesInfo *series.SeriesInfo, organizeSub
 				return nil
 			}
 			// 把整季的字幕缓存位置也提供出去,如果之前没有下载到的,这里返回出来的可以补上
-			seasonEpsKey := pkg.GetEpisodeKeyName(gusSeason, gusEpisode)
+			seasonEpsKey := my_util.GetEpisodeKeyName(gusSeason, gusEpisode)
 			_, ok := fullSeasonSubDict[seasonEpsKey]
 			if ok == false {
 				// 初始化
@@ -563,7 +563,7 @@ func (d Downloader) writeSubFile2VideoPath(videoFileFullPath string, finalSubFil
 	desSubFullPath := filepath.Join(videoRootPath, subNewName)
 	if setDefault == true {
 		// 先判断没有 default 的字幕是否存在了,在的话,先删除,然后再写入
-		if pkg.IsFile(desSubFullPath) == true {
+		if my_util.IsFile(desSubFullPath) == true {
 			_ = os.Remove(desSubFullPath)
 		}
 		desSubFullPath = filepath.Join(videoRootPath, subNewNameWithDefault)
@@ -571,7 +571,7 @@ func (d Downloader) writeSubFile2VideoPath(videoFileFullPath string, finalSubFil
 
 	if skipExistFile == true {
 		// 需要判断文件是否存在在,有则跳过
-		if pkg.IsFile(desSubFullPath) == true {
+		if my_util.IsFile(desSubFullPath) == true {
 			d.log.Infoln("OrgSubName:", finalSubFile.Name)
 			d.log.Infoln("Sub Skip DownAt:", desSubFullPath)
 			return nil
@@ -601,7 +601,7 @@ func (d Downloader) copySubFile2DesFolder(desFolder string, subFiles []string) e
 	// 复制下载在 tmp 文件夹中的字幕文件到视频文件夹下面
 	for _, subFile := range subFiles {
 		newFn := filepath.Join(desFolderFullPath, filepath.Base(subFile))
-		err = pkg.CopyFile(subFile, newFn)
+		err = my_util.CopyFile(subFile, newFn)
 		if err != nil {
 			return err
 		}

+ 2 - 2
internal/logic/forced_scan_and_down_sub/forced_scan_and_down_sub.go

@@ -3,7 +3,7 @@ package forced_scan_and_down_sub
 import (
 	"errors"
 	"fmt"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"os"
 	"runtime"
 )
@@ -16,7 +16,7 @@ func CheckSpeFile() (bool, error) {
 		return false, errors.New(fmt.Sprintf(`forced_scan_and_down_sub.getSpeFileName() is empty, not support this OS. 
 you needd implement getSpeFileName() in internal/logic/forced_scan_and_down_sub/forced_scan_and_down_sub.go`))
 	}
-	if pkg.IsFile(nowSpeFileName) == false {
+	if my_util.IsFile(nowSpeFileName) == false {
 		return false, nil
 	}
 	// 先删除这个文件,然后再标记执行该逻辑

+ 2 - 2
internal/logic/forced_scan_and_down_sub/forced_scan_and_down_sub_test.go

@@ -1,7 +1,7 @@
 package forced_scan_and_down_sub
 
 import (
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"os"
 	"testing"
 )
@@ -30,7 +30,7 @@ func TestCheckSpeFile(t *testing.T) {
 		t.Fatal(err)
 	}
 
-	if got == false || pkg.IsFile(getSpeFileName()) == true {
+	if got == false || my_util.IsFile(getSpeFileName()) == true {
 		t.Fatal("CheckSpeFile fatal")
 	}
 }

+ 6 - 6
internal/logic/series_helper/seriesHelper.go

@@ -6,10 +6,10 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/internal/ifaces"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_parser/ass"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_parser/srt"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/imdb_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_parser_hub"
 	"github.com/allanpk716/ChineseSubFinder/internal/types"
@@ -34,7 +34,7 @@ func ReadSeriesInfoFromDir(seriesDir string, imdbInfo *imdb.Title, forcedScanAnd
 		return nil, err
 	}
 	// 搜索所有的视频
-	videoFiles, err := pkg.SearchMatchedVideoFile(seriesDir)
+	videoFiles, err := my_util.SearchMatchedVideoFile(seriesDir)
 	if err != nil {
 		return nil, err
 	}
@@ -64,7 +64,7 @@ func ReadSeriesInfoFromDir(seriesDir string, imdbInfo *imdb.Title, forcedScanAnd
 			log_helper.GetLogger().Warnln("DetermineFileTypeFromFile", subFile, "not support SubType")
 			continue
 		}
-		epsKey := pkg.GetEpisodeKeyName(info.Season, info.Episode)
+		epsKey := my_util.GetEpisodeKeyName(info.Season, info.Episode)
 		oneFileSubInfo := series.SubInfo{
 			Title:        info.Title,
 			Season:       info.Season,
@@ -226,7 +226,7 @@ func whichSeasonEpsNeedDownloadSub(seriesInfo *series.SeriesInfo, forcedScanAndD
 	if forcedScanAndDownloadSub == true {
 		for _, epsInfo := range seriesInfo.EpList {
 			// 添加
-			epsKey := pkg.GetEpisodeKeyName(epsInfo.Season, epsInfo.Episode)
+			epsKey := my_util.GetEpisodeKeyName(epsInfo.Season, epsInfo.Episode)
 			needDlSubEpsList[epsKey] = epsInfo
 			needDlSeasonList[epsInfo.Season] = epsInfo.Season
 		}
@@ -252,7 +252,7 @@ func whichSeasonEpsNeedDownloadSub(seriesInfo *series.SeriesInfo, forcedScanAndD
 
 		if len(epsInfo.SubAlreadyDownloadedList) < 1 || baseTime.Add(dayRange).After(currentTime) == true {
 			// 添加
-			epsKey := pkg.GetEpisodeKeyName(epsInfo.Season, epsInfo.Episode)
+			epsKey := my_util.GetEpisodeKeyName(epsInfo.Season, epsInfo.Episode)
 			needDlSubEpsList[epsKey] = epsInfo
 			needDlSeasonList[epsInfo.Season] = epsInfo.Season
 		} else {
@@ -310,7 +310,7 @@ func getEpsInfoAndSubDic(videoFile string, EpisodeDict map[string]series.Episode
 		log_helper.GetLogger().Errorln("model.GetImdbInfo4OneSeriesEpisode", err)
 		return
 	}
-	epsKey := pkg.GetEpisodeKeyName(info.Season, info.Episode)
+	epsKey := my_util.GetEpisodeKeyName(info.Season, info.Episode)
 	_, ok := EpisodeDict[epsKey]
 	if ok == false {
 		// 初始化

+ 2 - 2
internal/logic/sub_parser/ass/ass_test.go

@@ -1,7 +1,7 @@
 package ass
 
 import (
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/language"
 	"testing"
 )
@@ -9,7 +9,7 @@ import (
 func TestParser_DetermineFileTypeFromFile(t *testing.T) {
 
 	testDataPath := "../../../../TestData/sub_parser"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}

+ 2 - 2
internal/logic/sub_parser/srt/srt_test.go

@@ -1,7 +1,7 @@
 package srt
 
 import (
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/language"
 	"path/filepath"
 	"testing"
@@ -9,7 +9,7 @@ import (
 
 func TestParser_DetermineFileType(t *testing.T) {
 	testDataPath := "../../../../TestData/sub_parser"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}

+ 3 - 3
internal/logic/sub_supplier/shooter/shooter.go

@@ -4,8 +4,8 @@ import (
 	"crypto/md5"
 	"fmt"
 	"github.com/allanpk716/ChineseSubFinder/internal/common"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/types"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/language"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/series"
@@ -74,7 +74,7 @@ func (s Supplier) getSubListFromFile(filePath string) ([]supplier.SubInfo, error
 
 	fileName := filepath.Base(filePath)
 
-	httpClient := pkg.NewHttpClient(s.reqParam)
+	httpClient := my_util.NewHttpClient(s.reqParam)
 
 	_, err = httpClient.R().
 		SetFormData(map[string]string{
@@ -95,7 +95,7 @@ func (s Supplier) getSubListFromFile(filePath string) ([]supplier.SubInfo, error
 				subExt = "." + subExt
 			}
 
-			data, _, err := pkg.DownFile(file.Link)
+			data, _, err := my_util.DownFile(file.Link)
 			if err != nil {
 				s.log.Error(err)
 				continue

+ 20 - 0
internal/logic/sub_supplier/subSupplierHub.go

@@ -1,10 +1,12 @@
 package sub_supplier
 
 import (
+	"github.com/allanpk716/ChineseSubFinder/internal/common"
 	"github.com/allanpk716/ChineseSubFinder/internal/ifaces"
 	movieHelper "github.com/allanpk716/ChineseSubFinder/internal/logic/movie_helper"
 	seriesHelper "github.com/allanpk716/ChineseSubFinder/internal/logic/series_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/emby"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/series"
@@ -36,6 +38,15 @@ func NewSubSupplierHub(one ifaces.ISupplier, _inSupplier ...ifaces.ISupplier) *S
 // DownloadSub4Movie 某一个电影字幕下载,下载完毕后,返回下载缓存每个字幕的位置
 func (d SubSupplierHub) DownloadSub4Movie(videoFullPath string, index int, forcedScanAndDownloadSub bool) ([]string, error) {
 
+	if forcedScanAndDownloadSub == false {
+		// 非强制扫描的时候,需要判断这个视频根目录是否有 .ignore 文件,有也跳过
+		if my_util.IsFile(filepath.Join(filepath.Dir(videoFullPath), common.Ignore)) == true {
+			d.log.Infoln("Found", common.Ignore, "Skip", videoFullPath)
+			// 跳过下载字幕
+			return nil, nil
+		}
+	}
+
 	// 跳过中文的电影,不是一定要跳过的
 	skip, err := movieHelper.SkipChineseMovie(videoFullPath, d.Suppliers[0].GetReqParam())
 	if err != nil {
@@ -78,6 +89,15 @@ func (d SubSupplierHub) DownloadSub4Movie(videoFullPath string, index int, force
 // DownloadSub4Series 某一部连续剧的字幕下载,下载完毕后,返回下载缓存每个字幕的位置
 func (d SubSupplierHub) DownloadSub4Series(seriesDirPath string, index int, forcedScanAndDownloadSub bool) (*series.SeriesInfo, map[string][]string, error) {
 
+	if forcedScanAndDownloadSub == false {
+		// 非强制扫描的时候,需要判断这个视频根目录是否有 .ignore 文件,有也跳过
+		if my_util.IsFile(filepath.Join(seriesDirPath, common.Ignore)) == true {
+			d.log.Infoln("Found", common.Ignore, "Skip", seriesDirPath)
+			// 跳过下载字幕
+			return nil, nil, nil
+		}
+	}
+
 	// 跳过中文的连续剧,不是一定要跳过的
 	skip, imdbInfo, err := seriesHelper.SkipChineseSeries(seriesDirPath, d.Suppliers[0].GetReqParam())
 	if err != nil {

+ 10 - 10
internal/logic/sub_supplier/subhd/subhd.go

@@ -6,9 +6,9 @@ import (
 	"github.com/PuerkitoBio/goquery"
 	"github.com/Tnze/go.num/v2/zh"
 	"github.com/allanpk716/ChineseSubFinder/internal/common"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/rod_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_parser_hub"
@@ -127,7 +127,7 @@ func (s Supplier) GetSubListFromFile4Series(seriesInfo *series.SeriesInfo) ([]su
 			s.log.Errorln("subhd step2Ex", err)
 			continue
 		}
-		oneSubInfo := supplier.NewSubInfo(s.GetSupplierName(), int64(i), hdContent.Filename, language.ChineseSimple, pkg.AddBaseUrl(common.SubSubHDRootUrl, item.Url), 0,
+		oneSubInfo := supplier.NewSubInfo(s.GetSupplierName(), int64(i), hdContent.Filename, language.ChineseSimple, my_util.AddBaseUrl(common.SubSubHDRootUrl, item.Url), 0,
 			0, hdContent.Ext, hdContent.Data)
 		oneSubInfo.Season = item.Season
 		oneSubInfo.Episode = item.Episode
@@ -177,7 +177,7 @@ func (s Supplier) getSubListFromFile4Movie(filePath string) ([]supplier.SubInfo,
 		}
 	}
 	// 如果没有,那么就用文件名查找
-	searchKeyword := pkg.VideoNameSearchKeywordMaker(info.Title, imdbInfo.Year)
+	searchKeyword := my_util.VideoNameSearchKeywordMaker(info.Title, imdbInfo.Year)
 	subInfoList, err = s.getSubListFromKeyword4Movie(searchKeyword)
 	if err != nil {
 		s.log.Errorln(s.GetSupplierName(), "keyword:", searchKeyword)
@@ -219,7 +219,7 @@ func (s Supplier) getSubListFromKeyword4Movie(keyword string) ([]supplier.SubInf
 			s.log.Errorln("subhd step2Ex", err)
 			return nil, err
 		}
-		subInfos = append(subInfos, *supplier.NewSubInfo(s.GetSupplierName(), int64(i), hdContent.Filename, language.ChineseSimple, pkg.AddBaseUrl(common.SubSubHDRootUrl, item.Url), 0, 0, hdContent.Ext, hdContent.Data))
+		subInfos = append(subInfos, *supplier.NewSubInfo(s.GetSupplierName(), int64(i), hdContent.Filename, language.ChineseSimple, my_util.AddBaseUrl(common.SubSubHDRootUrl, item.Url), 0, 0, hdContent.Ext, hdContent.Data))
 	}
 
 	return subInfos, nil
@@ -239,7 +239,7 @@ func (s Supplier) whichEpisodeNeedDownloadSub(seriesInfo *series.SeriesInfo, all
 		}
 		subInfo.Season = season
 		subInfo.Episode = episode
-		epsKey := pkg.GetEpisodeKeyName(season, episode)
+		epsKey := my_util.GetEpisodeKeyName(season, episode)
 		_, ok := allSubDict[epsKey]
 		if ok == false {
 			// 初始化
@@ -356,7 +356,7 @@ func (s Supplier) step1(browser *rod.Browser, detailPageUrl string, isMovieOrSer
 			notify_center.Notify.Add("subhd_step1", err.Error())
 		}
 	}()
-	detailPageUrl = pkg.AddBaseUrl(common.SubSubHDRootUrl, detailPageUrl)
+	detailPageUrl = my_util.AddBaseUrl(common.SubSubHDRootUrl, detailPageUrl)
 	result, page, err := s.httpGetFromBrowser(browser, detailPageUrl)
 	if err != nil {
 		return nil, err
@@ -426,7 +426,7 @@ func (s Supplier) step2Ex(browser *rod.Browser, subDownloadPageUrl string) (*HdC
 			notify_center.Notify.Add("subhd_step2Ex", err.Error())
 		}
 	}()
-	subDownloadPageUrl = pkg.AddBaseUrl(common.SubSubHDRootUrl, subDownloadPageUrl)
+	subDownloadPageUrl = my_util.AddBaseUrl(common.SubSubHDRootUrl, subDownloadPageUrl)
 
 	pageString, page, err := s.httpGetFromBrowser(browser, subDownloadPageUrl)
 	if err != nil {
@@ -572,7 +572,7 @@ func (s Supplier) passWaterWall(page *rod.Page) {
 	shadowbg := slideBgEl.MustResource()
 	// 取得原始圖像
 	src := slideBgEl.MustProperty("src")
-	fullbg, _, err := pkg.DownFile(strings.Replace(src.String(), "img_index=1", "img_index=0", 1))
+	fullbg, _, err := my_util.DownFile(strings.Replace(src.String(), "img_index=1", "img_index=0", 1))
 	if err != nil {
 		panic(err)
 	}
@@ -642,7 +642,7 @@ search:
 
 	if s.reqParam.DebugMode == true {
 		//截圖保存
-		nowProcessRoot, err := pkg.GetDebugFolder()
+		nowProcessRoot, err := my_util.GetDebugFolder()
 		if err == nil {
 			page.MustScreenshot(filepath.Join(nowProcessRoot, "result.png"))
 		} else {
@@ -662,7 +662,7 @@ func (s Supplier) httpGetFromBrowser(browser *rod.Browser, inputUrl string) (str
 		return "", nil, err
 	}
 	// 每次搜索间隔在 30-40s
-	time.Sleep(pkg.RandomSecondDuration(5, 10))
+	time.Sleep(my_util.RandomSecondDuration(5, 10))
 
 	return pageString, page, nil
 }

+ 3 - 3
internal/logic/sub_supplier/xunlei/xunlei.go

@@ -4,9 +4,9 @@ import (
 	"crypto/sha1"
 	"fmt"
 	"github.com/allanpk716/ChineseSubFinder/internal/common"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/language"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_parser_hub"
 	"github.com/allanpk716/ChineseSubFinder/internal/types"
@@ -67,7 +67,7 @@ func (s Supplier) getSubListFromFile(filePath string) ([]supplier.SubInfo, error
 	if len(cid) == 0 {
 		return outSubList, common.XunLeiCIdIsEmpty
 	}
-	httpClient := pkg.NewHttpClient(s.reqParam)
+	httpClient := my_util.NewHttpClient(s.reqParam)
 	resp, err := httpClient.R().
 		SetResult(&jsonList).
 		Get(fmt.Sprintf(common.SubXunLeiRootUrl, cid))
@@ -106,7 +106,7 @@ func (s Supplier) getSubListFromFile(filePath string) ([]supplier.SubInfo, error
 	// 再开始下载字幕
 	for i, v := range tmpXunLeiSubListChinese {
 		tmpLang := language.LangConverter4Sub_Supplier(v.Language)
-		data, filename, err := pkg.DownFile(v.Surl)
+		data, filename, err := my_util.DownFile(v.Surl)
 		if err != nil {
 			s.log.Errorln("xunlei pkg.DownFile:", err)
 			continue

+ 12 - 12
internal/logic/sub_supplier/zimuku/zimuku.go

@@ -5,10 +5,10 @@ import (
 	"github.com/PuerkitoBio/goquery"
 	"github.com/Tnze/go.num/v2/zh"
 	"github.com/allanpk716/ChineseSubFinder/internal/common"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/language"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_parser_hub"
 	"github.com/allanpk716/ChineseSubFinder/internal/types"
@@ -149,7 +149,7 @@ func (s Supplier) getSubListFromMovie(fileFPath string) ([]supplier.SubInfo, err
 	}
 
 	// 如果没有,那么就用文件名查找
-	searchKeyword := pkg.VideoNameSearchKeywordMaker(info.Title, imdbInfo.Year)
+	searchKeyword := my_util.VideoNameSearchKeywordMaker(info.Title, imdbInfo.Year)
 	subInfoList, err = s.getSubListFromKeyword(searchKeyword)
 	if err != nil {
 		s.log.Errorln(s.GetSupplierName(), "keyword:", searchKeyword)
@@ -195,7 +195,7 @@ func (s Supplier) whichEpisodeNeedDownloadSub(seriesInfo *series.SeriesInfo, All
 		}
 		subInfo.Season = season
 		subInfo.Episode = episode
-		epsKey := pkg.GetEpisodeKeyName(season, episode)
+		epsKey := my_util.GetEpisodeKeyName(season, episode)
 		_, ok := allSubDict[epsKey]
 		if ok == false {
 			// 初始化
@@ -277,7 +277,7 @@ func (s Supplier) whichSubInfoNeedDownload(subInfos SubInfos, err error) []suppl
 		}
 		// 默认都是包含中文字幕的,然后具体使用的时候再进行区分
 
-		oneSubInfo := supplier.NewSubInfo(s.GetSupplierName(), int64(i), fileName, language2.ChineseSimple, pkg.AddBaseUrl(common.SubZiMuKuRootUrl, subInfo.SubDownloadPageUrl), 0,
+		oneSubInfo := supplier.NewSubInfo(s.GetSupplierName(), int64(i), fileName, language2.ChineseSimple, my_util.AddBaseUrl(common.SubZiMuKuRootUrl, subInfo.SubDownloadPageUrl), 0,
 			0, filepath.Ext(fileName), data)
 
 		oneSubInfo.Season = subInfo.Season
@@ -297,7 +297,7 @@ func (s Supplier) step0(keyword string) (string, error) {
 			notify_center.Notify.Add("zimuku_step0", err.Error())
 		}
 	}()
-	httpClient := pkg.NewHttpClient(s.reqParam)
+	httpClient := my_util.NewHttpClient(s.reqParam)
 	// 第一级界面,有多少个字幕
 	resp, err := httpClient.R().
 		SetQueryParams(map[string]string{
@@ -326,8 +326,8 @@ func (s Supplier) step1(filmDetailPageUrl string) (SubResult, error) {
 			notify_center.Notify.Add("zimuku_step1", err.Error())
 		}
 	}()
-	filmDetailPageUrl = pkg.AddBaseUrl(common.SubZiMuKuRootUrl, filmDetailPageUrl)
-	httpClient := pkg.NewHttpClient(s.reqParam)
+	filmDetailPageUrl = my_util.AddBaseUrl(common.SubZiMuKuRootUrl, filmDetailPageUrl)
+	httpClient := my_util.NewHttpClient(s.reqParam)
 	resp, err := httpClient.R().
 		Get(filmDetailPageUrl)
 	if err != nil {
@@ -427,8 +427,8 @@ func (s Supplier) step2(subInfo *SubInfo) error {
 			notify_center.Notify.Add("zimuku_step2", err.Error())
 		}
 	}()
-	detailUrl := pkg.AddBaseUrl(common.SubZiMuKuRootUrl, subInfo.DetailUrl)
-	httpClient := pkg.NewHttpClient(s.reqParam)
+	detailUrl := my_util.AddBaseUrl(common.SubZiMuKuRootUrl, subInfo.DetailUrl)
+	httpClient := my_util.NewHttpClient(s.reqParam)
 	resp, err := httpClient.R().
 		Get(detailUrl)
 	if err != nil {
@@ -457,8 +457,8 @@ func (s Supplier) step3(subDownloadPageUrl string) (string, []byte, error) {
 			notify_center.Notify.Add("zimuku_step3", err.Error())
 		}
 	}()
-	subDownloadPageUrl = pkg.AddBaseUrl(common.SubZiMuKuRootUrl, subDownloadPageUrl)
-	httpClient := pkg.NewHttpClient(s.reqParam)
+	subDownloadPageUrl = my_util.AddBaseUrl(common.SubZiMuKuRootUrl, subDownloadPageUrl)
+	httpClient := my_util.NewHttpClient(s.reqParam)
 	resp, err := httpClient.R().
 		Get(subDownloadPageUrl)
 	if err != nil {
@@ -475,7 +475,7 @@ func (s Supplier) step3(subDownloadPageUrl string) (string, []byte, error) {
 
 	s.reqParam.Referer = subDownloadPageUrl
 	for i := 0; i < len(matched); i++ {
-		data, filename, err = pkg.DownFile(pkg.AddBaseUrl(common.SubZiMuKuRootUrl, matched[i][1]), s.reqParam)
+		data, filename, err = my_util.DownFile(my_util.AddBaseUrl(common.SubZiMuKuRootUrl, matched[i][1]), s.reqParam)
 		if err != nil {
 			s.log.Errorln("ZiMuKu step3 DownloadFile", err)
 			continue

+ 2 - 2
internal/logic/sub_timeline_fixer/sub_timeline_fixer_helper.go

@@ -7,8 +7,8 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/emby_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_parser/ass"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_parser/srt"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	formatterEmby "github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_formatter/emby"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_formatter/normal"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_helper"
@@ -230,7 +230,7 @@ func (s SubTimelineFixerHelper) fixSubTimeline(enSubFile emby.SubInfo, containCh
 
 	// 把原始的文件缓存下来,新建缓存的文件夹
 	cacheTmpPath := filepath.Join(tmpSubFixCacheFolder, infoBaseNameWithOutExt)
-	if pkg.IsDir(cacheTmpPath) == false {
+	if my_util.IsDir(cacheTmpPath) == false {
 		err = os.MkdirAll(cacheTmpPath, os.ModePerm)
 		if err != nil {
 			return false, nil, fixedSubName, err

+ 4 - 5
internal/pkg/archive_helper/unarchiveFile_test.go

@@ -1,8 +1,7 @@
 package archive_helper
 
 import (
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
-	"path"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"path/filepath"
 	"strings"
 	"testing"
@@ -11,7 +10,7 @@ import (
 func TestUnArchiveFile(t *testing.T) {
 
 	testDataPath := "../../../TestData/zips"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -28,10 +27,10 @@ func tetUnArchive(t *testing.T, testRootDir string, missionName string) {
 	if err != nil {
 		t.Fatal(err)
 	}
-	if pkg.IsFile(filepath.Join(desPath, subASS)) == false {
+	if my_util.IsFile(filepath.Join(desPath, subASS)) == false {
 		t.Fatal(missionName, " unArchive failed")
 	}
-	if pkg.IsFile(filepath.Join(desPath, subSRT)) == false {
+	if my_util.IsFile(filepath.Join(desPath, subSRT)) == false {
 		t.Fatal(missionName, " unArchive failed")
 	}
 }

+ 4 - 4
internal/pkg/ffmpeg_helper/ffmpeg_helper.go

@@ -7,9 +7,9 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/internal/common"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_parser/ass"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_parser/srt"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/language"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_parser_hub"
 	"github.com/tidwall/gjson"
 	"os"
@@ -68,9 +68,9 @@ func (f *FFMPEGHelper) GetFFMPEGInfo(videoFileFullPath string) (bool, *FFMPEGInf
 	// 判断这个视频是否已经导出过内置的字幕和音频文件了
 	if ffMPEGInfo.IsExported() == false {
 		// 说明缓存不存在,需要导出,这里需要注意,如果导出失败了,这个文件夹要清理掉
-		if pkg.IsDir(ffMPEGInfo.GetCacheFolderFPath()) == true {
+		if my_util.IsDir(ffMPEGInfo.GetCacheFolderFPath()) == true {
 			// 如果存在则,先清空一个这个文件夹
-			err = pkg.ClearFolder(ffMPEGInfo.GetCacheFolderFPath())
+			err = my_util.ClearFolder(ffMPEGInfo.GetCacheFolderFPath())
 			if err != nil {
 				bok = false
 				return bok, nil, err
@@ -144,7 +144,7 @@ func (f *FFMPEGHelper) ExportAudioArgsByTimeRange(audioFullPath string, startTim
 
 	var outAudioFullPath = filepath.Join(filepath.Dir(audioFullPath), outAudioName)
 
-	if pkg.IsFile(outAudioFullPath) == true {
+	if my_util.IsFile(outAudioFullPath) == true {
 		err := os.Remove(outAudioFullPath)
 		if err != nil {
 			return "", "", err

+ 2 - 2
internal/pkg/ffmpeg_helper/ffmpeg_helper_test.go

@@ -1,7 +1,7 @@
 package ffmpeg_helper
 
 import (
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"io/ioutil"
 	"path/filepath"
 	"testing"
@@ -34,7 +34,7 @@ func readString(filePath string) string {
 func Test_parseJsonString2GetFFMPEGInfo(t *testing.T) {
 
 	testDataPath := "../../../TestData/ffmpeg"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}

+ 5 - 5
internal/pkg/ffmpeg_helper/ffmpeg_info.go

@@ -2,7 +2,7 @@ package ffmpeg_helper
 
 import (
 	"github.com/allanpk716/ChineseSubFinder/internal/common"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_parser_hub"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/subparser"
@@ -38,20 +38,20 @@ func (f *FFMPEGInfo) IsExported() bool {
 
 	nowCacheFolder := f.GetCacheFolderFPath()
 	// 首先存储的缓存目录要存在
-	if pkg.IsDir(nowCacheFolder) == false {
+	if my_util.IsDir(nowCacheFolder) == false {
 		return false
 	}
 	// 字幕都要导出了
 	for index, subtitleInfo := range f.SubtitleInfoList {
 
 		subSrtFPath := filepath.Join(nowCacheFolder, subtitleInfo.GetName()+common.SubExtSRT)
-		if pkg.IsFile(subSrtFPath) == false {
+		if my_util.IsFile(subSrtFPath) == false {
 			return false
 		} else {
 			f.SubtitleInfoList[index].FullPath = subSrtFPath
 		}
 		subASSFPath := filepath.Join(nowCacheFolder, subtitleInfo.GetName()+common.SubExtASS)
-		if pkg.IsFile(subASSFPath) == false {
+		if my_util.IsFile(subASSFPath) == false {
 			return false
 		} else {
 			f.SubtitleInfoList[index].FullPath = subASSFPath
@@ -61,7 +61,7 @@ func (f *FFMPEGInfo) IsExported() bool {
 	// 音频是否导出了
 	for index, audioInfo := range f.AudioInfoList {
 		audioFPath := filepath.Join(nowCacheFolder, audioInfo.GetName()+extPCM)
-		if pkg.IsFile(audioFPath) == false {
+		if my_util.IsFile(audioFPath) == false {
 			return false
 		} else {
 			f.AudioInfoList[index].FullPath = audioFPath

+ 4 - 4
internal/pkg/hot_fix/hot_fix_001.go

@@ -4,7 +4,7 @@ import (
 	"errors"
 	movieHelper "github.com/allanpk716/ChineseSubFinder/internal/logic/movie_helper"
 	seriesHelper "github.com/allanpk716/ChineseSubFinder/internal/logic/series_helper"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_formatter/old"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_helper"
 	"os"
@@ -34,15 +34,15 @@ func (h HotFix001) Process() (interface{}, error) {
 	outStruct := OutStruct001{}
 	outStruct.RenamedFiles = make([]string, 0)
 	outStruct.ErrFiles = make([]string, 0)
-	if pkg.IsDir(h.movieRootDir) == false {
+	if my_util.IsDir(h.movieRootDir) == false {
 		return outStruct, errors.New("movieRootDir path not exist: " + h.movieRootDir)
 	}
-	if pkg.IsDir(h.seriesRootDir) == false {
+	if my_util.IsDir(h.seriesRootDir) == false {
 		return outStruct, errors.New("seriesRootDir path not exist: " + h.seriesRootDir)
 	}
 	// 先找出有那些电影文件夹和连续剧文件夹
 	var movieFullPathList = make([]string, 0)
-	movieFullPathList, err = pkg.SearchMatchedVideoFile(h.movieRootDir)
+	movieFullPathList, err = my_util.SearchMatchedVideoFile(h.movieRootDir)
 	if err != nil {
 		return outStruct, err
 	}

+ 3 - 4
internal/pkg/hot_fix/hot_fix_001_test.go

@@ -1,8 +1,7 @@
 package hot_fix
 
 import (
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
-	"path"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"path/filepath"
 	"testing"
 )
@@ -18,7 +17,7 @@ func TestHotFix001_Process(t *testing.T) {
 	testDataPath := "../../../TestData/hotfix/001"
 	movieDir := "movies"
 	seriesDir := "series"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -43,7 +42,7 @@ func TestHotFix001_Process(t *testing.T) {
 	// 检查修复的结果是否符合预期
 	var newSubFileNameMap = make(map[string]int)
 	for i, s := range outStruct.RenamedFiles {
-		if pkg.IsFile(s) == false {
+		if my_util.IsFile(s) == false {
 			t.Fatal("renamed file not found:", s)
 		}
 		newSubFileNameMap[filepath.Base(s)] = i

+ 2 - 3
internal/pkg/hot_fix/hot_fix_hub_test.go

@@ -3,9 +3,8 @@ package hot_fix
 import (
 	"github.com/allanpk716/ChineseSubFinder/internal/dao"
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/types"
-	"path"
 	"testing"
 )
 
@@ -19,7 +18,7 @@ func TestHotFixProcess(t *testing.T) {
 	testDataPath := "../../../TestData/hotfix/001"
 	movieDir := "movies"
 	seriesDir := "series"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}

+ 2 - 2
internal/pkg/imdb_helper/imdb.go

@@ -2,7 +2,7 @@ package imdb_helper
 
 import (
 	"github.com/StalkR/imdb"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/internal/types"
 	"strings"
@@ -14,7 +14,7 @@ func GetVideoInfoFromIMDB(imdbID string, _reqParam ...types.ReqParam) (*imdb.Tit
 	if len(_reqParam) > 0 {
 		reqParam = _reqParam[0]
 	}
-	t, err := imdb.NewTitle(pkg.NewHttpClient(reqParam).GetClient(), imdbID)
+	t, err := imdb.NewTitle(my_util.NewHttpClient(reqParam).GetClient(), imdbID)
 	if err != nil {
 		notify_center.Notify.Add("imdb model - imdb.NewTitle :", err.Error())
 		return nil, err

+ 1 - 1
internal/pkg/random.go → internal/pkg/my_util/random.go

@@ -1,4 +1,4 @@
-package pkg
+package my_util
 
 import (
 	"math/rand"

+ 1 - 1
internal/pkg/util.go → internal/pkg/my_util/util.go

@@ -1,4 +1,4 @@
-package pkg
+package my_util
 
 import (
 	"fmt"

+ 1 - 1
internal/pkg/util_test.go → internal/pkg/my_util/util_test.go

@@ -1,4 +1,4 @@
-package pkg
+package my_util
 
 import "testing"
 

+ 2 - 2
internal/pkg/pass_water_wall/pass_water_wall.go

@@ -3,7 +3,7 @@ package pass_water_wall
 import (
 	"bytes"
 	"fmt"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/rod_helper"
 	"github.com/nfnt/resize"
 	"image/jpeg"
@@ -49,7 +49,7 @@ func SimulationTest() {
 	shadowbg := iframe.MustElement("#slideBg").MustResource()
 	//取得原始圖像
 	src := iframe.MustElement("#slideBg").MustProperty("src")
-	fullbg, fileName, err := pkg.DownFile(strings.Replace(src.String(), "img_index=1", "img_index=0", 1))
+	fullbg, fileName, err := my_util.DownFile(strings.Replace(src.String(), "img_index=1", "img_index=0", 1))
 	if err != nil {
 		return
 	}

+ 2 - 2
internal/pkg/rod_helper/rodHelper.go

@@ -4,8 +4,8 @@ import (
 	"context"
 	_ "embed"
 	"errors"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/random_useragent"
 	"github.com/go-rod/rod"
 	"github.com/go-rod/rod/lib/launcher"
@@ -173,7 +173,7 @@ func releaseAdblock() (string, error) {
 	}
 	desPath := filepath.Join(adblockFolderPath, "RunAdblock")
 	// 清理之前缓存的信息
-	_ = pkg.ClearFolder(desPath)
+	_ = my_util.ClearFolder(desPath)
 	// 具体把 adblock zip 解压下载到哪里
 	outZipFileFPath := filepath.Join(adblockFolderPath, "adblock.zip")
 	adblockZipFile, err := os.Create(outZipFileFPath)

+ 24 - 6
internal/pkg/sub_formatter/sub_format_changer.go

@@ -3,19 +3,21 @@ package sub_formatter
 import (
 	"errors"
 	"fmt"
+	interCommon "github.com/allanpk716/ChineseSubFinder/internal/common"
 	"github.com/allanpk716/ChineseSubFinder/internal/dao"
 	"github.com/allanpk716/ChineseSubFinder/internal/ifaces"
 	movieHelper "github.com/allanpk716/ChineseSubFinder/internal/logic/movie_helper"
 	seriesHelper "github.com/allanpk716/ChineseSubFinder/internal/logic/series_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_formatter/common"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_formatter/emby"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_formatter/normal"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/subparser"
 	"os"
+	"path/filepath"
 	"strings"
 )
 
@@ -47,15 +49,15 @@ func (s SubFormatChanger) AutoDetectThenChangeTo(desFormatter common.FormatterNa
 	outStruct := RenameResults{}
 	outStruct.RenamedFiles = make(map[string]int)
 	outStruct.ErrFiles = make(map[string]int)
-	if pkg.IsDir(s.movieRootDir) == false {
+	if my_util.IsDir(s.movieRootDir) == false {
 		return outStruct, errors.New("movieRootDir path not exist: " + s.movieRootDir)
 	}
-	if pkg.IsDir(s.seriesRootDir) == false {
+	if my_util.IsDir(s.seriesRootDir) == false {
 		return outStruct, errors.New("seriesRootDir path not exist: " + s.seriesRootDir)
 	}
 	// 先找出有那些电影文件夹和连续剧文件夹
 	var movieFullPathList = make([]string, 0)
-	movieFullPathList, err = pkg.SearchMatchedVideoFile(s.movieRootDir)
+	movieFullPathList, err = my_util.SearchMatchedVideoFile(s.movieRootDir)
 	if err != nil {
 		return outStruct, err
 	}
@@ -65,6 +67,14 @@ func (s SubFormatChanger) AutoDetectThenChangeTo(desFormatter common.FormatterNa
 	}
 	// 搜索所有的字幕,找到相关的字幕进行修改
 	for _, one := range movieFullPathList {
+
+		// 需要判断这个视频根目录是否有 .ignore 文件,有也跳过
+		if my_util.IsFile(filepath.Join(filepath.Dir(one), interCommon.Ignore)) == true {
+			log_helper.GetLogger().Infoln("Found", interCommon.Ignore, "Skip", one)
+			// 跳过下载字幕
+			continue
+		}
+
 		found := false
 		var fitMovieNameSubList = make([]string, 0)
 		found, _, fitMovieNameSubList, err = movieHelper.MovieHasChineseSub(one)
@@ -79,6 +89,14 @@ func (s SubFormatChanger) AutoDetectThenChangeTo(desFormatter common.FormatterNa
 	// 连续剧
 	var seriesSubFiles = make([]string, 0)
 	for _, oneSeriesDir := range seriesDirList {
+
+		// 需要判断这个视频根目录是否有 .ignore 文件,有也跳过
+		if my_util.IsFile(filepath.Join(oneSeriesDir, interCommon.Ignore)) == true {
+			log_helper.GetLogger().Infoln("Found", interCommon.Ignore, "Skip", oneSeriesDir)
+			// 跳过下载字幕
+			continue
+		}
+
 		seriesSubFiles, err = sub_helper.SearchMatchedSubFileByDir(oneSeriesDir)
 		if err != nil {
 			return outStruct, err
@@ -135,11 +153,11 @@ func (s SubFormatChanger) autoDetectAndChange(outStruct *RenameResults, fitSubNa
 		// 确认改格式
 		err := os.Rename(fitSubName, newSubFileName)
 		if err != nil {
-			tmpName := pkg.FixWindowPathBackSlash(fitSubName)
+			tmpName := my_util.FixWindowPathBackSlash(fitSubName)
 			outStruct.ErrFiles[tmpName] += 1
 			continue
 		} else {
-			tmpName := pkg.FixWindowPathBackSlash(newSubFileName)
+			tmpName := my_util.FixWindowPathBackSlash(newSubFileName)
 			outStruct.RenamedFiles[tmpName] += 1
 		}
 	}

+ 3 - 4
internal/pkg/sub_formatter/sub_format_changer_test.go

@@ -3,16 +3,15 @@ package sub_formatter
 import (
 	"github.com/allanpk716/ChineseSubFinder/internal/dao"
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_formatter/common"
-	"path"
 	"testing"
 )
 
 func TestSubFormatChanger_AutoDetectThenChangeTo(t *testing.T) {
 
 	testDataPath := "../../../TestData/sub_format_changer"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -115,7 +114,7 @@ func TestSubFormatChangerProcess(t *testing.T) {
 	}
 
 	testDataPath := "../../../TestData/sub_format_changer"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}

+ 2 - 2
internal/pkg/sub_helper/dialogue_merger_test.go

@@ -3,7 +3,7 @@ package sub_helper
 import (
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_parser/ass"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_parser/srt"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_parser_hub"
 	"path/filepath"
 	"testing"
@@ -58,7 +58,7 @@ func Test_isFirstLetterIsEngLower(t *testing.T) {
 func TestNewDialogueMerger(t *testing.T) {
 
 	testDataPath := "../../../TestData/FixTimeline"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}

+ 3 - 3
internal/pkg/sub_helper/sub_helper.go

@@ -2,11 +2,11 @@ package sub_helper
 
 import (
 	"github.com/allanpk716/ChineseSubFinder/internal/common"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/archive_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/language"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_parser_hub"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/subparser"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/supplier"
@@ -25,7 +25,7 @@ func OrganizeDlSubFiles(tmpFolderName string, subInfos []supplier.SubInfo) (map[
 	// 缓存列表,整理后的字幕列表
 	// SxEx - []string 字幕的路径
 	var siteSubInfoDict = make(map[string][]string)
-	tmpFolderFullPath, err := pkg.GetTmpFolder(tmpFolderName)
+	tmpFolderFullPath, err := my_util.GetTmpFolder(tmpFolderName)
 	if err != nil {
 		return nil, err
 	}
@@ -45,7 +45,7 @@ func OrganizeDlSubFiles(tmpFolderName string, subInfos []supplier.SubInfo) (map[
 			continue
 		}
 		nowExt := strings.ToLower(subInfos[i].Ext)
-		epsKey := pkg.GetEpisodeKeyName(subInfos[i].Season, subInfos[i].Episode)
+		epsKey := my_util.GetEpisodeKeyName(subInfos[i].Season, subInfos[i].Episode)
 		_, ok := siteSubInfoDict[epsKey]
 		if ok == false {
 			// 不存在则实例化

+ 4 - 4
internal/pkg/sub_helper/sub_helper_test.go

@@ -1,7 +1,7 @@
 package sub_helper
 
 import (
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"path/filepath"
 	"testing"
 )
@@ -9,7 +9,7 @@ import (
 func TestDeleteOneSeasonSubCacheFolder(t *testing.T) {
 
 	testDataPath := "../../../TestData/sub_helper"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -17,7 +17,7 @@ func TestDeleteOneSeasonSubCacheFolder(t *testing.T) {
 	if err != nil {
 		t.Fatal(err)
 	}
-	if pkg.IsDir(filepath.Join(testRootDir, "Sub_S1E0")) == true {
+	if my_util.IsDir(filepath.Join(testRootDir, "Sub_S1E0")) == true {
 		t.Fatal("Sub_S1E0 not delete")
 	}
 }
@@ -25,7 +25,7 @@ func TestDeleteOneSeasonSubCacheFolder(t *testing.T) {
 func TestSearchMatchedSubFileByOneVideo(t *testing.T) {
 
 	testDataPath := "../../../TestData/sub_helper"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}

+ 2 - 2
internal/pkg/sub_parser_hub/subParserHub_test.go

@@ -3,7 +3,7 @@ package sub_parser_hub
 import (
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_parser/ass"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_parser/srt"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"path/filepath"
 	"testing"
 )
@@ -11,7 +11,7 @@ import (
 func TestSubParserHub_IsSubHasChinese(t *testing.T) {
 
 	testDataPath := "../../../TestData/sub_parser"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}

+ 3 - 3
internal/pkg/sub_timeline_fixer/fixer.go

@@ -2,9 +2,9 @@ package sub_timeline_fixer
 
 import (
 	"fmt"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/ffmpeg_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/vad"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/sub_timeline_fiexer"
 	"github.com/allanpk716/ChineseSubFinder/internal/types/subparser"
@@ -348,7 +348,7 @@ func (s *SubTimelineFixer) GetOffsetTimeV1(infoBase, infoSrc *subparser.FileInfo
 
 	// 输出调试的匹配时间轴信息的列表
 	if debugInfoFileSavePath != "" {
-		err = pkg.WriteStrings2File(debugInfoFileSavePath, debugInfos)
+		err = my_util.WriteStrings2File(debugInfoFileSavePath, debugInfos)
 		if err != nil {
 			return false, 0, 0, err
 		}
@@ -394,7 +394,7 @@ func (s *SubTimelineFixer) GetOffsetTimeV2(audioInfo vad.AudioInfo, infoSrc *sub
 			return false, 0, 0, err
 		}
 
-		oneStart := pkg.Time2SecendNumber(oneDialogueExTimeStart)
+		oneStart := my_util.Time2SecendNumber(oneDialogueExTimeStart)
 		//oneEnd := pkg.Time2SecendNumber(oneDialogueExTimeEnd)
 
 		if duration*FrontAndEndPer > oneStart || duration*(1.0-FrontAndEndPer) < oneStart {

+ 3 - 3
internal/pkg/sub_timeline_fixer/fixer_test.go

@@ -4,7 +4,7 @@ import (
 	"fmt"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_parser/ass"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_parser/srt"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/sub_parser_hub"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/vad"
@@ -20,7 +20,7 @@ import (
 func TestStopWordCounter(t *testing.T) {
 
 	testDataPath := "../../../TestData/FixTimeline"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -46,7 +46,7 @@ func TestStopWordCounter(t *testing.T) {
 
 func TestGetOffsetTimeV1(t *testing.T) {
 	testDataPath := "../../../TestData/FixTimeline"
-	testRootDir, err := pkg.CopyTestData(testDataPath)
+	testRootDir, err := my_util.CopyTestData(testDataPath)
 	if err != nil {
 		t.Fatal(err)
 	}

+ 5 - 5
internal/pkg/sub_timeline_fixer/sub_unit.go

@@ -2,7 +2,7 @@ package sub_timeline_fixer
 
 import (
 	"fmt"
-	"github.com/allanpk716/ChineseSubFinder/internal/pkg"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/vad"
 	"math"
 	"time"
@@ -43,7 +43,7 @@ func (s *SubUnit) AddAndInsert(oneSubStartTime, oneSubEndTime time.Time) {
 	perWindows := float64(vad.FrameDuration) / 1000
 	// 不是第一次添加,那么就需要把两句对白中间间隔的 active == false 的插入,插入间隙
 	if len(s.vadList) > 0 {
-		needAddRange := pkg.Time2SecendNumber(oneSubStartTime) - s.GetEndTimeNumber()
+		needAddRange := my_util.Time2SecendNumber(oneSubStartTime) - s.GetEndTimeNumber()
 		for i := 0.0; i < needAddRange; {
 
 			s.vadList = append(s.vadList, *vad.NewVADInfoBase(false, time.Duration((s.GetEndTimeNumber()+i)*math.Pow10(9))))
@@ -56,7 +56,7 @@ func (s *SubUnit) AddAndInsert(oneSubStartTime, oneSubEndTime time.Time) {
 	}
 	s.EndTime = oneSubEndTime
 
-	needAddRange := pkg.Time2SecendNumber(oneSubEndTime) - pkg.Time2SecendNumber(oneSubStartTime)
+	needAddRange := my_util.Time2SecendNumber(oneSubEndTime) - my_util.Time2SecendNumber(oneSubStartTime)
 	for i := 0.0; i < needAddRange; {
 
 		s.vadList = append(s.vadList, *vad.NewVADInfoBase(true, time.Duration((s.GetStartTimeNumber()+i)*math.Pow10(9))))
@@ -73,12 +73,12 @@ func (s SubUnit) GetDialogueCount() int {
 
 // GetStartTimeNumber 获取这个单元的起始时间,单位是秒
 func (s SubUnit) GetStartTimeNumber() float64 {
-	return pkg.Time2SecendNumber(s.StartTime)
+	return my_util.Time2SecendNumber(s.StartTime)
 }
 
 // GetEndTimeNumber 获取这个单元的结束时间,单位是秒
 func (s SubUnit) GetEndTimeNumber() float64 {
-	return pkg.Time2SecendNumber(s.EndTime)
+	return my_util.Time2SecendNumber(s.EndTime)
 }
 
 // GetTimelineRange 开始到结束的时间长度,单位是秒