فهرست منبع

完成搜索功能,遍历这个连续剧目录下的所有视频文件,以及这个视频文件对应的字幕文件

Signed-off-by: allan716 <[email protected]>
allan716 3 سال پیش
والد
کامیت
d21d621540
83فایلهای تغییر یافته به همراه471 افزوده شده و 440 حذف شده
  1. 3 2
      TestCode/test_imdb_tmdb.go
  2. 3 2
      cmd/GetCAPTCHA/backend/git_helper.go
  3. 3 4
      cmd/GetCAPTCHA/main.go
  4. 5 6
      cmd/chinesesubfinder/main.go
  5. 3 1
      internal/backend/controllers/base/def_settings.go
  6. 3 2
      internal/backend/controllers/base/login.go
  7. 3 2
      internal/backend/controllers/base/path_things.go
  8. 6 5
      internal/backend/controllers/v1/api.go
  9. 1 2
      internal/backend/controllers/v1/jobs_things.go
  10. 2 2
      internal/dao/info.go
  11. 2 3
      internal/dao/init.go
  12. 4 3
      pkg/archive_helper/unarchiveFile.go
  13. 4 3
      pkg/archive_helper/unarchiveFile_test.go
  14. 1 2
      pkg/cache_center/cache_center.go
  15. 4 3
      pkg/cache_center/download_file_info.go
  16. 2 3
      pkg/cache_center/task_queue_info.go
  17. 4 6
      pkg/custom_file.go
  18. 4 5
      pkg/downloader/cache_info.go
  19. 3 2
      pkg/downloader/download_processer.go
  20. 3 2
      pkg/downloader/downloader.go
  21. 6 7
      pkg/downloader/downloader_things.go
  22. 4 5
      pkg/downloader/queue_local.go
  23. 4 5
      pkg/ffmpeg_helper/ffmpeg_helper.go
  24. 11 11
      pkg/ffmpeg_helper/ffmpeg_info.go
  25. 0 41
      pkg/folder.go
  26. 7 4
      pkg/hot_fix/hot_fix_001.go
  27. 3 2
      pkg/hot_fix/hot_fix_001_test.go
  28. 2 3
      pkg/hot_fix/hot_fix_005.go
  29. 1 2
      pkg/imdb_helper/imdb.go
  30. 4 3
      pkg/logic/emby_helper/embyhelper.go
  31. 7 6
      pkg/logic/file_downloader/downloader_hub.go
  32. 2 3
      pkg/logic/forced_scan_and_down_sub/forced_scan_and_down_sub.go
  33. 2 2
      pkg/logic/forced_scan_and_down_sub/forced_scan_and_down_sub_test.go
  34. 2 3
      pkg/logic/pre_download_process/pre_download_proces.go
  35. 2 3
      pkg/logic/restore_fix_timeline_bk/restore_fix_timeline_bk.go
  36. 4 5
      pkg/logic/scan_played_video_subinfo/scan_played_video_subinfo.go
  37. 11 8
      pkg/logic/series_helper/seriesHelper.go
  38. 6 5
      pkg/logic/sub_parser/srt/srt.go
  39. 5 4
      pkg/logic/sub_supplier/a4k/a4k.go
  40. 1 2
      pkg/logic/sub_supplier/a4k/a4k_test.go
  41. 3 4
      pkg/logic/sub_supplier/assrt/assrt.go
  42. 1 3
      pkg/logic/sub_supplier/assrt/assrt_test.go
  43. 1 3
      pkg/logic/sub_supplier/csf/csf.go
  44. 1 2
      pkg/logic/sub_supplier/csf/csf_test.go
  45. 4 3
      pkg/logic/sub_supplier/shooter/shooter.go
  46. 2 3
      pkg/logic/sub_supplier/shooter/shooter_test.go
  47. 9 8
      pkg/logic/sub_supplier/subhd/subhd.go
  48. 5 6
      pkg/logic/sub_supplier/subhd/subhd_test.go
  49. 4 3
      pkg/logic/sub_supplier/xunlei/xunlei.go
  50. 1 2
      pkg/logic/sub_supplier/xunlei/xunlei_test.go
  51. 10 9
      pkg/logic/sub_supplier/zimuku/zimuku.go
  52. 8 8
      pkg/logic/sub_supplier/zimuku/zimuku_test.go
  53. 5 4
      pkg/logic/sub_timeline_fixer/SubTimelineFixerHelperEx.go
  54. 3 3
      pkg/mix_media_info/mix_media_info.go
  55. 0 10
      pkg/my_util/search_test.go
  56. 3 2
      pkg/pass_water_wall/pass_water_wall.go
  57. 1 1
      pkg/random.go
  58. 3 3
      pkg/rod_helper/multi_browser.go
  59. 3 4
      pkg/rod_helper/rod_base.go
  60. 83 24
      pkg/search/search.go
  61. 16 0
      pkg/search/search_test.go
  62. 4 5
      pkg/settings/settings.go
  63. 3 1
      pkg/settings/settings_test.go
  64. 6 5
      pkg/something_static/something_static.go
  65. 3 2
      pkg/sub_formatter/normal/normal.go
  66. 11 8
      pkg/sub_formatter/sub_format_changer.go
  67. 20 21
      pkg/sub_helper/sub_helper.go
  68. 4 4
      pkg/sub_helper/sub_helper_test.go
  69. 20 19
      pkg/sub_helper/sub_unit.go
  70. 1 2
      pkg/sub_share_center/share_sub_cache_helper.go
  71. 5 5
      pkg/sub_timeline_fixer/pipeline.go
  72. 3 2
      pkg/sub_timeline_fixer/restore.go
  73. 16 17
      pkg/subtitle_best_api/subtitle_best_api.go
  74. 2 4
      pkg/subtitle_best_api/subtitle_best_api_test.go
  75. 1 2
      pkg/task_queue/task_queue.go
  76. 6 5
      pkg/task_queue/task_queue_test.go
  77. 1 0
      pkg/types/backend/reply_series_list.go
  78. 30 30
      pkg/types/subparser/fileinfo.go
  79. 1 1
      pkg/util.go
  80. 1 1
      pkg/util_test.go
  81. 9 9
      pkg/video_list_helper/poster.go
  82. 3 2
      pkg/video_list_helper/video_list_helper.go
  83. 8 6
      pkg/video_scan_and_refresh_helper/video_scan_and_refresh_helper.go

+ 3 - 2
TestCode/test_imdb_tmdb.go

@@ -3,7 +3,8 @@ package TestCode
 import (
 	"fmt"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	tmdb "github.com/cyruzin/golang-tmdb"
 )
@@ -28,7 +29,7 @@ func imdb2tmdb() {
 		"", "",
 	)
 
-	restyClient, err := my_util.NewHttpClient(proxySettings)
+	restyClient, err := pkg.NewHttpClient(proxySettings)
 
 	tmdbClient.SetClientConfig(*restyClient.GetClient())
 

+ 3 - 2
cmd/GetCAPTCHA/backend/git_helper.go

@@ -5,10 +5,11 @@ import (
 	"os"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 
 	"github.com/allanpk716/ChineseSubFinder/cmd/GetCAPTCHA/backend/config"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/something_static"
 	"github.com/go-git/go-git/v5"
 	"github.com/go-git/go-git/v5/plumbing/object"
@@ -34,7 +35,7 @@ func GitProcess(log *logrus.Logger, config config.Config, enString string) error
 
 	var r *git.Repository
 	var w *git.Worktree
-	if my_util.IsDir(config.CloneProjectDesSaveDir) == true {
+	if pkg.IsDir(config.CloneProjectDesSaveDir) == true {
 		// 需要 pull
 		log.Infoln("Pull Start...")
 		r, err = git.PlainOpen(config.CloneProjectDesSaveDir)

+ 3 - 4
cmd/GetCAPTCHA/main.go

@@ -12,7 +12,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/cmd/GetCAPTCHA/backend"
 	"github.com/allanpk716/ChineseSubFinder/cmd/GetCAPTCHA/backend/config"
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/robfig/cron/v3"
@@ -24,7 +23,7 @@ func newLog() *logrus.Logger {
 	// --------------------------------------------------
 	// 之前是读取配置文件,现在改为,读取当前目录下,是否有一个特殊的文件,有则启动 Debug 日志级别
 	// 那么怎么写入这个文件,就靠额外的逻辑控制了
-	if my_util.IsFile(filepath.Join(pkg.ConfigRootDirFPath(), log_helper.DebugFileName)) == true {
+	if pkg.IsFile(filepath.Join(pkg.ConfigRootDirFPath(), log_helper.DebugFileName)) == true {
 		level = logrus.DebugLevel
 	} else {
 		level = logrus.InfoLevel
@@ -107,7 +106,7 @@ func Process(proxySettings *settings.ProxySettings) error {
 
 	loggerBase.Infoln("-----------------------------------------")
 
-	if my_util.ReadCustomAuthFile(loggerBase) == false {
+	if pkg.ReadCustomAuthFile(loggerBase) == false {
 		return fmt.Errorf("ReadCustomAuthFile failed")
 	}
 	AuthKey := random_auth_key.AuthKey{
@@ -135,7 +134,7 @@ func Process(proxySettings *settings.ProxySettings) error {
 	nowTT := time.Now()
 	nowTime := nowTT.Format("2006-01-02")
 	nowTimeFileNamePrix := fmt.Sprintf("%d%d%d", nowTT.Year(), nowTT.Month(), nowTT.Day())
-	httpClient, err := my_util.NewHttpClient(proxySettings)
+	httpClient, err := pkg.NewHttpClient(proxySettings)
 	if err != nil {
 		return err
 	}

+ 5 - 6
cmd/chinesesubfinder/main.go

@@ -23,7 +23,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/common"
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/sirupsen/logrus"
 )
@@ -33,7 +32,7 @@ func newLog() *logrus.Logger {
 	// --------------------------------------------------
 	// 之前是读取配置文件,现在改为,读取当前目录下,是否有一个特殊的文件,有则启动 Debug 日志级别
 	// 那么怎么写入这个文件,就靠额外的逻辑控制了
-	if my_util.IsFile(filepath.Join(pkg.ConfigRootDirFPath(), log_helper.DebugFileName)) == true {
+	if pkg.IsFile(filepath.Join(pkg.ConfigRootDirFPath(), log_helper.DebugFileName)) == true {
 		level = logrus.DebugLevel
 	} else {
 		level = logrus.InfoLevel
@@ -67,13 +66,13 @@ func init() {
 	loggerBase.Infoln("ChineseSubFinder Version:", AppVersion)
 	pkg.SetAppVersion(AppVersion)
 	pkg.SetExtEnCode(ExtEnCode)
-	if my_util.ReadCustomAuthFile(loggerBase) == false {
+	if pkg.ReadCustomAuthFile(loggerBase) == false {
 		pkg.SetBaseKey(BaseKey)
 		pkg.SetAESKey16(AESKey16)
 		pkg.SetAESIv16(AESIv16)
 	}
 	// --------------------------------------------------
-	if my_util.OSCheck() == false {
+	if pkg.OSCheck() == false {
 		loggerBase.Panicln(`You should search runtime.GOOS in the project, Implement unimplemented function`)
 	}
 	// --------------------------------------------------
@@ -104,7 +103,7 @@ func main() {
 
 		loggerBase.Infoln("SetLinuxConfigPathInSelfPath:", pkg.LinuxConfigPathInSelfPath())
 
-		if my_util.IsDir(pkg.LinuxConfigPathInSelfPath()) == false {
+		if pkg.IsDir(pkg.LinuxConfigPathInSelfPath()) == false {
 			// 如果设置了这个路径,但是不存在则会崩溃
 			loggerBase.Panicln("LinuxConfigPathInSelfPath", pkg.LinuxConfigPathInSelfPath(), "is not dir")
 		}
@@ -176,7 +175,7 @@ func main() {
 		}()
 	}
 
-	nowPort := my_util.ReadCustomPortFile(loggerBase)
+	nowPort := pkg.ReadCustomPortFile(loggerBase)
 	loggerBase.Infoln(fmt.Sprintf("WebUI will listen at 0.0.0.0:%d", nowPort))
 	// 支持在外部配置特殊的端口号,以防止本地本占用了无法使用
 	restartSignal := make(chan interface{}, 1)

+ 3 - 1
internal/backend/controllers/base/def_settings.go

@@ -3,6 +3,8 @@ package base
 import (
 	"net/http"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/gin-gonic/gin"
 )
@@ -14,5 +16,5 @@ func (cb ControllerBase) DefSettingsHandler(c *gin.Context) {
 		cb.ErrorProcess(c, "DefSettingsHandler", err)
 	}()
 
-	c.JSON(http.StatusOK, settings.NewSettings())
+	c.JSON(http.StatusOK, settings.NewSettings(pkg.ConfigRootDirFPath()))
 }

+ 3 - 2
internal/backend/controllers/base/login.go

@@ -3,10 +3,11 @@ package base
 import (
 	"net/http"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	backend2 "github.com/allanpk716/ChineseSubFinder/pkg/types/backend"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/common"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/gin-gonic/gin"
 )
@@ -37,7 +38,7 @@ func (cb ControllerBase) LoginHandler(c *gin.Context) {
 		return
 	} else {
 		// 用户账号密码匹配
-		nowAccessToken := my_util.GenerateAccessToken()
+		nowAccessToken := pkg.GenerateAccessToken()
 		common.SetAccessToken(nowAccessToken)
 		c.JSON(http.StatusOK, backend2.ReplyLogin{AccessToken: nowAccessToken,
 			Settings: *settings.GetSettings().GetNoPasswordSettings()})

+ 3 - 2
internal/backend/controllers/base/path_things.go

@@ -3,10 +3,11 @@ package base
 import (
 	"net/http"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	backend2 "github.com/allanpk716/ChineseSubFinder/pkg/types/backend"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/emby_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/gin-gonic/gin"
 )
@@ -24,7 +25,7 @@ func (cb *ControllerBase) CheckPathHandler(c *gin.Context) {
 		return
 	}
 
-	if my_util.IsDir(reqCheckPath.Path) == true {
+	if pkg.IsDir(reqCheckPath.Path) == true {
 		c.JSON(http.StatusOK, backend2.ReplyCheckPath{
 			Valid: true,
 		})

+ 6 - 5
internal/backend/controllers/v1/api.go

@@ -6,6 +6,8 @@ import (
 	"net/http"
 	"path/filepath"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	backend2 "github.com/allanpk716/ChineseSubFinder/pkg/types/backend"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 	TTaskqueue "github.com/allanpk716/ChineseSubFinder/pkg/types/task_queue"
@@ -13,7 +15,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/internal/dao"
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
 	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/gin-gonic/gin"
 )
 
@@ -34,7 +35,7 @@ func (cb *ControllerBase) AddJobHandler(c *gin.Context) {
 	if videoListAdd.IsBluray == false {
 		// 非蓝光的才需要检测这个文件存在
 		// 这里视频文件得要存在
-		if my_util.IsFile(videoListAdd.PhysicalVideoFileFullPath) == false {
+		if pkg.IsFile(videoListAdd.PhysicalVideoFileFullPath) == false {
 
 			c.JSON(http.StatusOK, backend2.ReplyJobThings{
 				Message: "physical video file not found",
@@ -131,7 +132,7 @@ func (cb *ControllerBase) AddVideoPlayedInfoHandler(c *gin.Context) {
 		return
 	}
 	// 这里视频文件得要存在
-	if my_util.IsFile(videoPlayedInfo.PhysicalVideoFileFullPath) == false {
+	if pkg.IsFile(videoPlayedInfo.PhysicalVideoFileFullPath) == false {
 
 		c.JSON(http.StatusOK, backend2.ReplyJobThings{
 			Message: "physical video file not found",
@@ -141,7 +142,7 @@ func (cb *ControllerBase) AddVideoPlayedInfoHandler(c *gin.Context) {
 	// 查询字幕是否存在
 	videoDirFPath := filepath.Dir(videoPlayedInfo.PhysicalVideoFileFullPath)
 	subFileFullPath := filepath.Join(videoDirFPath, videoPlayedInfo.SubName)
-	if my_util.IsFile(subFileFullPath) == false {
+	if pkg.IsFile(subFileFullPath) == false {
 
 		c.JSON(http.StatusOK, backend2.ReplyJobThings{
 			Message: "sub file not found",
@@ -183,7 +184,7 @@ func (cb *ControllerBase) DelVideoPlayedInfoHandler(c *gin.Context) {
 		return
 	}
 	// 这里视频文件得要存在
-	if my_util.IsFile(videoPlayedInfo.PhysicalVideoFileFullPath) == false {
+	if pkg.IsFile(videoPlayedInfo.PhysicalVideoFileFullPath) == false {
 
 		c.JSON(http.StatusOK, backend2.ReplyJobThings{
 			Message: "physical video file not found",

+ 1 - 2
internal/backend/controllers/v1/jobs_things.go

@@ -14,7 +14,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 	task_queue3 "github.com/allanpk716/ChineseSubFinder/pkg/types/task_queue"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	task_queue2 "github.com/allanpk716/ChineseSubFinder/pkg/task_queue"
 	"github.com/gin-gonic/gin"
 )
@@ -107,7 +106,7 @@ func (cb *ControllerBase) JobLogHandler(c *gin.Context) {
 
 	pathRoot := filepath.Join(pkg.ConfigRootDirFPath(), "Logs")
 	fileFPath := filepath.Join(pathRoot, common.OnceLogPrefix+reqJobLog.Id+".log")
-	if my_util.IsFile(fileFPath) == true {
+	if pkg.IsFile(fileFPath) == true {
 		// 存在
 		// 一行一行的读取文件
 		var fi *os.File

+ 2 - 2
internal/dao/info.go

@@ -2,7 +2,7 @@ package dao
 
 import (
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 )
 
@@ -19,7 +19,7 @@ func UpdateInfo(version string, settings *settings.Settings) *models.Info {
 	if len(infos) == 0 {
 		// 不存在则新增
 		saveInfo := &models.Info{
-			Id:           my_util.RandStringBytesMaskImprSrcSB(64),
+			Id:           pkg.RandStringBytesMaskImprSrcSB(64),
 			MediaServer:  mediaServerName,
 			Version:      version,
 			EnableShare:  settings.ExperimentalFunction.ShareSubSettings.ShareSubEnabled,

+ 2 - 3
internal/dao/init.go

@@ -10,7 +10,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg"
 
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"gorm.io/driver/sqlite"
 	"gorm.io/gorm"
 )
@@ -46,7 +45,7 @@ func DeleteDbFile() error {
 	// 如果是 Linux 则在 /config 目录下
 	nowDbFileName := getDbName()
 
-	if my_util.IsFile(nowDbFileName) == true {
+	if pkg.IsFile(nowDbFileName) == true {
 		return os.Remove(nowDbFileName)
 	}
 	return nil
@@ -59,7 +58,7 @@ func InitDb() error {
 	nowDbFileName := getDbName()
 
 	dbDir := filepath.Dir(nowDbFileName)
-	if my_util.IsDir(dbDir) == false {
+	if pkg.IsDir(dbDir) == false {
 		_ = os.MkdirAll(dbDir, os.ModePerm)
 	}
 	db, err = gorm.Open(sqlite.Open(nowDbFileName), &gorm.Config{})

+ 4 - 3
pkg/archive_helper/unarchiveFile.go

@@ -11,7 +11,8 @@ import (
 	"path/filepath"
 	"strings"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/bodgit/sevenzip"
 	"github.com/mholt/archiver/v3"
 	"golang.org/x/text/encoding/simplifiedchinese"
@@ -189,7 +190,7 @@ func processOneFile(f archiver.File, notUTF8 bool, desRootPath string) error {
 		//读取到最终的缓冲区中
 		chunk = append(chunk, buf[:n]...)
 	}
-	err := my_util.WriteFile(filepath.Join(desRootPath, decodeName), chunk)
+	err := pkg.WriteFile(filepath.Join(desRootPath, decodeName), chunk)
 	if err != nil {
 		return err
 	}
@@ -227,7 +228,7 @@ func un7zOneFile(file *sevenzip.File, desRootPath string) error {
 	}
 	decodeName := file.Name
 	decodeName = filepath.Base(decodeName)
-	err = my_util.WriteFile(filepath.Join(desRootPath, decodeName), data)
+	err = pkg.WriteFile(filepath.Join(desRootPath, decodeName), data)
 	if err != nil {
 		return err
 	}

+ 4 - 3
pkg/archive_helper/unarchiveFile_test.go

@@ -5,7 +5,8 @@ import (
 	"strings"
 	"testing"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/unit_test_helper"
 )
 
@@ -26,10 +27,10 @@ func testUnArchive(t *testing.T, testRootDir string, missionName string) {
 	if err != nil {
 		t.Fatal(err)
 	}
-	if my_util.IsFile(filepath.Join(desPath, subASS)) == false {
+	if pkg.IsFile(filepath.Join(desPath, subASS)) == false {
 		t.Fatal(missionName, " unArchive failed")
 	}
-	if my_util.IsFile(filepath.Join(desPath, subSRT)) == false {
+	if pkg.IsFile(filepath.Join(desPath, subSRT)) == false {
 		t.Fatal(missionName, " unArchive failed")
 	}
 }

+ 1 - 2
pkg/cache_center/cache_center.go

@@ -9,7 +9,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center/models"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/sirupsen/logrus"
 	"gorm.io/driver/sqlite"
@@ -82,7 +81,7 @@ func DelDb(cacheName string) {
 		return
 	}
 	dbFPath := filepath.Join(centerFolder, cacheName+"_"+dbFileName)
-	if my_util.IsFile(dbFPath) == true {
+	if pkg.IsFile(dbFPath) == true {
 		err = os.Remove(dbFPath)
 		if err != nil {
 			return

+ 4 - 3
pkg/cache_center/download_file_info.go

@@ -7,10 +7,11 @@ import (
 	"path/filepath"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/supplier"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center/models"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 )
 
 func (c *CacheCenter) DownloadFileAdd(subInfo *supplier.SubInfo) error {
@@ -37,7 +38,7 @@ func (c *CacheCenter) DownloadFileAdd(subInfo *supplier.SubInfo) error {
 	// 保存到本地文件
 	todayString := time.Now().Format("2006-01-02")
 	saveFPath := filepath.Join(c.downloadFileSaveRootPath, todayString, subInfo.GetUID())
-	err = my_util.WriteFile(saveFPath, b)
+	err = pkg.WriteFile(saveFPath, b)
 	if err != nil {
 		return err
 	}
@@ -69,7 +70,7 @@ func (c *CacheCenter) DownloadFileGet(fileUrlUID string) (bool, *supplier.SubInf
 	}
 
 	localFileFPath := filepath.Join(c.downloadFileSaveRootPath, dfs[0].RelPath)
-	if my_util.IsFile(localFileFPath) == false {
+	if pkg.IsFile(localFileFPath) == false {
 		return false, nil, nil
 	}
 

+ 2 - 3
pkg/cache_center/task_queue_info.go

@@ -8,7 +8,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center/models"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 )
 
 func (c *CacheCenter) TaskQueueClear() error {
@@ -29,7 +28,7 @@ func (c *CacheCenter) TaskQueueSave(taskPriority int, taskQueueBytes []byte) err
 	c.db.Where("priority = ?", taskPriority).Find(&taskQueues)
 	// 写入到本地存储
 	saveFPath := filepath.Join(c.taskQueueSaveRootPath, fmt.Sprintf("%d", taskPriority)+".tq")
-	err := my_util.WriteFile(saveFPath, taskQueueBytes)
+	err := pkg.WriteFile(saveFPath, taskQueueBytes)
 	if err != nil {
 		return err
 	}
@@ -65,7 +64,7 @@ func (c *CacheCenter) TaskQueueRead() (map[int][]byte, error) {
 	for _, taskQueue := range taskQueues {
 
 		oneTaskQueueFPath := filepath.Join(c.taskQueueSaveRootPath, taskQueue.RelPath)
-		if my_util.IsFile(oneTaskQueueFPath) == false {
+		if pkg.IsFile(oneTaskQueueFPath) == false {
 			continue
 		}
 		bytes, err := os.ReadFile(oneTaskQueueFPath)

+ 4 - 6
pkg/my_util/custom_file.go → pkg/custom_file.go

@@ -1,12 +1,10 @@
-package my_util
+package pkg
 
 import (
 	"os"
 	"strconv"
 	"strings"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg"
-
 	"github.com/sirupsen/logrus"
 )
 
@@ -50,9 +48,9 @@ func ReadCustomAuthFile(log *logrus.Logger) bool {
 			return false
 		}
 
-		pkg.SetBaseKey(authStings[0])
-		pkg.SetAESKey16(authStings[1])
-		pkg.SetAESIv16(authStings[2])
+		SetBaseKey(authStings[0])
+		SetAESKey16(authStings[1])
+		SetAESIv16(authStings[2])
 
 		log.Infoln("Use CustomAuth")
 		return true

+ 4 - 5
pkg/downloader/cache_info.go

@@ -9,7 +9,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/task_queue"
 	vsh "github.com/allanpk716/ChineseSubFinder/pkg/video_scan_and_refresh_helper"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/strcut_json"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_helper"
 )
@@ -235,14 +234,14 @@ func (d *Downloader) loadVideoListCache() error {
 	movieInfos := make([]backend2.MovieInfo, 0)
 	seasonInfos := make([]backend2.SeasonInfo, 0)
 
-	if my_util.IsFile(movieInfosFileName) == true {
+	if pkg.IsFile(movieInfosFileName) == true {
 		err = strcut_json.ToStruct(movieInfosFileName, &movieInfos)
 		if err != nil {
 			return err
 		}
 	}
 
-	if my_util.IsFile(seasonInfosFileName) == true {
+	if pkg.IsFile(seasonInfosFileName) == true {
 		err = strcut_json.ToStruct(seasonInfosFileName, &seasonInfos)
 		if err != nil {
 			return err
@@ -333,14 +332,14 @@ func (d *Downloader) GetMovieInfoAndSeasonInfoV2() ([]backend2.MovieInfoV2, []ba
 	movieInfos := make([]backend2.MovieInfoV2, 0)
 	seasonInfos := make([]backend2.SeasonInfoV2, 0)
 
-	if my_util.IsFile(movieInfosFileName) == true {
+	if pkg.IsFile(movieInfosFileName) == true {
 		err = strcut_json.ToStruct(movieInfosFileName, &movieInfos)
 		if err != nil {
 			return nil, nil, err
 		}
 	}
 
-	if my_util.IsFile(seasonInfosFileName) == true {
+	if pkg.IsFile(seasonInfosFileName) == true {
 		err = strcut_json.ToStruct(seasonInfosFileName, &seasonInfos)
 		if err != nil {
 			return nil, nil, err

+ 3 - 2
pkg/downloader/download_processer.go

@@ -5,11 +5,12 @@ import (
 	"fmt"
 	"path/filepath"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	taskQueue2 "github.com/allanpk716/ChineseSubFinder/pkg/types/task_queue"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/series_helper"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/task_queue"
 	"golang.org/x/net/context"
@@ -180,7 +181,7 @@ func (d *Downloader) seriesDlFunc(ctx context.Context, job taskQueue2.OneJob, do
 				close(panicChan)
 			}()
 			// 匹配对应的 Eps 去处理
-			seasonEpsKey := my_util.GetEpisodeKeyName(episodeInfo.Season, episodeInfo.Episode)
+			seasonEpsKey := pkg.GetEpisodeKeyName(episodeInfo.Season, episodeInfo.Episode)
 			if fullSeasonSubDict[seasonEpsKey] == nil || len(fullSeasonSubDict[seasonEpsKey]) < 1 {
 				d.log.Infoln("seriesDlFunc.saveFullSeasonSub, no sub found, Skip", seasonEpsKey)
 				done <- nil

+ 3 - 2
pkg/downloader/downloader.go

@@ -5,6 +5,8 @@ import (
 	"fmt"
 	"sync"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/sub_supplier/assrt"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/ifaces"
@@ -16,7 +18,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/sub_timeline_fixer"
 	common2 "github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	subCommon "github.com/allanpk716/ChineseSubFinder/pkg/sub_formatter/common"
 	"github.com/allanpk716/ChineseSubFinder/pkg/task_queue"
@@ -104,7 +105,7 @@ func (d *Downloader) SupplierCheck() {
 	defer func() {
 		if p := recover(); p != nil {
 			d.log.Errorln("Downloader.SupplierCheck() panic")
-			my_util.PrintPanicStack(d.log)
+			pkg.PrintPanicStack(d.log)
 		}
 		d.downloaderLock.Unlock()
 

+ 6 - 7
pkg/downloader/downloader_things.go

@@ -15,7 +15,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/change_file_encode"
 	"github.com/allanpk716/ChineseSubFinder/pkg/chs_cht_changer"
 	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	subcommon "github.com/allanpk716/ChineseSubFinder/pkg/sub_formatter/common"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_helper"
 )
@@ -131,7 +130,7 @@ func (d *Downloader) saveFullSeasonSub(seriesInfo *series.SeriesInfo, organizeSu
 	var fullSeasonSubDict = make(map[string][]string)
 
 	for _, season := range seriesInfo.SeasonDict {
-		seasonKey := my_util.GetEpisodeKeyName(season, 0)
+		seasonKey := pkg.GetEpisodeKeyName(season, 0)
 		subs, ok := organizeSubFiles[seasonKey]
 		if ok == false {
 			continue
@@ -148,7 +147,7 @@ func (d *Downloader) saveFullSeasonSub(seriesInfo *series.SeriesInfo, organizeSu
 			}
 
 			newSubFullPath := filepath.Join(newSeasonSubRootPath, subFileName)
-			err = my_util.CopyFile(sub, newSubFullPath)
+			err = pkg.CopyFile(sub, newSubFullPath)
 			if err != nil {
 				d.log.Errorln("saveFullSeasonSub.CopyFile", subFileName, err)
 				continue
@@ -159,7 +158,7 @@ func (d *Downloader) saveFullSeasonSub(seriesInfo *series.SeriesInfo, organizeSu
 				return nil
 			}
 			// 把整季的字幕缓存位置也提供出去,如果之前没有下载到的,这里返回出来的可以补上
-			seasonEpsKey := my_util.GetEpisodeKeyName(gusSeason, gusEpisode)
+			seasonEpsKey := pkg.GetEpisodeKeyName(gusSeason, gusEpisode)
 			_, ok := fullSeasonSubDict[seasonEpsKey]
 			if ok == false {
 				// 初始化
@@ -181,7 +180,7 @@ func (d *Downloader) writeSubFile2VideoPath(videoFileFullPath string, finalSubFi
 	desSubFullPath := filepath.Join(videoRootPath, subNewName)
 	if setDefault == true {
 		// 先判断没有 default 的字幕是否存在了,在的话,先删除,然后再写入
-		if my_util.IsFile(desSubFullPath) == true {
+		if pkg.IsFile(desSubFullPath) == true {
 			_ = os.Remove(desSubFullPath)
 		}
 		desSubFullPath = filepath.Join(videoRootPath, subNewNameWithDefault)
@@ -189,14 +188,14 @@ func (d *Downloader) writeSubFile2VideoPath(videoFileFullPath string, finalSubFi
 
 	if skipExistFile == true {
 		// 需要判断文件是否存在在,有则跳过
-		if my_util.IsFile(desSubFullPath) == true {
+		if pkg.IsFile(desSubFullPath) == true {
 			d.log.Infoln("OrgSubName:", finalSubFile.Name)
 			d.log.Infoln("Sub Skip DownAt:", desSubFullPath)
 			return nil
 		}
 	}
 	// 最后写入字幕
-	err := my_util.WriteFile(desSubFullPath, finalSubFile.Data)
+	err := pkg.WriteFile(desSubFullPath, finalSubFile.Data)
 	if err != nil {
 		return err
 	}

+ 4 - 5
pkg/downloader/queue_local.go

@@ -7,7 +7,6 @@ import (
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/task_queue"
 	common2 "github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 	taskQueue2 "github.com/allanpk716/ChineseSubFinder/pkg/types/task_queue"
@@ -22,7 +21,7 @@ func (d *Downloader) queueDownloaderLocal() {
 	defer func() {
 		if p := recover(); p != nil {
 			d.log.Errorln("Downloader.QueueDownloader() panic")
-			my_util.PrintPanicStack(d.log)
+			pkg.PrintPanicStack(d.log)
 		}
 		d.downloaderLock.Unlock()
 		d.log.Debugln("Download.QueueDownloader() End")
@@ -86,7 +85,7 @@ func (d *Downloader) queueDownloaderLocal() {
 	// 这个视频文件不存在了
 	{
 		isBlue, _, _ := decode.IsFakeBDMVWorked(oneJob.VideoFPath)
-		if isBlue == false && my_util.IsFile(oneJob.VideoFPath) == false {
+		if isBlue == false && pkg.IsFile(oneJob.VideoFPath) == false {
 			// 不是蓝光,那么就判断文件是否存在,不存在,那么就标记 ignore
 			bok, err = d.downloadQueue.Del(oneJob.Id)
 			if err != nil {
@@ -173,7 +172,7 @@ func (d *Downloader) queueDownloaderLocal() {
 					needMarkSkip = true
 				} else {
 					// 需要下载的 Eps 是否与 Normal 判断这个连续剧中有那些剧集需要下载的,情况符合。通过下载的时间来判断
-					epsKey := my_util.GetEpisodeKeyName(oneJob.Season, oneJob.Episode)
+					epsKey := pkg.GetEpisodeKeyName(oneJob.Season, oneJob.Episode)
 					_, found := seriesInfo.NeedDlEpsKeyList[epsKey]
 					if found == false {
 						// 需要跳过
@@ -240,7 +239,7 @@ func (d *Downloader) queueDownloaderLocal() {
 			}
 
 			if pkg.LiteMode() == false {
-				my_util.CloseChrome(d.log)
+				pkg.CloseChrome(d.log)
 			}
 		}()
 

+ 4 - 5
pkg/ffmpeg_helper/ffmpeg_helper.go

@@ -16,7 +16,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/language"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/sub_parser/ass"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/sub_parser/srt"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_parser_hub"
 	"github.com/sirupsen/logrus"
 	"github.com/tidwall/gjson"
@@ -103,7 +102,7 @@ func (f *FFMPEGHelper) GetFFMPEGInfo(videoFileFullPath string, exportType Export
 	// 判断这个视频是否已经导出过内置的字幕和音频文件了
 	if ffMPEGInfo.IsExported(exportType) == false {
 		// 说明缓存不存在,需要导出,这里需要注意,如果导出失败了,这个文件夹要清理掉
-		if my_util.IsDir(nowCacheFolderPath) == true {
+		if pkg.IsDir(nowCacheFolderPath) == true {
 			// 如果存在则,先清空一个这个文件夹
 			err = pkg.ClearFolder(nowCacheFolderPath)
 			if err != nil {
@@ -209,7 +208,7 @@ func (f *FFMPEGHelper) ExportAudioAndSubArgsByTimeRange(audioFullPath, subFullPa
 	var outSubFullPath = filepath.Join(filepath.Dir(audioFullPath), outSubName)
 
 	// 导出音频
-	if my_util.IsFile(outAudioFullPath) == true {
+	if pkg.IsFile(outAudioFullPath) == true {
 		err := os.Remove(outAudioFullPath)
 		if err != nil {
 			return "", "", "", err
@@ -221,7 +220,7 @@ func (f *FFMPEGHelper) ExportAudioAndSubArgsByTimeRange(audioFullPath, subFullPa
 		return "", "", execFFMPEG, err
 	}
 	// 导出字幕
-	if my_util.IsFile(outSubFullPath) == true {
+	if pkg.IsFile(outSubFullPath) == true {
 		err := os.Remove(outSubFullPath)
 		if err != nil {
 			return "", "", "", err
@@ -251,7 +250,7 @@ func (f *FFMPEGHelper) ExportSubArgsByTimeRange(subFullPath, outName string, sta
 	var outSubFullPath = filepath.Join(filepath.Dir(subFullPath), outSubName)
 
 	// 导出字幕
-	if my_util.IsFile(outSubFullPath) == true {
+	if pkg.IsFile(outSubFullPath) == true {
 		err := os.Remove(outSubFullPath)
 		if err != nil {
 			return "", "", err

+ 11 - 11
pkg/ffmpeg_helper/ffmpeg_info.go

@@ -1,14 +1,14 @@
 package ffmpeg_helper
 
 import (
-	"github.com/allanpk716/ChineseSubFinder/pkg"
-	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
-	"github.com/allanpk716/ChineseSubFinder/pkg/types/subparser"
 	"os"
 	"path/filepath"
 	"strings"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
+	"github.com/allanpk716/ChineseSubFinder/pkg/types/subparser"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_parser_hub"
 	"github.com/sirupsen/logrus"
@@ -55,18 +55,18 @@ func (f *FFMPEGInfo) IsExported(exportType ExportType) bool {
 		// 函数执行完毕,再进行 check,是否需要删除 exportedMakeFileName 这个文件
 		if bProcessDone == false {
 			// 失败就需要删除这个 exportedMakeFileName 文件
-			if my_util.IsFile(tmpNowExportedMaskFile) == true {
+			if pkg.IsFile(tmpNowExportedMaskFile) == true {
 				_ = os.Remove(tmpNowExportedMaskFile)
 			}
 		}
 	}()
 
 	// 首先存储的缓存目录要存在
-	if my_util.IsDir(nowCacheFolder) == false {
+	if pkg.IsDir(nowCacheFolder) == false {
 		return bProcessDone
 	}
 
-	if my_util.IsFile(tmpNowExportedMaskFile) == false {
+	if pkg.IsFile(tmpNowExportedMaskFile) == false {
 		return bProcessDone
 	}
 
@@ -109,7 +109,7 @@ func (f FFMPEGInfo) CreateExportedMask() error {
 	if err != nil {
 		return err
 	}
-	if my_util.IsFile(maskFileFPath) == false {
+	if pkg.IsFile(maskFileFPath) == false {
 		create, err := os.Create(maskFileFPath)
 		if err != nil {
 			return err
@@ -138,7 +138,7 @@ func (f *FFMPEGInfo) isAudioExported(nowCacheFolder string) bool {
 	for index, audioInfo := range f.AudioInfoList {
 
 		audioFPath := filepath.Join(nowCacheFolder, audioInfo.GetName()+extPCM)
-		if my_util.IsFile(audioFPath) == true {
+		if pkg.IsFile(audioFPath) == true {
 
 			f.AudioInfoList[index].FullPath = audioFPath
 
@@ -166,13 +166,13 @@ func (f *FFMPEGInfo) isSubExported(nowCacheFolder string) bool {
 	for index, subtitleInfo := range f.SubtitleInfoList {
 
 		subSrtFPath := filepath.Join(nowCacheFolder, subtitleInfo.GetName()+common.SubExtSRT)
-		if my_util.IsFile(subSrtFPath) == false {
+		if pkg.IsFile(subSrtFPath) == false {
 			return false
 		} else {
 			f.SubtitleInfoList[index].FullPath = subSrtFPath
 		}
 		subASSFPath := filepath.Join(nowCacheFolder, subtitleInfo.GetName()+common.SubExtASS)
-		if my_util.IsFile(subASSFPath) == false {
+		if pkg.IsFile(subASSFPath) == false {
 			return false
 		} else {
 			f.SubtitleInfoList[index].FullPath = subASSFPath

+ 0 - 41
pkg/folder.go

@@ -2,7 +2,6 @@ package pkg
 
 import (
 	"fmt"
-	"io"
 	"os"
 	"path/filepath"
 	"runtime"
@@ -484,46 +483,6 @@ func ClearIdleSubFixCacheFolder(l *logrus.Logger, rootSubFixCacheFolder string,
 	return nil
 }
 
-// CopyFile copies a single file from src to dst
-func CopyFile(src, dst string) error {
-	var err error
-	var srcFd *os.File
-	var dstFd *os.File
-	var srcInfo os.FileInfo
-
-	if srcFd, err = os.Open(src); err != nil {
-		return err
-	}
-	defer func() {
-		_ = srcFd.Close()
-	}()
-
-	if dstFd, err = os.Create(dst); err != nil {
-		return err
-	}
-	defer func() {
-		_ = dstFd.Close()
-	}()
-
-	if _, err = io.Copy(dstFd, srcFd); err != nil {
-		return err
-	}
-	if srcInfo, err = os.Stat(src); err != nil {
-		return err
-	}
-	return os.Chmod(dst, srcInfo.Mode())
-}
-
-func Time2SecondNumber(inTime time.Time) float64 {
-	outSecond := 0.0
-	outSecond += float64(inTime.Hour() * 60 * 60)
-	outSecond += float64(inTime.Minute() * 60)
-	outSecond += float64(inTime.Second())
-	outSecond += float64(inTime.Nanosecond()) / 1000 / 1000 / 1000
-
-	return outSecond
-}
-
 // 缓存文件的位置信息,都是在程序的根目录下的 cache 中
 const (
 	cacheRootFolderName = "cache"             // 缓存文件夹总名称

+ 7 - 4
pkg/hot_fix/hot_fix_001.go

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

+ 3 - 2
pkg/hot_fix/hot_fix_001_test.go

@@ -4,8 +4,9 @@ import (
 	"path/filepath"
 	"testing"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/unit_test_helper"
 )
 
@@ -42,7 +43,7 @@ func TestHotFix001_Process(t *testing.T) {
 	// 检查修复的结果是否符合预期
 	var newSubFileNameMap = make(map[string]int)
 	for i, s := range outStruct.RenamedFiles {
-		if my_util.IsFile(s) == false {
+		if pkg.IsFile(s) == false {
 			t.Fatal("renamed file not found:", s)
 		}
 		newSubFileNameMap[filepath.Base(s)] = i

+ 2 - 3
pkg/hot_fix/hot_fix_005.go

@@ -10,7 +10,6 @@ import (
 
 	"github.com/allanpk716/ChineseSubFinder/internal/dao"
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/sirupsen/logrus"
 )
 
@@ -64,7 +63,7 @@ func (h HotFix005) process() (bool, error) {
 	}
 	for _, info := range videoInfos {
 		delFileFPath := filepath.Join(shareRootDir, info.StoreRPath)
-		if my_util.IsFile(delFileFPath) == true {
+		if pkg.IsFile(delFileFPath) == true {
 			err = os.Remove(delFileFPath)
 			if err != nil {
 				h.log.Errorln("Remove file:", delFileFPath, " error:", err.Error())
@@ -87,7 +86,7 @@ func (h HotFix005) process() (bool, error) {
 	}
 	for _, info := range lowTrustVideoInfos {
 		delFileFPath := filepath.Join(shareRootDir, info.StoreRPath)
-		if my_util.IsFile(delFileFPath) == true {
+		if pkg.IsFile(delFileFPath) == true {
 			err = os.Remove(delFileFPath)
 			if err != nil {
 				h.log.Errorln("Remove file:", delFileFPath, " error:", err.Error())

+ 1 - 2
pkg/imdb_helper/imdb.go

@@ -17,7 +17,6 @@ import (
 	"github.com/StalkR/imdb"
 	"github.com/allanpk716/ChineseSubFinder/internal/dao"
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types"
@@ -216,7 +215,7 @@ func IsChineseVideo(log *logrus.Logger, imdbInfo types.VideoNfoInfo, _proxySetti
 // getVideoInfoFromIMDBWeb 从 IMDB 网站 ID 查询影片的信息
 func getVideoInfoFromIMDBWeb(videoNfoInfo types.VideoNfoInfo, _proxySettings ...*settings.ProxySettings) (*imdb.Title, error) {
 
-	client, err := my_util.NewHttpClient(_proxySettings...)
+	client, err := pkg.NewHttpClient(_proxySettings...)
 	if err != nil {
 		return nil, err
 	}

+ 4 - 3
pkg/logic/emby_helper/embyhelper.go

@@ -8,6 +8,8 @@ import (
 	"sync"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/types"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 	emby2 "github.com/allanpk716/ChineseSubFinder/pkg/types/emby"
@@ -15,7 +17,6 @@ import (
 
 	embyHelper "github.com/allanpk716/ChineseSubFinder/pkg/emby_api"
 	"github.com/allanpk716/ChineseSubFinder/pkg/imdb_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/path_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sort_things"
@@ -1043,7 +1044,7 @@ func (em *EmbyHelper) CheckPath(pathType string) ([]string, error) {
 
 		for _, info := range filterMovieList {
 
-			if my_util.IsFile(info.PhysicalVideoFileFullPath) == true {
+			if pkg.IsFile(info.PhysicalVideoFileFullPath) == true {
 				outList = append(outList, info.PhysicalVideoFileFullPath)
 				outCount++
 				if outCount > 5 {
@@ -1060,7 +1061,7 @@ func (em *EmbyHelper) CheckPath(pathType string) ([]string, error) {
 
 		for _, info := range filterSeriesList {
 
-			if my_util.IsFile(info.PhysicalVideoFileFullPath) == true {
+			if pkg.IsFile(info.PhysicalVideoFileFullPath) == true {
 				outList = append(outList, info.PhysicalVideoFileFullPath)
 				outCount++
 				if outCount > 5 {

+ 7 - 6
pkg/logic/file_downloader/downloader_hub.go

@@ -5,6 +5,8 @@ import (
 	"fmt"
 	"path/filepath"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/language"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/supplier"
 
@@ -15,7 +17,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/random_auth_key"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/subtitle_best_api"
 	"github.com/go-rod/rod"
@@ -64,13 +65,13 @@ func (f *FileDownloader) Get(supplierName string, topN int64, videoFileName stri
 	}
 	// 如果不存在那么就先下载,然后再存入缓存中
 	if found == false {
-		fileData, downloadFileName, err := my_util.DownFile(f.Log, fileDownloadUrl, f.Settings.AdvancedSettings.ProxySettings)
+		fileData, downloadFileName, err := pkg.DownFile(f.Log, fileDownloadUrl, f.Settings.AdvancedSettings.ProxySettings)
 		if err != nil {
 			return nil, err
 		}
 		// 下载成功需要统计到今天的次数中
 		_, err = f.CacheCenter.DailyDownloadCountAdd(supplierName,
-			my_util.GetPublicIP(f.Log, f.Settings.AdvancedSettings.TaskQueue, f.Settings.AdvancedSettings.ProxySettings))
+			pkg.GetPublicIP(f.Log, f.Settings.AdvancedSettings.TaskQueue, f.Settings.AdvancedSettings.ProxySettings))
 		if err != nil {
 			f.Log.Warningln(supplierName, "FileDownloader.Get.DailyDownloadCountAdd", err)
 		}
@@ -114,13 +115,13 @@ func (f *FileDownloader) GetA4k(supplierName string, topN int64, season, eps int
 	}
 	// 如果不存在那么就先下载,然后再存入缓存中
 	if found == false {
-		fileData, downloadFileName, err := my_util.DownFile(f.Log, fileDownloadUrl, f.Settings.AdvancedSettings.ProxySettings)
+		fileData, downloadFileName, err := pkg.DownFile(f.Log, fileDownloadUrl, f.Settings.AdvancedSettings.ProxySettings)
 		if err != nil {
 			return nil, err
 		}
 		// 下载成功需要统计到今天的次数中
 		_, err = f.CacheCenter.DailyDownloadCountAdd(supplierName,
-			my_util.GetPublicIP(f.Log, f.Settings.AdvancedSettings.TaskQueue, f.Settings.AdvancedSettings.ProxySettings))
+			pkg.GetPublicIP(f.Log, f.Settings.AdvancedSettings.TaskQueue, f.Settings.AdvancedSettings.ProxySettings))
 		if err != nil {
 			f.Log.Warningln(supplierName, "FileDownloader.Get.DailyDownloadCountAdd", err)
 		}
@@ -167,7 +168,7 @@ func (f *FileDownloader) GetEx(supplierName string, browser *rod.Browser, subDow
 		}
 		// 下载成功需要统计到今天的次数中
 		_, err = f.CacheCenter.DailyDownloadCountAdd(supplierName,
-			my_util.GetPublicIP(f.Log, f.Settings.AdvancedSettings.TaskQueue, f.Settings.AdvancedSettings.ProxySettings))
+			pkg.GetPublicIP(f.Log, f.Settings.AdvancedSettings.TaskQueue, f.Settings.AdvancedSettings.ProxySettings))
 		if err != nil {
 			f.Log.Warningln(supplierName, "FileDownloader.GetEx.DailyDownloadCountAdd", err)
 		}

+ 2 - 3
pkg/logic/forced_scan_and_down_sub/forced_scan_and_down_sub.go

@@ -3,11 +3,10 @@ package forced_scan_and_down_sub
 import (
 	"errors"
 	"fmt"
-	"github.com/allanpk716/ChineseSubFinder/pkg"
 	"os"
 	"path/filepath"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
 )
 
 // CheckSpeFile 目标是检测特定的文件,找到后,先删除,返回一个标志位用于后面的逻辑
@@ -18,7 +17,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 my_util.IsFile(nowSpeFileName) == false {
+	if pkg.IsFile(nowSpeFileName) == false {
 		return false, nil
 	}
 	// 先删除这个文件,然后再标记执行该逻辑

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

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

+ 2 - 3
pkg/logic/pre_download_process/pre_download_proces.go

@@ -17,7 +17,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/sub_supplier/shooter"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/sub_supplier/xunlei"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/something_static"
@@ -192,14 +191,14 @@ func (p *PreDownloadProcess) Check() *PreDownloadProcess {
 		p.log.Warningln("SeriesPaths not set, len == 0")
 	}
 	for i, path := range p.settings.CommonSettings.MoviePaths {
-		if my_util.IsDir(path) == false {
+		if pkg.IsDir(path) == false {
 			p.log.Errorln("MovieFolder not found Index", i, "--", path)
 		} else {
 			p.log.Infoln("MovieFolder Index", i, "--", path)
 		}
 	}
 	for i, path := range p.settings.CommonSettings.SeriesPaths {
-		if my_util.IsDir(path) == false {
+		if pkg.IsDir(path) == false {
 			p.log.Errorln("SeriesPaths not found Index", i, "--", path)
 		} else {
 			p.log.Infoln("SeriesPaths Index", i, "--", path)

+ 2 - 3
pkg/logic/restore_fix_timeline_bk/restore_fix_timeline_bk.go

@@ -1,11 +1,10 @@
 package restore_fix_timeline_bk
 
 import (
-	"github.com/allanpk716/ChineseSubFinder/pkg"
 	"os"
 	"path/filepath"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
 )
 
 // CheckSpeFile 目标是检测特定的文件,找到后,先删除,返回一个标志位用于后面的逻辑
@@ -13,7 +12,7 @@ func CheckSpeFile() (bool, error) {
 
 	nowSpeFileName := getSpeFileName()
 
-	if my_util.IsFile(nowSpeFileName) == false {
+	if pkg.IsFile(nowSpeFileName) == false {
 		return false, nil
 	}
 	// 先删除这个文件,然后再标记执行该逻辑

+ 4 - 5
pkg/logic/scan_played_video_subinfo/scan_played_video_subinfo.go

@@ -23,7 +23,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/pkg/imdb_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/language"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_file_hash"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_formatter/emby"
@@ -152,7 +151,7 @@ func (s *ScanPlayedVideoSubInfo) Clear() {
 
 			// 转换到绝对路径
 			cacheSubFPath := filepath.Join(s.shareRootDir, oneSubInfo.StoreRPath)
-			if my_util.IsFile(cacheSubFPath) == false {
+			if pkg.IsFile(cacheSubFPath) == false {
 				// 如果文件不存在,那么就删除之前的关联
 				// 关联删除了,但是不会删除这些对象,所以后续还需要再次删除
 				s.delSubInfo(&info, &oneSubInfo)
@@ -351,7 +350,7 @@ func (s *ScanPlayedVideoSubInfo) dealOneVideo(index int, videoFPath, orgSubFPath
 
 	s.log.Infoln(index, orgSubFPath)
 
-	if my_util.IsFile(orgSubFPath) == false {
+	if pkg.IsFile(orgSubFPath) == false {
 
 		s.log.Errorln("Skip", orgSubFPath, "not exist")
 		return
@@ -413,7 +412,7 @@ func (s *ScanPlayedVideoSubInfo) dealOneVideo(index int, videoFPath, orgSubFPath
 	s.log.Debugln("3-2")
 
 	// 当前扫描到的找个字幕的 sha256 是否已经存在与缓存中了
-	tmpSHA256String, err := my_util.GetFileSHA256String(orgSubFPath)
+	tmpSHA256String, err := pkg.GetFileSHA256String(orgSubFPath)
 	if err != nil {
 		s.log.Warningln("ScanPlayedVideoSubInfo.Scan", videoTypes, "orgSubFPath.GetFileSHA256String", videoFPath, err)
 		return
@@ -467,7 +466,7 @@ func (s *ScanPlayedVideoSubInfo) dealOneVideo(index int, videoFPath, orgSubFPath
 	s.log.Debugln(8)
 
 	// 计算需要插入字幕的 sha256
-	saveSHA256String, err := my_util.GetFileSHA256String(subCacheFPath)
+	saveSHA256String, err := pkg.GetFileSHA256String(subCacheFPath)
 	if err != nil {
 		s.log.Warningln("ScanPlayedVideoSubInfo.Scan", videoTypes, "GetFileSHA256String", videoFPath, err)
 		return

+ 11 - 8
pkg/logic/series_helper/seriesHelper.go

@@ -5,6 +5,10 @@ import (
 	"strconv"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg/search"
+
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/ifaces"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/emby"
@@ -17,7 +21,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
 	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/pkg/imdb_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_parser_hub"
@@ -44,7 +47,7 @@ func readSeriesInfo(log *logrus.Logger, seriesDir string, need2AnalyzeSub bool,
 
 	subParserHub := sub_parser_hub.NewSubParserHub(log, ass.NewParser(log), srt.NewParser(log))
 	// 先搜索这个目录下,所有符合条件的视频
-	matchedVideoFile, err := my_util.SearchMatchedVideoFile(log, seriesDir)
+	matchedVideoFile, err := search.MatchedVideoFile(log, seriesDir)
 	if err != nil {
 		return nil, nil, err
 	}
@@ -76,7 +79,7 @@ func readSeriesInfo(log *logrus.Logger, seriesDir string, need2AnalyzeSub bool,
 			if subParserHub.IsSubHasChinese(subParserFileInfo) == false {
 				continue
 			}
-			epsKey := my_util.GetEpisodeKeyName(epsVideoNfoInfo.Season, epsVideoNfoInfo.Episode)
+			epsKey := pkg.GetEpisodeKeyName(epsVideoNfoInfo.Season, epsVideoNfoInfo.Episode)
 			oneFileSubInfo := series.SubInfo{
 				Title:        epsVideoNfoInfo.Title,
 				Season:       epsVideoNfoInfo.Season,
@@ -111,7 +114,7 @@ func ReadSeriesInfoFromDir(log *logrus.Logger,
 		return nil, err
 	}
 	// 搜索所有的视频
-	videoFiles, err := my_util.SearchMatchedVideoFile(log, seriesDir)
+	videoFiles, err := search.MatchedVideoFile(log, seriesDir)
 	if err != nil {
 		return nil, err
 	}
@@ -261,7 +264,7 @@ func GetSeriesListFromDirs(log *logrus.Logger, dirs []string) (*treemap.Map, err
 func GetSeriesList(log *logrus.Logger, dir string) ([]string, error) {
 
 	// 需要把所有 tvshow.nfo 搜索出来,那么这些文件对应的目录就是目标连续剧的目录
-	tvNFOs, err := my_util.SearchTVNfo(log, dir)
+	tvNFOs, err := search.TVNfo(log, dir)
 	if err != nil {
 		return nil, err
 	}
@@ -283,7 +286,7 @@ func whichSeasonEpsNeedDownloadSub(log *logrus.Logger, seriesInfo *series.Series
 	if forcedScanAndDownloadSub == true {
 		for _, epsInfo := range seriesInfo.EpList {
 			// 添加
-			epsKey := my_util.GetEpisodeKeyName(epsInfo.Season, epsInfo.Episode)
+			epsKey := pkg.GetEpisodeKeyName(epsInfo.Season, epsInfo.Episode)
 			needDlSubEpsList[epsKey] = epsInfo
 			needDlSeasonList[epsInfo.Season] = epsInfo.Season
 		}
@@ -309,7 +312,7 @@ func whichSeasonEpsNeedDownloadSub(log *logrus.Logger, seriesInfo *series.Series
 
 		if len(epsInfo.SubAlreadyDownloadedList) < 1 || baseTime.AddDate(0, 0, ExpirationTime).After(currentTime) == true {
 			// 添加
-			epsKey := my_util.GetEpisodeKeyName(epsInfo.Season, epsInfo.Episode)
+			epsKey := pkg.GetEpisodeKeyName(epsInfo.Season, epsInfo.Episode)
 			needDlSubEpsList[epsKey] = epsInfo
 			needDlSeasonList[epsInfo.Season] = epsInfo.Season
 		} else {
@@ -404,7 +407,7 @@ func getEpsInfoAndSubDic(log *logrus.Logger,
 		}
 	}
 
-	epsKey := my_util.GetEpisodeKeyName(episodeInfo.Season, episodeInfo.Episode)
+	epsKey := pkg.GetEpisodeKeyName(episodeInfo.Season, episodeInfo.Episode)
 	_, ok := EpisodeDict[epsKey]
 	if ok == false {
 		// 初始化

+ 6 - 5
pkg/logic/sub_parser/srt/srt.go

@@ -6,10 +6,11 @@ import (
 	"strconv"
 	"strings"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/subparser"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/language"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/regex_things"
 	"github.com/sirupsen/logrus"
 )
@@ -71,7 +72,7 @@ func (p Parser) DetermineFileTypeFromBytes(inBytes []byte, nowExt string) (bool,
 	countLineFeed := 0
 	for _, oneDialogue := range orgDialogues {
 
-		if len(oneDialogue.Lines) == 0 || my_util.ReplaceSpecString(oneDialogue.Lines[0], "") == "" {
+		if len(oneDialogue.Lines) == 0 || pkg.ReplaceSpecString(oneDialogue.Lines[0], "") == "" {
 			continue
 		}
 		ol := oneDialogue
@@ -82,7 +83,7 @@ func (p Parser) DetermineFileTypeFromBytes(inBytes []byte, nowExt string) (bool,
 			fixedLine = regex_things.ReMatchBrace.ReplaceAllString(line, "")
 			fixedLine = regex_things.ReMatchBracket.ReplaceAllString(fixedLine, "")
 			fixedLine = strings.ReplaceAll(fixedLine, `\N`, "")
-			if my_util.ReplaceSpecString(fixedLine, "") == "" {
+			if pkg.ReplaceSpecString(fixedLine, "") == "" {
 				ol.Lines[i] = ""
 				break
 			} else {
@@ -136,7 +137,7 @@ func (p Parser) parseContent(inBytes []byte) []subparser.OneDialogue {
 	filterLines := make([]string, 0)
 	for _, line := range lines {
 		// 如果当前的这一句话,为空,或者进过正则表达式剔除特殊字符后为空,则跳过
-		if my_util.ReplaceSpecString(line, "") == "" {
+		if pkg.ReplaceSpecString(line, "") == "" {
 			continue
 		}
 		filterLines = append(filterLines, line)
@@ -166,7 +167,7 @@ func (p Parser) parseContent(inBytes []byte) []subparser.OneDialogue {
 
 		if steps == 0 {
 			// 匹配对白的索引
-			line = my_util.ReplaceSpecString(line, "")
+			line = pkg.ReplaceSpecString(line, "")
 			dialogueIndex, err := strconv.Atoi(line)
 			if err != nil {
 				newOneDialogueFun()

+ 5 - 4
pkg/logic/sub_supplier/a4k/a4k.go

@@ -8,6 +8,8 @@ import (
 	"strings"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	common2 "github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/series"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/supplier"
@@ -22,7 +24,6 @@ import (
 
 	"github.com/PuerkitoBio/goquery"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/sirupsen/logrus"
 )
@@ -55,7 +56,7 @@ func (s *Supplier) CheckAlive(proxySettings ...*settings.ProxySettings) (bool, i
 
 	// 计算当前时间
 	startT := time.Now()
-	httpClient, err := my_util.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
+	httpClient, err := pkg.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
 	if err != nil {
 		s.log.Errorln(s.GetSupplierName(), "CheckAlive.NewHttpClient", err)
 		return false, 0
@@ -286,7 +287,7 @@ func (s *Supplier) listPageItems(keyword string, pageIndex int, isMovie bool) (s
 		time.Sleep(time.Second * 10)
 	}()
 	searchResultItems = make([]SearchResultItem, 0)
-	httpClient, err := my_util.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
+	httpClient, err := pkg.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
 	if err != nil {
 		err = errors.New("NewHttpClient error:" + err.Error())
 		return
@@ -389,7 +390,7 @@ func (s *Supplier) downloadSub(videoFileName, downloadPageUrl string, season, ep
 	}()
 
 	var httpClient *resty.Client
-	httpClient, err = my_util.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
+	httpClient, err = pkg.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
 	if err != nil {
 		err = errors.New("NewHttpClient error:" + err.Error())
 		return

+ 1 - 2
pkg/logic/sub_supplier/a4k/a4k_test.go

@@ -13,7 +13,6 @@ import (
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/random_auth_key"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
@@ -86,7 +85,7 @@ var a4kInstance *Supplier
 
 func defInstance() {
 
-	my_util.ReadCustomAuthFile(log_helper.GetLogger4Tester())
+	pkg.ReadCustomAuthFile(log_helper.GetLogger4Tester())
 
 	authKey := random_auth_key.AuthKey{
 		BaseKey:  pkg.BaseKey(),

+ 3 - 4
pkg/logic/sub_supplier/assrt/assrt.go

@@ -22,7 +22,6 @@ import (
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/mix_media_info"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/sirupsen/logrus"
@@ -288,7 +287,7 @@ func (s *Supplier) getSubByKeyWord(keyword string) (*SearchSubResult, error) {
 
 	s.log.Infoln("Search KeyWord:", keyword)
 	tt := url.QueryEscape(keyword)
-	httpClient, err := my_util.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
+	httpClient, err := pkg.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
 	if err != nil {
 		return nil, err
 	}
@@ -341,7 +340,7 @@ func (s *Supplier) getSubDetail(subID int) (OneSubDetail, error) {
 
 	var subDetail OneSubDetail
 
-	httpClient, err := my_util.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
+	httpClient, err := pkg.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
 	if err != nil {
 		return subDetail, err
 	}
@@ -380,7 +379,7 @@ func (s *Supplier) getUserInfo() (UserInfo, error) {
 
 	var userInfo UserInfo
 
-	httpClient, err := my_util.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
+	httpClient, err := pkg.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
 	if err != nil {
 		return userInfo, err
 	}

+ 1 - 3
pkg/logic/sub_supplier/assrt/assrt_test.go

@@ -7,8 +7,6 @@ import (
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/file_downloader"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
-
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/random_auth_key"
@@ -19,7 +17,7 @@ var assrtInstance *Supplier
 
 func defInstance() {
 
-	my_util.ReadCustomAuthFile(log_helper.GetLogger4Tester())
+	pkg.ReadCustomAuthFile(log_helper.GetLogger4Tester())
 
 	authKey := random_auth_key.AuthKey{
 		BaseKey:  pkg.BaseKey(),

+ 1 - 3
pkg/logic/sub_supplier/csf/csf.go

@@ -21,8 +21,6 @@ import (
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/subtitle_best_api"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
-
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_file_hash"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/mix_media_info"
@@ -172,7 +170,7 @@ func (s *Supplier) findAndDownload(videoFPath string, isMovie bool, Season, Epis
 	}
 
 	// 标记本次请求的归属性
-	randomAuthToken := my_util.RandStringBytesMaskImprSrcSB(10)
+	randomAuthToken := pkg.RandStringBytesMaskImprSrcSB(10)
 	var bestOneSub subtitle_best_api.Subtitle
 	var queueIsFull bool
 	var waitTime int64

+ 1 - 2
pkg/logic/sub_supplier/csf/csf_test.go

@@ -9,7 +9,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/file_downloader"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/series_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/random_auth_key"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 )
@@ -68,7 +67,7 @@ var csfInstance *Supplier
 
 func defInstance() {
 
-	my_util.ReadCustomAuthFile(log_helper.GetLogger4Tester())
+	pkg.ReadCustomAuthFile(log_helper.GetLogger4Tester())
 
 	authKey := random_auth_key.AuthKey{
 		BaseKey:  pkg.BaseKey(),

+ 4 - 3
pkg/logic/sub_supplier/shooter/shooter.go

@@ -9,13 +9,14 @@ import (
 	"path/filepath"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/series"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/supplier"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/file_downloader"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/sirupsen/logrus"
@@ -109,7 +110,7 @@ func (s *Supplier) getSubListFromFile(filePath string) ([]supplier.SubInfo, erro
 	var outSubInfoList []supplier.SubInfo
 	var jsonList []SublistShooter
 
-	if my_util.IsFile(filePath) == false {
+	if pkg.IsFile(filePath) == false {
 		// 这里传入的可能是蓝光结构的伪造存在的视频文件,需要检查一次这个文件是否存在
 		bok, _, _ := decode.IsFakeBDMVWorked(filePath)
 		if bok == false {
@@ -164,7 +165,7 @@ func (s *Supplier) getSubInfos(fileHash, fileName, qLan string) ([]SublistShoote
 
 	var jsonList []SublistShooter
 
-	httpClient, err := my_util.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
+	httpClient, err := pkg.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
 	if err != nil {
 		return nil, err
 	}

+ 2 - 3
pkg/logic/sub_supplier/shooter/shooter_test.go

@@ -9,7 +9,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/file_downloader"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/random_auth_key"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/unit_test_helper"
@@ -17,7 +16,7 @@ import (
 
 func TestNewSupplier(t *testing.T) {
 
-	my_util.ReadCustomAuthFile(log_helper.GetLogger4Tester())
+	pkg.ReadCustomAuthFile(log_helper.GetLogger4Tester())
 	authKey := random_auth_key.AuthKey{
 		BaseKey:  pkg.BaseKey(),
 		AESKey16: pkg.AESKey16(),
@@ -41,7 +40,7 @@ func TestNewSupplier(t *testing.T) {
 	if err != nil {
 		t.Fatal(err)
 	}
-	shooter := NewSupplier(file_downloader.NewFileDownloader(cache_center.NewCacheCenter("test", settings.NewSettings(), log_helper.GetLogger4Tester()), authKey))
+	shooter := NewSupplier(file_downloader.NewFileDownloader(cache_center.NewCacheCenter("test", settings.NewSettings(pkg.ConfigRootDirFPath()), log_helper.GetLogger4Tester()), authKey))
 	outList, err := shooter.getSubListFromFile(gVideoFPath)
 	if err != nil {
 		t.Error(err)

+ 9 - 8
pkg/logic/sub_supplier/subhd/subhd.go

@@ -13,6 +13,8 @@ import (
 	"strings"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg/search"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
@@ -28,7 +30,6 @@ import (
 	"github.com/PuerkitoBio/goquery"
 	"github.com/Tnze/go.num/v2/zh"
 	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_parser_hub"
@@ -106,7 +107,7 @@ func (s *Supplier) OverDailyDownloadLimit() bool {
 
 	// 需要查询今天的限额
 	count, err := s.fileDownloader.CacheCenter.DailyDownloadCountGet(s.GetSupplierName(),
-		my_util.GetPublicIP(s.log, s.settings.AdvancedSettings.TaskQueue, s.settings.AdvancedSettings.ProxySettings))
+		pkg.GetPublicIP(s.log, s.settings.AdvancedSettings.TaskQueue, s.settings.AdvancedSettings.ProxySettings))
 	if err != nil {
 		s.log.Errorln(s.GetSupplierName(), "DailyDownloadCountGet", err)
 		return true
@@ -275,7 +276,7 @@ func (s *Supplier) getSubListFromFile4Movie(filePath string) ([]supplier.SubInfo
 		return nil, err
 	}
 	// 如果没有,那么就用文件名查找
-	searchKeyword := my_util.VideoNameSearchKeywordMaker(s.log, keyWord, imdbInfo.Year)
+	searchKeyword := search.VideoNameSearchKeywordMaker(s.log, keyWord, imdbInfo.Year)
 	subInfoList, err = s.getSubListFromKeyword4Movie(searchKeyword)
 	if err != nil {
 		s.log.Errorln(s.GetSupplierName(), "keyword:", searchKeyword)
@@ -290,7 +291,7 @@ func (s *Supplier) getSubListFromFile4Movie(filePath string) ([]supplier.SubInfo
 			return nil, err
 		}
 		// 如果没有,那么就用文件名查找
-		searchKeyword = my_util.VideoNameSearchKeywordMaker(s.log, keyWord, imdbInfo.Year)
+		searchKeyword = search.VideoNameSearchKeywordMaker(s.log, keyWord, imdbInfo.Year)
 		subInfoList, err = s.getSubListFromKeyword4Movie(searchKeyword)
 		if err != nil {
 			s.log.Errorln(s.GetSupplierName(), "keyword:", searchKeyword)
@@ -358,7 +359,7 @@ func (s *Supplier) whichEpisodeNeedDownloadSub(seriesInfo *series.SeriesInfo, al
 		}
 		subInfo.Season = season
 		subInfo.Episode = episode
-		epsKey := my_util.GetEpisodeKeyName(season, episode)
+		epsKey := pkg.GetEpisodeKeyName(season, episode)
 		_, ok := allSubDict[epsKey]
 		if ok == false {
 			// 初始化
@@ -477,7 +478,7 @@ func (s *Supplier) step1(browser *rod.Browser, detailPageUrl string, isMovieOrSe
 			notify_center.Notify.Add("subhd_step1", err.Error())
 		}
 	}()
-	detailPageUrl = my_util.AddBaseUrl(s.settings.AdvancedSettings.SuppliersSettings.SubHD.RootUrl, detailPageUrl)
+	detailPageUrl = pkg.AddBaseUrl(s.settings.AdvancedSettings.SuppliersSettings.SubHD.RootUrl, detailPageUrl)
 	result, page, err := rod_helper.HttpGetFromBrowser(browser, detailPageUrl, s.tt)
 	if err != nil {
 		return nil, err
@@ -547,7 +548,7 @@ func (s *Supplier) DownFile(browser *rod.Browser, subDownloadPageUrl string, Top
 			notify_center.Notify.Add("subhd_DownFile", err.Error())
 		}
 	}()
-	subDownloadPageFullUrl := my_util.AddBaseUrl(s.settings.AdvancedSettings.SuppliersSettings.SubHD.RootUrl, subDownloadPageUrl)
+	subDownloadPageFullUrl := pkg.AddBaseUrl(s.settings.AdvancedSettings.SuppliersSettings.SubHD.RootUrl, subDownloadPageUrl)
 
 	_, page, err := rod_helper.HttpGetFromBrowser(browser, subDownloadPageFullUrl, s.tt)
 	if err != nil {
@@ -712,7 +713,7 @@ func (s *Supplier) passWaterWall(page *rod.Page) {
 	shadowbg := slideBgEl.MustResource()
 	// 取得原始圖像
 	src := slideBgEl.MustProperty("src")
-	fullbg, _, err := my_util.DownFile(s.log, strings.Replace(src.String(), "img_index=1", "img_index=0", 1))
+	fullbg, _, err := pkg.DownFile(s.log, strings.Replace(src.String(), "img_index=1", "img_index=0", 1))
 	if err != nil {
 		s.log.Errorln("passWaterWall.DownFile", err)
 		return

+ 5 - 6
pkg/logic/sub_supplier/subhd/subhd_test.go

@@ -15,7 +15,6 @@ import (
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/random_auth_key"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/something_static"
@@ -25,7 +24,7 @@ import (
 var authKey random_auth_key.AuthKey
 
 func defInstance() {
-	my_util.ReadCustomAuthFile(log_helper.GetLogger4Tester())
+	pkg.ReadCustomAuthFile(log_helper.GetLogger4Tester())
 	authKey = random_auth_key.AuthKey{
 		BaseKey:  pkg.BaseKey(),
 		AESKey16: pkg.AESKey16(),
@@ -48,7 +47,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(file_downloader.NewFileDownloader(cache_center.NewCacheCenter("test", settings.NewSettings(), log_helper.GetLogger4Tester()), authKey))
+	subhd := NewSupplier(file_downloader.NewFileDownloader(cache_center.NewCacheCenter("test", settings.NewSettings(pkg.ConfigRootDirFPath()), log_helper.GetLogger4Tester()), authKey))
 	outList, err := subhd.getSubListFromFile4Movie(movie1)
 	if err != nil {
 		t.Error(err)
@@ -90,7 +89,7 @@ func TestSupplier_GetSubListFromFile4Series(t *testing.T) {
 	if err != nil {
 		t.Fatal(err)
 	}
-	s := NewSupplier(file_downloader.NewFileDownloader(cache_center.NewCacheCenter("test", settings.NewSettings(), log_helper.GetLogger4Tester()), authKey))
+	s := NewSupplier(file_downloader.NewFileDownloader(cache_center.NewCacheCenter("test", settings.NewSettings(pkg.ConfigRootDirFPath()), log_helper.GetLogger4Tester()), authKey))
 	outList, err := s.GetSubListFromFile4Series(seriesInfo)
 	if err != nil {
 		t.Fatal(err)
@@ -112,7 +111,7 @@ func TestSupplier_getSubListFromKeyword4Movie(t *testing.T) {
 	//imdbID := "tt3626476" // Vacation Friends (2021)
 	getCode()
 	defInstance()
-	subhd := NewSupplier(file_downloader.NewFileDownloader(cache_center.NewCacheCenter("test", settings.NewSettings(), log_helper.GetLogger4Tester()), authKey))
+	subhd := NewSupplier(file_downloader.NewFileDownloader(cache_center.NewCacheCenter("test", settings.NewSettings(pkg.ConfigRootDirFPath()), log_helper.GetLogger4Tester()), authKey))
 	subInfos, err := subhd.getSubListFromKeyword4Movie(imdbID)
 	if err != nil {
 		t.Fatal(err)
@@ -124,7 +123,7 @@ func TestSupplier_getSubListFromKeyword4Movie(t *testing.T) {
 
 func getCode() {
 
-	if my_util.ReadCustomAuthFile(log_helper.GetLogger4Tester()) == false {
+	if pkg.ReadCustomAuthFile(log_helper.GetLogger4Tester()) == false {
 		println("read auth file failed")
 		return
 	}

+ 4 - 3
pkg/logic/sub_supplier/xunlei/xunlei.go

@@ -9,6 +9,8 @@ import (
 	"path/filepath"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/series"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/supplier"
@@ -16,7 +18,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/pkg/language"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/file_downloader"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_parser_hub"
@@ -115,7 +116,7 @@ func (s *Supplier) getSubListFromFile(filePath string) ([]supplier.SubInfo, erro
 
 	s.log.Debugln(s.GetSupplierName(), filePath, "Start...")
 
-	if my_util.IsFile(filePath) == false {
+	if pkg.IsFile(filePath) == false {
 		// 这里传入的可能是蓝光结构的伪造存在的视频文件,需要检查一次这个文件是否存在
 		bok, _, _ := decode.IsFakeBDMVWorked(filePath)
 		if bok == false {
@@ -191,7 +192,7 @@ func (s *Supplier) getSubListFromFile(filePath string) ([]supplier.SubInfo, erro
 func (s *Supplier) getSubInfos(filePath, cid string) (SublistSliceXunLei, error) {
 	var jsonList SublistSliceXunLei
 
-	httpClient, err := my_util.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
+	httpClient, err := pkg.NewHttpClient(s.settings.AdvancedSettings.ProxySettings)
 	if err != nil {
 		return jsonList, err
 	}

+ 1 - 2
pkg/logic/sub_supplier/xunlei/xunlei_test.go

@@ -10,7 +10,6 @@ import (
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/random_auth_key"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/unit_test_helper"
@@ -57,7 +56,7 @@ var xunleiInstance *Supplier
 
 func defInstance() {
 
-	my_util.ReadCustomAuthFile(log_helper.GetLogger4Tester())
+	pkg.ReadCustomAuthFile(log_helper.GetLogger4Tester())
 
 	authKey := random_auth_key.AuthKey{
 		BaseKey:  pkg.BaseKey(),

+ 10 - 9
pkg/logic/sub_supplier/zimuku/zimuku.go

@@ -11,6 +11,8 @@ import (
 	"strings"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg/search"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
@@ -26,7 +28,6 @@ import (
 	"github.com/Tnze/go.num/v2/zh"
 	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/pkg/language"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/notify_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_parser_hub"
@@ -108,7 +109,7 @@ func (s *Supplier) OverDailyDownloadLimit() bool {
 	}
 	// 需要查询今天的限额
 	count, err := s.fileDownloader.CacheCenter.DailyDownloadCountGet(s.GetSupplierName(),
-		my_util.GetPublicIP(s.log, s.settings.AdvancedSettings.TaskQueue, s.settings.AdvancedSettings.ProxySettings))
+		pkg.GetPublicIP(s.log, s.settings.AdvancedSettings.TaskQueue, s.settings.AdvancedSettings.ProxySettings))
 	if err != nil {
 		s.log.Errorln(s.GetSupplierName(), "DailyDownloadCountGet", err)
 		return true
@@ -189,9 +190,9 @@ func (s *Supplier) GetSubListFromFile4Series(seriesInfo *series.SeriesInfo) ([]s
 			是不是有点绕···
 		*/
 		findSeasonFirstEpsIMDBId := ""
-		videoList, err := my_util.SearchMatchedVideoFile(s.log, seriesInfo.DirPath)
+		videoList, err := search.MatchedVideoFile(s.log, seriesInfo.DirPath)
 		if err != nil {
-			s.log.Errorln("GetSubListFromFile4Series.SearchMatchedVideoFile, Season:", value, "Error:", err)
+			s.log.Errorln("GetSubListFromFile4Series.MatchedVideoFile, Season:", value, "Error:", err)
 			continue
 		}
 		for _, oneVideoFPath := range videoList {
@@ -323,7 +324,7 @@ func (s *Supplier) getSubListFromMovie(browser *rod.Browser, fileFPath string) (
 		}
 	}
 	// 如果没有,那么就用文件名查找
-	searchKeyword := my_util.VideoNameSearchKeywordMaker(s.log, imdbInfo.Title, imdbInfo.Year)
+	searchKeyword := search.VideoNameSearchKeywordMaker(s.log, imdbInfo.Title, imdbInfo.Year)
 
 	s.log.Debugln(s.GetSupplierName(), fileFPath, "VideoNameSearchKeywordMaker Keyword:", searchKeyword)
 
@@ -388,7 +389,7 @@ func (s *Supplier) whichEpisodeNeedDownloadSub(seriesInfo *series.SeriesInfo, Al
 		}
 		subInfo.Season = season
 		subInfo.Episode = episode
-		epsKey := my_util.GetEpisodeKeyName(season, episode)
+		epsKey := pkg.GetEpisodeKeyName(season, episode)
 		_, ok := allSubDict[epsKey]
 		if ok == false {
 			// 初始化
@@ -551,7 +552,7 @@ func (s *Supplier) step1(browser *rod.Browser, filmDetailPageUrl string) (SubRes
 	var subResult SubResult
 	subResult.SubInfos = SubInfos{}
 
-	filmDetailPageUrl = my_util.AddBaseUrl(s.settings.AdvancedSettings.SuppliersSettings.Zimuku.RootUrl, filmDetailPageUrl)
+	filmDetailPageUrl = pkg.AddBaseUrl(s.settings.AdvancedSettings.SuppliersSettings.Zimuku.RootUrl, filmDetailPageUrl)
 
 	result, page, err := rod_helper.HttpGetFromBrowser(browser, filmDetailPageUrl, s.tt)
 	if err != nil {
@@ -652,7 +653,7 @@ func (s *Supplier) step2(browser *rod.Browser, subInfo *SubInfo) error {
 			notify_center.Notify.Add("zimuku_step2", err.Error())
 		}
 	}()
-	detailUrl := my_util.AddBaseUrl(s.settings.AdvancedSettings.SuppliersSettings.Zimuku.RootUrl, subInfo.DetailUrl)
+	detailUrl := pkg.AddBaseUrl(s.settings.AdvancedSettings.SuppliersSettings.Zimuku.RootUrl, subInfo.DetailUrl)
 	result, page, err := rod_helper.HttpGetFromBrowser(browser, detailUrl, s.tt)
 	if err != nil {
 		return err
@@ -683,7 +684,7 @@ func (s *Supplier) DownFile(browser *rod.Browser, subDownloadPageUrl string, Top
 			notify_center.Notify.Add("zimuku_DownFile", err.Error())
 		}
 	}()
-	subDownloadPageFullUrl := my_util.AddBaseUrl(s.settings.AdvancedSettings.SuppliersSettings.Zimuku.RootUrl, subDownloadPageUrl)
+	subDownloadPageFullUrl := pkg.AddBaseUrl(s.settings.AdvancedSettings.SuppliersSettings.Zimuku.RootUrl, subDownloadPageUrl)
 	result, page, err := rod_helper.HttpGetFromBrowser(browser, subDownloadPageFullUrl, s.tt)
 	if err != nil {
 		return nil, err

+ 8 - 8
pkg/logic/sub_supplier/zimuku/zimuku_test.go

@@ -1,17 +1,17 @@
 package zimuku
 
 import (
-	"github.com/allanpk716/ChineseSubFinder/pkg"
 	"path/filepath"
 	"testing"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/rod_helper"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/file_downloader"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/series_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/random_auth_key"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_helper"
@@ -21,7 +21,7 @@ import (
 func TestSupplier_GetSubListFromKeyword(t *testing.T) {
 
 	defInstance()
-	browser, err := rod_helper.NewBrowserBase(log_helper.GetLogger4Tester(), "", "", true, settings.NewSettings().AdvancedSettings.SuppliersSettings.Zimuku.RootUrl)
+	browser, err := rod_helper.NewBrowserBase(log_helper.GetLogger4Tester(), "", "", true, settings.NewSettings(pkg.ConfigRootDirFPath()).AdvancedSettings.SuppliersSettings.Zimuku.RootUrl)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -43,8 +43,8 @@ func TestSupplier_GetSubListFromKeyword(t *testing.T) {
 
 func TestSupplier_GetSubListFromFile(t *testing.T) {
 
-	opt := rod_helper.NewBrowserOptions(log_helper.GetLogger4Tester(), true, settings.NewSettings())
-	opt.SetPreLoadUrl(settings.NewSettings().AdvancedSettings.SuppliersSettings.Zimuku.RootUrl)
+	opt := rod_helper.NewBrowserOptions(log_helper.GetLogger4Tester(), true, settings.NewSettings(pkg.ConfigRootDirFPath()))
+	opt.SetPreLoadUrl(settings.NewSettings(pkg.ConfigRootDirFPath()).AdvancedSettings.SuppliersSettings.Zimuku.RootUrl)
 	browser, err := rod_helper.NewBrowserEx(opt)
 	if err != nil {
 		t.Fatal(err)
@@ -121,8 +121,8 @@ func TestSupplier_GetSubListFromFile4Series(t *testing.T) {
 
 func TestSupplier_getSubListFromKeyword(t *testing.T) {
 
-	opt := rod_helper.NewBrowserOptions(log_helper.GetLogger4Tester(), true, settings.NewSettings())
-	opt.SetPreLoadUrl(settings.NewSettings().AdvancedSettings.SuppliersSettings.Zimuku.RootUrl)
+	opt := rod_helper.NewBrowserOptions(log_helper.GetLogger4Tester(), true, settings.NewSettings(pkg.ConfigRootDirFPath()))
+	opt.SetPreLoadUrl(settings.NewSettings(pkg.ConfigRootDirFPath()).AdvancedSettings.SuppliersSettings.Zimuku.RootUrl)
 	browser, err := rod_helper.NewBrowserEx(opt)
 	if err != nil {
 		t.Fatal(err)
@@ -176,7 +176,7 @@ var zimukuInstance *Supplier
 
 func defInstance() {
 
-	my_util.ReadCustomAuthFile(log_helper.GetLogger4Tester())
+	pkg.ReadCustomAuthFile(log_helper.GetLogger4Tester())
 
 	authKey := random_auth_key.AuthKey{
 		BaseKey:  pkg.BaseKey(),

+ 5 - 4
pkg/logic/sub_timeline_fixer/SubTimelineFixerHelperEx.go

@@ -5,12 +5,13 @@ import (
 	"math"
 	"os"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/subparser"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/ffmpeg_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/sub_parser/ass"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/sub_parser/srt"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_parser_hub"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_timeline_fixer"
@@ -303,7 +304,7 @@ func (s SubTimelineFixerHelperEx) IsMatchBySubFile(ffmpegInfo *ffmpeg_helper.FFM
 		return false, nil, nil
 	}
 
-	targetSubEndTime := my_util.Time2SecondNumber(srcBase.GetEndTime())
+	targetSubEndTime := pkg.Time2SecondNumber(srcBase.GetEndTime())
 
 	matchResult := &MatchResult{
 		VideoDuration:          ffmpegInfo.Duration,
@@ -341,7 +342,7 @@ func (s SubTimelineFixerHelperEx) changeTimeLineAndSave(infoSrc *subparser.FileI
 		修复的字幕先存放到缓存目录,然后需要把原有的字幕进行“备份”,改名,然后再替换过来
 	*/
 	subFileName := desSubSaveFPath + sub_timeline_fixer.TmpExt
-	if my_util.IsFile(subFileName) == true {
+	if pkg.IsFile(subFileName) == true {
 		err := os.Remove(subFileName)
 		if err != nil {
 			return err
@@ -352,7 +353,7 @@ func (s SubTimelineFixerHelperEx) changeTimeLineAndSave(infoSrc *subparser.FileI
 		return err
 	}
 
-	if my_util.IsFile(desSubSaveFPath+sub_timeline_fixer.BackUpExt) == true {
+	if pkg.IsFile(desSubSaveFPath+sub_timeline_fixer.BackUpExt) == true {
 		err = os.Remove(desSubSaveFPath + sub_timeline_fixer.BackUpExt)
 		if err != nil {
 			return err

+ 3 - 3
pkg/mix_media_info/mix_media_info.go

@@ -4,9 +4,9 @@ import (
 	"errors"
 	"time"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
 	"gorm.io/gorm"
 
 	"github.com/allanpk716/ChineseSubFinder/internal/dao"
@@ -167,7 +167,7 @@ func KeyWordSelect(mediaInfo *models.MediaInfo, videoFPath string, isMovie bool,
 		if err != nil {
 			return "", err
 		}
-		keyWord += " " + my_util.GetEpisodeKeyName(epsVideoNfoInfo.Season, epsVideoNfoInfo.Episode, true)
+		keyWord += " " + pkg.GetEpisodeKeyName(epsVideoNfoInfo.Season, epsVideoNfoInfo.Episode, true)
 	}
 
 	return keyWord, nil

+ 0 - 10
pkg/my_util/search_test.go

@@ -1,10 +0,0 @@
-package my_util
-
-import (
-	"testing"
-)
-
-func TestSearchSeriesAllEpsAndSubtitles(t *testing.T) {
-
-	SearchSeriesAllEpsAndSubtitles(nil, "X:\\连续剧\\Pantheon")
-}

+ 3 - 2
pkg/pass_water_wall/pass_water_wall.go

@@ -8,8 +8,9 @@ import (
 	"strings"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/rod_helper"
 	"github.com/nfnt/resize"
 )
@@ -51,7 +52,7 @@ func SimulationTest() {
 	shadowbg := iframe.MustElement("#slideBg").MustResource()
 	//取得原始圖像
 	src := iframe.MustElement("#slideBg").MustProperty("src")
-	fullbg, fileName, err := my_util.DownFile(log_helper.GetLogger4Tester(), strings.Replace(src.String(), "img_index=1", "img_index=0", 1))
+	fullbg, fileName, err := pkg.DownFile(log_helper.GetLogger4Tester(), strings.Replace(src.String(), "img_index=1", "img_index=0", 1))
 	if err != nil {
 		return
 	}

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

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

+ 3 - 3
pkg/rod_helper/multi_browser.go

@@ -7,9 +7,9 @@ import (
 	"strconv"
 	"sync"
 
-	"github.com/sirupsen/logrus"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
+	"github.com/sirupsen/logrus"
 
 	"github.com/go-rod/rod"
 )
@@ -41,7 +41,7 @@ func NewMultiBrowser(browserOptions *BrowserOptions) *Browser {
 		return nil
 	}
 	// 尝试从本地的 XrayPoolUrl 获取 代理信息
-	httpClient, err := my_util.NewHttpClient()
+	httpClient, err := pkg.NewHttpClient()
 	if err != nil {
 		browserOptions.Log.Error(errors.New("NewHttpClient error:" + err.Error()))
 		return nil

+ 3 - 4
pkg/rod_helper/rod_base.go

@@ -16,7 +16,6 @@ import (
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/regex_things"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/random_useragent"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/go-rod/rod"
@@ -63,12 +62,12 @@ func NewBrowserBase(log *logrus.Logger, localChromeFPath, httpProxyURL string, l
 	})
 
 	// 随机的 rod 子文件夹名称
-	nowUserData := filepath.Join(pkg.DefRodTmpRootFolder(), my_util.RandStringBytesMaskImprSrcSB(20))
+	nowUserData := filepath.Join(pkg.DefRodTmpRootFolder(), pkg.RandStringBytesMaskImprSrcSB(20))
 	var browser *rod.Browser
 
 	if localChromeFPath != "" {
 		// 如果有指定的 chrome 路径,则使用指定的 chrome 路径
-		if my_util.IsFile(localChromeFPath) == false {
+		if pkg.IsFile(localChromeFPath) == false {
 			log.Errorln(errors.New("localChromeFPath is not a file, localChromePath:" + localChromeFPath))
 			panic(errors.New("localChromeFPath is not a file, localChromePath:" + localChromeFPath))
 		}
@@ -402,7 +401,7 @@ func HttpGetFromBrowser(browser *rod.Browser, inputUrl string, tt time.Duration,
 	if len(debugMode) > 0 && debugMode[0] == true {
 		//time.Sleep(my_util.RandomSecondDuration(0, 1))
 	} else {
-		time.Sleep(my_util.RandomSecondDuration(2, 5))
+		time.Sleep(pkg.RandomSecondDuration(2, 5))
 	}
 
 	if strings.Contains(strings.ToLower(pageString), "<title>403 forbidden</title>") == true {

+ 83 - 24
pkg/my_util/search.go → pkg/search/search.go

@@ -1,4 +1,4 @@
-package my_util
+package search
 
 import (
 	"io/fs"
@@ -7,6 +7,12 @@ import (
 	"strconv"
 	"strings"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
+	"github.com/allanpk716/ChineseSubFinder/pkg/types/backend"
+
+	PTN "github.com/middelink/go-parse-torrent-name"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_parser_hub"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
@@ -32,20 +38,20 @@ func VideoNameSearchKeywordMaker(l *logrus.Logger, title string, year string) st
 	return searchKeyword
 }
 
-// SearchMatchedVideoFileFromDirs 搜索符合后缀名的视频文件
-func SearchMatchedVideoFileFromDirs(l *logrus.Logger, dirs []string) (*treemap.Map, error) {
+// MatchedVideoFileFromDirs 搜索符合后缀名的视频文件
+func MatchedVideoFileFromDirs(l *logrus.Logger, dirs []string) (*treemap.Map, error) {
 
 	defer func() {
-		l.Infoln("SearchMatchedVideoFileFromDirs End")
+		l.Infoln("MatchedVideoFileFromDirs End")
 		l.Infoln(" --------------------------------------------------")
 	}()
 	l.Infoln(" --------------------------------------------------")
-	l.Infoln("SearchMatchedVideoFileFromDirs Start...")
+	l.Infoln("MatchedVideoFileFromDirs Start...")
 
 	var fileFullPathMap = treemap.NewWithStringComparator()
 	for _, dir := range dirs {
 
-		matchedVideoFile, err := SearchMatchedVideoFile(l, dir)
+		matchedVideoFile, err := MatchedVideoFile(l, dir)
 		if err != nil {
 			return nil, err
 		}
@@ -73,8 +79,8 @@ func SearchMatchedVideoFileFromDirs(l *logrus.Logger, dirs []string) (*treemap.M
 	return fileFullPathMap, nil
 }
 
-// SearchMatchedVideoFile 搜索符合后缀名的视频文件,现在也会把 BDMV 的文件搜索出来,但是这个并不是一个视频文件,需要在后续特殊处理
-func SearchMatchedVideoFile(l *logrus.Logger, dir string) ([]string, error) {
+// MatchedVideoFile 搜索符合后缀名的视频文件,现在也会把 BDMV 的文件搜索出来,但是这个并不是一个视频文件,需要在后续特殊处理
+func MatchedVideoFile(l *logrus.Logger, dir string) ([]string, error) {
 
 	var fileFullPathList = make([]string, 0)
 	pathSep := string(os.PathSeparator)
@@ -86,25 +92,25 @@ func SearchMatchedVideoFile(l *logrus.Logger, dir string) ([]string, error) {
 		fullPath := dir + pathSep + curFile.Name()
 		if curFile.IsDir() {
 			// 内层的错误就无视了
-			oneList, _ := SearchMatchedVideoFile(l, fullPath)
+			oneList, _ := MatchedVideoFile(l, fullPath)
 			if oneList != nil {
 				fileFullPathList = append(fileFullPathList, oneList...)
 			}
 		} else {
 			// 这里就是文件了
-			bok, fakeBDMVVideoFile := FileNameIsBDMV(fullPath)
+			bok, fakeBDMVVideoFile := pkg.FileNameIsBDMV(fullPath)
 			if bok == true {
 				// 这类文件后续的扫描字幕操作需要额外的处理
 				fileFullPathList = append(fileFullPathList, fakeBDMVVideoFile)
 				continue
 			}
-			if IsWantedVideoExtDef(curFile.Name()) == false {
+			if pkg.IsWantedVideoExtDef(curFile.Name()) == false {
 				// 不是期望的视频后缀名则跳过
 				continue
 			} else {
 				// 这里还有一种情况,就是蓝光, BDMV 下面会有一个 STREAM 文件夹,里面很多 m2ts 的视频组成
 				if filepath.Base(filepath.Dir(fullPath)) == "STREAM" {
-					l.Debugln("SearchMatchedVideoFile, Skip BDMV.STREAM:", fullPath)
+					l.Debugln("MatchedVideoFile, Skip BDMV.STREAM:", fullPath)
 					continue
 				}
 
@@ -119,7 +125,7 @@ func SearchMatchedVideoFile(l *logrus.Logger, dir string) ([]string, error) {
 	return fileFullPathList, nil
 }
 
-func SearchTVNfo(l *logrus.Logger, dir string) ([]string, error) {
+func TVNfo(l *logrus.Logger, dir string) ([]string, error) {
 
 	var fileFullPathList = make([]string, 0)
 	pathSep := string(os.PathSeparator)
@@ -131,7 +137,7 @@ func SearchTVNfo(l *logrus.Logger, dir string) ([]string, error) {
 		fullPath := dir + pathSep + curFile.Name()
 		if curFile.IsDir() {
 			// 内层的错误就无视了
-			oneList, _ := SearchTVNfo(l, fullPath)
+			oneList, _ := TVNfo(l, fullPath)
 			if oneList != nil {
 				fileFullPathList = append(fileFullPathList, oneList...)
 			}
@@ -151,41 +157,94 @@ func SearchTVNfo(l *logrus.Logger, dir string) ([]string, error) {
 	return fileFullPathList, nil
 }
 
-// SearchSeriesAllEpsAndSubtitles 遍历这个连续剧目录下的所有视频文件,以及这个视频文件对应的字幕文件
-func SearchSeriesAllEpsAndSubtitles(l *logrus.Logger, dir string) {
+// SeriesAllEpsAndSubtitles 遍历这个连续剧目录下的所有视频文件,以及这个视频文件对应的字幕文件
+func SeriesAllEpsAndSubtitles(l *logrus.Logger, dir string) (*backend.SeasonInfo, error) {
 
+	seasonInfo := backend.SeasonInfo{
+		Name:          filepath.Base(dir),
+		RootDirPath:   dir,
+		OneVideoInfos: make([]backend.OneVideoInfo, 0),
+	}
 	pathVideoMap := make(map[string][]string, 0)
 	pathSubsMap := make(map[string][]string, 0)
 	err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
+
 		if err != nil {
 			return err
 		}
 		if d.IsDir() == true {
+			// 跳过文件夹
 			return nil
 		}
-		if IsWantedVideoExtDef(filepath.Ext(d.Name())) == true {
+
+		if filter.SkipFileInfo(l, d) == true {
+			return nil
+		}
+
+		if pkg.IsWantedVideoExtDef(filepath.Ext(d.Name())) == true {
 			// 如果是符合视频的后缀名,那么就缓存起来
-			_, found := pathVideoMap[path]
+			tmpDir := filepath.Dir(path)
+			_, found := pathVideoMap[tmpDir]
 			if found == false {
-				pathVideoMap[path] = make([]string, 0)
+				pathVideoMap[tmpDir] = make([]string, 0)
 			}
-			pathVideoMap[path] = append(pathVideoMap[path], path)
+			pathVideoMap[tmpDir] = append(pathVideoMap[tmpDir], path)
 			return nil
 		}
 
 		if sub_parser_hub.IsSubExtWanted(filepath.Ext(d.Name())) == true {
 			// 如果是符合字幕的后缀名,那么就缓存起来
-			_, found := pathSubsMap[path]
+			tmpDir := filepath.Dir(path)
+			_, found := pathSubsMap[tmpDir]
 			if found == false {
-				pathSubsMap[path] = make([]string, 0)
+				pathSubsMap[tmpDir] = make([]string, 0)
 			}
-			pathSubsMap[path] = append(pathSubsMap[path], path)
+			pathSubsMap[tmpDir] = append(pathSubsMap[tmpDir], path)
 			return nil
 		}
 
 		return nil
 	})
 	if err != nil {
-		return
+		return nil, err
 	}
+	// 交叉比对,找到对应的字幕
+	for pathKey, videos := range pathVideoMap {
+
+		nowPathSubs, found := pathSubsMap[pathKey]
+		if found == false {
+			// 没有找到对应的字幕
+			continue
+		}
+		for _, oneVideo := range videos {
+
+			videoName := strings.ReplaceAll(filepath.Base(oneVideo), filepath.Ext(oneVideo), "")
+			parse, err := PTN.Parse(oneVideo)
+			if err != nil {
+				l.Errorln("SeriesAllEpsAndSubtitles.PTN.Parse", err)
+				continue
+			}
+			nowOneVideoInfo := backend.OneVideoInfo{
+				Name:         filepath.Base(oneVideo),
+				VideoFPath:   oneVideo,
+				Season:       parse.Season,
+				Episode:      parse.Episode,
+				SubFPathList: make([]string, 0),
+				SubUrlList:   make([]string, 0),
+			}
+			// 解析这个视频的 SxxExx 信息
+			for _, oneSub := range nowPathSubs {
+
+				if strings.HasPrefix(filepath.Base(oneSub), videoName) == false {
+					continue
+				}
+				// 找到了对应的字幕
+				nowOneVideoInfo.SubFPathList = append(nowOneVideoInfo.SubFPathList, oneSub)
+			}
+
+			seasonInfo.OneVideoInfos = append(seasonInfo.OneVideoInfos, nowOneVideoInfo)
+		}
+	}
+
+	return &seasonInfo, nil
 }

+ 16 - 0
pkg/search/search_test.go

@@ -0,0 +1,16 @@
+package search
+
+import (
+	"testing"
+
+	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
+)
+
+func TestSearchSeriesAllEpsAndSubtitles(t *testing.T) {
+
+	seasonInfo, err := SeriesAllEpsAndSubtitles(log_helper.GetLogger4Tester(), "X:\\连续剧\\Pantheon")
+	if err != nil {
+		t.Fatal(err)
+	}
+	println(seasonInfo.Name)
+}

+ 4 - 5
pkg/settings/settings.go

@@ -1,7 +1,6 @@
 package settings
 
 import (
-	"github.com/allanpk716/ChineseSubFinder/pkg"
 	"net/url"
 	"os"
 	"path/filepath"
@@ -26,11 +25,11 @@ type Settings struct {
 }
 
 // GetSettings 获取 Settings 的实例
-func GetSettings(reloadSettings ...bool) *Settings {
+func GetSettings(configRootDirFPath string, reloadSettings ...bool) *Settings {
 	if _settings == nil {
 
 		_settingsOnce.Do(func() {
-			_settings = NewSettings()
+			_settings = NewSettings(configRootDirFPath)
 			if isFile(_settings.configFPath) == false {
 				// 配置文件不存在,新建一个空白的
 				err := _settings.Save()
@@ -69,9 +68,9 @@ func SetFullNewSettings(inSettings *Settings) error {
 	return _settings.Save()
 }
 
-func NewSettings() *Settings {
+func NewSettings(configRootDirFPath string) *Settings {
 
-	nowConfigFPath := filepath.Join(pkg.ConfigRootDirFPath(), configName)
+	nowConfigFPath := filepath.Join(configRootDirFPath, configName)
 
 	return &Settings{
 		configFPath:           nowConfigFPath,

+ 3 - 1
pkg/settings/settings_test.go

@@ -4,6 +4,8 @@ import (
 	"reflect"
 	"testing"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/strcut_json"
 )
 
@@ -53,7 +55,7 @@ func TestNewSettings(t *testing.T) {
 		t.Fatal(err)
 	}
 
-	outSettings := NewSettings()
+	outSettings := NewSettings(pkg.ConfigRootDirFPath())
 	err = strcut_json.ToStruct(fileName, &outSettings)
 	if err != nil {
 		t.Fatal(err)

+ 6 - 5
pkg/something_static/something_static.go

@@ -8,11 +8,12 @@ import (
 	"path/filepath"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/file_downloader"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/sirupsen/logrus"
 )
 
@@ -21,18 +22,18 @@ func WriteFile(CloneProjectDesSaveDir, enString, nowTime, nowTimeFileNamePrix st
 	saveFileFPath := filepath.Join(CloneProjectDesSaveDir, nowTimeFileNamePrix+common.StaticFileName00)
 	saveFileFPathWait := filepath.Join(CloneProjectDesSaveDir, nowTimeFileNamePrix+common.StaticFileName00+waitExt)
 
-	if my_util.IsFile(saveFileFPath) == true {
+	if pkg.IsFile(saveFileFPath) == true {
 		// 目标文件存在,则需要判断准备写入覆盖的文件是否与当前存在的文件 SHA1 的值是一样的,一样就跳过后续的操作
 		// 写入等待替换的文件
 		err := writeFile(saveFileFPathWait, enString, nowTime)
 		if err != nil {
 			return false, err
 		}
-		orgFileSHA1, err := my_util.GetFileSHA1(saveFileFPath)
+		orgFileSHA1, err := pkg.GetFileSHA1(saveFileFPath)
 		if err != nil {
 			return false, err
 		}
-		waitFileSHA1, err := my_util.GetFileSHA1(saveFileFPathWait)
+		waitFileSHA1, err := pkg.GetFileSHA1(saveFileFPathWait)
 		if err != nil {
 			return false, err
 		}
@@ -95,7 +96,7 @@ func GetCodeFromWeb(l *logrus.Logger, nowTimeFileNamePrix string, fileDownloader
 
 func getCodeFromWeb(l *logrus.Logger, desUrl string) (string, string, error) {
 
-	fileBytes, _, err := my_util.DownFile(l, desUrl)
+	fileBytes, _, err := pkg.DownFile(l, desUrl)
 	if err != nil {
 		return "", "", err
 	}

+ 3 - 2
pkg/sub_formatter/normal/normal.go

@@ -5,13 +5,14 @@ import (
 	"regexp"
 	"strings"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	language2 "github.com/allanpk716/ChineseSubFinder/pkg/types/language"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/subparser"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/language"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/sub_parser/ass"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/sub_parser/srt"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_formatter/common"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_parser_hub"
 	"github.com/sirupsen/logrus"
@@ -84,7 +85,7 @@ func (f Formatter) IsMatchThisFormat(subName string) (bool, string, string, lang
 	// 目前倾向于这里用后面的逻辑
 	subLang = language.ISOString2SupportLang(subLangStr)
 	// 这里可能是拿到的是文件的全路径,那么就可以读取文件内容去判断文件的语言
-	if my_util.IsFile(subName) == true {
+	if pkg.IsFile(subName) == true {
 		bok, fileInfo, err := f.subParser.DetermineFileTypeFromFile(subName)
 		if err != nil || bok == false {
 			// add original Dir to fileNameWithOutExt to ensure file can be reached

+ 11 - 8
pkg/sub_formatter/sub_format_changer.go

@@ -7,6 +7,10 @@ import (
 	"path/filepath"
 	"strings"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg/search"
+
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/ifaces"
 	interCommon "github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/subparser"
@@ -15,7 +19,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
 	movieHelper "github.com/allanpk716/ChineseSubFinder/pkg/logic/movie_helper"
 	seriesHelper "github.com/allanpk716/ChineseSubFinder/pkg/logic/series_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_formatter/common"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_formatter/emby"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_formatter/normal"
@@ -84,12 +87,12 @@ func (s *SubFormatChanger) AutoDetectThenChangeTo(desFormatter common.FormatterN
 func (s *SubFormatChanger) autoDetectMovieThenChangeTo(outStruct *RenameResults, desFormatter common.FormatterName, movieRootDir string) error {
 
 	var err error
-	if my_util.IsDir(movieRootDir) == false {
+	if pkg.IsDir(movieRootDir) == false {
 		return errors.New("movieRootDir path not exist: " + movieRootDir)
 	}
 	// 先找出有那些电影文件夹和连续剧文件夹
 	var movieFullPathList = make([]string, 0)
-	movieFullPathList, err = my_util.SearchMatchedVideoFile(s.log, movieRootDir)
+	movieFullPathList, err = search.MatchedVideoFile(s.log, movieRootDir)
 	// fmt.Println("No. of Movies: ", len(movieFullPathList), "  dir:  ", s.movieRootDir)
 	if err != nil {
 		return err
@@ -98,7 +101,7 @@ func (s *SubFormatChanger) autoDetectMovieThenChangeTo(outStruct *RenameResults,
 	for _, one := range movieFullPathList {
 
 		// 需要判断这个视频根目录是否有 .ignore 文件,有也跳过
-		if my_util.IsFile(filepath.Join(filepath.Dir(one), interCommon.Ignore)) == true {
+		if pkg.IsFile(filepath.Join(filepath.Dir(one), interCommon.Ignore)) == true {
 			s.log.Infoln("Found", interCommon.Ignore, "Skip", one)
 			// 跳过下载字幕
 			continue
@@ -122,7 +125,7 @@ func (s *SubFormatChanger) autoDetectMovieThenChangeTo(outStruct *RenameResults,
 func (s *SubFormatChanger) autoDetectMSeriesThenChangeTo(outStruct *RenameResults, desFormatter common.FormatterName, seriesRootDir string) error {
 
 	var err error
-	if my_util.IsDir(seriesRootDir) == false {
+	if pkg.IsDir(seriesRootDir) == false {
 		return errors.New("seriesRootDir path not exist: " + seriesRootDir)
 	}
 	// 先找出有那些电影文件夹和连续剧文件夹
@@ -135,7 +138,7 @@ func (s *SubFormatChanger) autoDetectMSeriesThenChangeTo(outStruct *RenameResult
 	for _, oneSeriesDir := range seriesDirList {
 
 		// 需要判断这个视频根目录是否有 .ignore 文件,有也跳过
-		if my_util.IsFile(filepath.Join(oneSeriesDir, interCommon.Ignore)) == true {
+		if pkg.IsFile(filepath.Join(oneSeriesDir, interCommon.Ignore)) == true {
 			s.log.Infoln("Found", interCommon.Ignore, "Skip", oneSeriesDir)
 			// 跳过下载字幕
 			continue
@@ -204,11 +207,11 @@ func (s *SubFormatChanger) autoDetectAndChange(outStruct *RenameResults, fitSubN
 		// 确认改格式
 		err := os.Rename(fitSubName, newSubFileName)
 		if err != nil {
-			tmpName := my_util.FixWindowPathBackSlash(fitSubName)
+			tmpName := pkg.FixWindowPathBackSlash(fitSubName)
 			outStruct.ErrFiles[tmpName] += 1
 			continue
 		} else {
-			tmpName := my_util.FixWindowPathBackSlash(newSubFileName)
+			tmpName := pkg.FixWindowPathBackSlash(newSubFileName)
 			outStruct.RenamedFiles[tmpName] += 1
 		}
 	}

+ 20 - 21
pkg/sub_helper/sub_helper.go

@@ -19,7 +19,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/pkg/filter"
 	"github.com/allanpk716/ChineseSubFinder/pkg/language"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/regex_things"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_parser_hub"
 	"github.com/allanpk716/ChineseSubFinder/pkg/vad"
@@ -46,13 +45,13 @@ func OrganizeDlSubFiles(log *logrus.Logger, tmpFolderName string, subInfos []sup
 	for i := range subInfos {
 		// 先存下来,保存是时候需要前缀,前缀就是从那个网站下载来的
 		nowFileSaveFullPath := filepath.Join(tmpFolderFullPath, GetFrontNameAndOrgName(log, &subInfos[i]))
-		err = my_util.WriteFile(nowFileSaveFullPath, subInfos[i].Data)
+		err = pkg.WriteFile(nowFileSaveFullPath, subInfos[i].Data)
 		if err != nil {
 			log.Errorln("getFrontNameAndOrgName - WriteFile", nowFileSaveFullPath, "FromWhere Name TopN", subInfos[i].FromWhere, subInfos[i].Name, subInfos[i].TopN, err)
 			continue
 		}
 		nowExt := strings.ToLower(subInfos[i].Ext)
-		epsKey := my_util.GetEpisodeKeyName(subInfos[i].Season, subInfos[i].Episode)
+		epsKey := pkg.GetEpisodeKeyName(subInfos[i].Season, subInfos[i].Episode)
 		_, ok := siteSubInfoDict[epsKey]
 		if ok == false {
 			// 不存在则实例化
@@ -105,7 +104,7 @@ func OrganizeDlSubFiles(log *logrus.Logger, tmpFolderName string, subInfos []sup
 					}
 					// 加入缓存列表
 					// 根据当前字幕的信息来构建 key
-					SEPKey := my_util.GetEpisodeKeyName(nowSeason, nowEps)
+					SEPKey := pkg.GetEpisodeKeyName(nowSeason, nowEps)
 					_, ok = siteSubInfoDict[SEPKey]
 					if ok == false {
 						siteSubInfoDict[SEPKey] = make([]string, 0)
@@ -216,12 +215,12 @@ func GetFrontNameAndOrgName(log *logrus.Logger, info *supplier.SubInfo) string {
 	if err != nil {
 		log.Warnln("", err)
 		// 替换特殊字符
-		infoName = my_util.ReplaceSpecString(info.Name, "x")
+		infoName = pkg.ReplaceSpecString(info.Name, "x")
 	} else {
 		infoName = fileName.Title + "_S" + strconv.Itoa(fileName.Season) + "E" + strconv.Itoa(fileName.Episode) + filepath.Ext(info.Name)
 	}
 	if len(infoName) < 1 {
-		infoName = my_util.RandStringBytesMaskImprSrcSB(10) + filepath.Ext(info.Name)
+		infoName = pkg.RandStringBytesMaskImprSrcSB(10) + filepath.Ext(info.Name)
 	}
 	info.Name = infoName
 
@@ -244,7 +243,7 @@ func SearchMatchedSubFileByDir(log *logrus.Logger, dir string) ([]string, error)
 	}
 	for _, curFile := range files {
 		fullPath := dir + pathSep + curFile.Name()
-		if my_util.IsDir(fullPath) == true {
+		if pkg.IsDir(fullPath) == true {
 			// 需要排除 Sub_S1E0、Sub_S2E0 这样的整季的字幕文件夹,这里仅仅是缓存,不会被加载的
 			matched := regex_things.RegOneSeasonSubFolderNameMatch.FindAllStringSubmatch(curFile.Name(), -1)
 			if matched != nil && len(matched) > 0 {
@@ -439,12 +438,12 @@ func GetVADInfoFeatureFromSubNeedOffsetTimeWillInsert(fileInfo *subparser.FileIn
 	srcOneSubUnit := NewSubUnit()
 
 	// 最后一个对话的结束时间
-	lastDialogueExTimeEnd, err := my_util.ParseTime(nowDialogue[len(nowDialogue)-1].EndTime)
+	lastDialogueExTimeEnd, err := pkg.ParseTime(nowDialogue[len(nowDialogue)-1].EndTime)
 	if err != nil {
 		return nil, err
 	}
 	// 相当于总时长
-	fullDuration := my_util.Time2SecondNumber(lastDialogueExTimeEnd)
+	fullDuration := pkg.Time2SecondNumber(lastDialogueExTimeEnd)
 	// 最低的起始时间,因为可能需要裁剪范围
 	startRangeTimeMin := fullDuration * SkipFrontAndEndPer
 	endRangeTimeMax := fullDuration * (1.0 - SkipFrontAndEndPer)
@@ -454,16 +453,16 @@ func GetVADInfoFeatureFromSubNeedOffsetTimeWillInsert(fileInfo *subparser.FileIn
 
 	for i := 0; i < len(nowDialogue); i++ {
 
-		oneDialogueExTimeStart, err := my_util.ParseTime(nowDialogue[i].StartTime)
+		oneDialogueExTimeStart, err := pkg.ParseTime(nowDialogue[i].StartTime)
 		if err != nil {
 			return nil, err
 		}
-		oneDialogueExTimeEnd, err := my_util.ParseTime(nowDialogue[i].EndTime)
+		oneDialogueExTimeEnd, err := pkg.ParseTime(nowDialogue[i].EndTime)
 		if err != nil {
 			return nil, err
 		}
 
-		oneStart := my_util.Time2SecondNumber(oneDialogueExTimeStart)
+		oneStart := pkg.Time2SecondNumber(oneDialogueExTimeStart)
 		if SkipFrontAndEndPer > 0 {
 			if fullDuration*SkipFrontAndEndPer > oneStart || fullDuration*(1.0-SkipFrontAndEndPer) < oneStart {
 				continue
@@ -474,11 +473,11 @@ func GetVADInfoFeatureFromSubNeedOffsetTimeWillInsert(fileInfo *subparser.FileIn
 			continue
 		}
 		// 如果当前的这一句话,为空,或者进过正则表达式剔除特殊字符后为空,则跳过
-		if my_util.ReplaceSpecString(nowDialogue[i].Lines[0], "") == "" {
+		if pkg.ReplaceSpecString(nowDialogue[i].Lines[0], "") == "" {
 			continue
 		}
 		// 如果当前的这一句话,为空,或者进过正则表达式剔除特殊字符后为空,则跳过
-		if my_util.ReplaceSpecString(fileInfo.GetDialogueExContent(i), "") == "" {
+		if pkg.ReplaceSpecString(fileInfo.GetDialogueExContent(i), "") == "" {
 			continue
 		}
 		// 低于 5句对白,则添加
@@ -526,8 +525,8 @@ func GetVADInfoFeatureFromSubNew(fileInfo *subparser.FileInfo, SkipFrontAndEndPe
 		因为 VAD 的窗口是 10ms,那么需要多每一句话按 10 ms 的单位进行取整
 		每一句话开始、结束的时间,需要向下取整
 	*/
-	subStartTimeFloor := my_util.MakeFloor10msMultipleFromFloat(my_util.Time2SecondNumber(fileInfo.GetStartTime()))
-	subEndTimeFloor := my_util.MakeFloor10msMultipleFromFloat(my_util.Time2SecondNumber(fileInfo.GetEndTime()))
+	subStartTimeFloor := pkg.MakeFloor10msMultipleFromFloat(pkg.Time2SecondNumber(fileInfo.GetStartTime()))
+	subEndTimeFloor := pkg.MakeFloor10msMultipleFromFloat(pkg.Time2SecondNumber(fileInfo.GetEndTime()))
 	// 如果想要从 0 时间点开始算,那么 subStartTimeFloor 这个值就需要重置到0
 	subStartTimeFloor = 0
 	subFullSecondTimeFloor := subEndTimeFloor - subStartTimeFloor
@@ -552,22 +551,22 @@ func GetVADInfoFeatureFromSubNew(fileInfo *subparser.FileInfo, SkipFrontAndEndPe
 			continue
 		}
 		// 如果当前的这一句话,为空,或者进过正则表达式剔除特殊字符后为空,则跳过
-		if my_util.ReplaceSpecString(dialogue.Lines[0], "") == "" {
+		if pkg.ReplaceSpecString(dialogue.Lines[0], "") == "" {
 			continue
 		}
 		// 字幕的开始时间
-		oneDialogueStartTime, err := my_util.ParseTime(dialogue.StartTime)
+		oneDialogueStartTime, err := pkg.ParseTime(dialogue.StartTime)
 		if err != nil {
 			return nil, err
 		}
 		// 字幕的结束时间
-		oneDialogueEndTime, err := my_util.ParseTime(dialogue.EndTime)
+		oneDialogueEndTime, err := pkg.ParseTime(dialogue.EndTime)
 		if err != nil {
 			return nil, err
 		}
 		// 字幕的时长,对时间进行向下取整
-		oneDialogueStartTimeFloor := my_util.MakeCeil10msMultipleFromFloat(my_util.Time2SecondNumber(oneDialogueStartTime))
-		oneDialogueEndTimeFloor := my_util.MakeFloor10msMultipleFromFloat(my_util.Time2SecondNumber(oneDialogueEndTime))
+		oneDialogueStartTimeFloor := pkg.MakeCeil10msMultipleFromFloat(pkg.Time2SecondNumber(oneDialogueStartTime))
+		oneDialogueEndTimeFloor := pkg.MakeFloor10msMultipleFromFloat(pkg.Time2SecondNumber(oneDialogueEndTime))
 		// 得到一句对白的时长
 		changeVADStartIndex := int(oneDialogueStartTimeFloor * 100)
 		changeVADEndIndex := int(oneDialogueEndTimeFloor * 100)

+ 4 - 4
pkg/sub_helper/sub_helper_test.go

@@ -2,14 +2,14 @@ package sub_helper
 
 import (
 	"fmt"
-	"github.com/allanpk716/ChineseSubFinder/pkg"
 	"path/filepath"
 	"testing"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/sub_parser/ass"
 	"github.com/allanpk716/ChineseSubFinder/pkg/logic/sub_parser/srt"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_parser_hub"
 	"github.com/allanpk716/ChineseSubFinder/pkg/unit_test_helper"
 )
@@ -26,7 +26,7 @@ func TestDeleteOneSeasonSubCacheFolder(t *testing.T) {
 	if err != nil {
 		t.Fatal(err)
 	}
-	err = my_util.CopyDir(testRootDir, desSeasonFullPath)
+	err = pkg.CopyDir(testRootDir, desSeasonFullPath)
 	if err != nil {
 		t.Fatal(err)
 	}
@@ -34,7 +34,7 @@ func TestDeleteOneSeasonSubCacheFolder(t *testing.T) {
 	if err != nil {
 		t.Fatal(err)
 	}
-	if my_util.IsDir(desSeasonFullPath) == true {
+	if pkg.IsDir(desSeasonFullPath) == true {
 		t.Fatal("Sub_S1E0 not delete")
 	}
 }

+ 20 - 19
pkg/sub_helper/sub_unit.go

@@ -7,7 +7,8 @@ import (
 	"os"
 	"time"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/vad"
 )
 
@@ -44,12 +45,12 @@ func (s *SubUnit) Add(oneSubStartTime, oneSubEndTime time.Time) {
 		s.firstAdd = true
 	}
 
-	s.offsetEndTime = oneSubEndTime.Add(-my_util.Time2Duration(s.baseTime))
+	s.offsetEndTime = oneSubEndTime.Add(-pkg.Time2Duration(s.baseTime))
 
 	// 添加 Start
-	s.VADList = append(s.VADList, *vad.NewVADInfoBase(true, time.Duration((my_util.Time2SecondNumber(oneSubStartTime))*math.Pow10(9))))
+	s.VADList = append(s.VADList, *vad.NewVADInfoBase(true, time.Duration((pkg.Time2SecondNumber(oneSubStartTime))*math.Pow10(9))))
 	// 添加 End
-	s.VADList = append(s.VADList, *vad.NewVADInfoBase(false, time.Duration((my_util.Time2SecondNumber(oneSubEndTime))*math.Pow10(9))))
+	s.VADList = append(s.VADList, *vad.NewVADInfoBase(false, time.Duration((pkg.Time2SecondNumber(oneSubEndTime))*math.Pow10(9))))
 
 	s.subCount++
 }
@@ -72,7 +73,7 @@ func (s *SubUnit) AddAndInsert(oneSubStartTime, oneSubEndTime time.Time) {
 	// 不是第一次添加,那么就需要把两句对白中间间隔的 active == false 的插入,插入间隙
 	if len(s.VADList) > 0 {
 		nowStartTime := s.RealTimeToOffsetTime(oneSubStartTime)
-		nowStartOffsetTime := my_util.Time2SecondNumber(nowStartTime)
+		nowStartOffsetTime := pkg.Time2SecondNumber(nowStartTime)
 		nowEndOffsetTime := s.GetEndTimeNumber(false)
 
 		needAddRange := nowStartOffsetTime - nowEndOffsetTime
@@ -99,18 +100,18 @@ func (s *SubUnit) AddAndInsert(oneSubStartTime, oneSubEndTime time.Time) {
 		s.firstAdd = true
 	}
 
-	s.offsetEndTime = oneSubEndTime.Add(-my_util.Time2Duration(s.baseTime))
+	s.offsetEndTime = oneSubEndTime.Add(-pkg.Time2Duration(s.baseTime))
 
 	nowStartTime := s.RealTimeToOffsetTime(oneSubStartTime)
 	nowEndTime := s.RealTimeToOffsetTime(oneSubEndTime)
 
-	nowStartOffsetTime := my_util.Time2SecondNumber(nowStartTime)
-	nowEndOffsetTime := my_util.Time2SecondNumber(nowEndTime)
+	nowStartOffsetTime := pkg.Time2SecondNumber(nowStartTime)
+	nowEndOffsetTime := pkg.Time2SecondNumber(nowEndTime)
 
 	needAddRange := nowEndOffsetTime - nowStartOffsetTime
 
 	for i := 0.0; i < needAddRange; {
-		s.VADList = append(s.VADList, *vad.NewVADInfoBase(true, time.Duration((my_util.Time2SecondNumber(oneSubStartTime)+i)*math.Pow10(9))))
+		s.VADList = append(s.VADList, *vad.NewVADInfoBase(true, time.Duration((pkg.Time2SecondNumber(oneSubStartTime)+i)*math.Pow10(9))))
 		i += perWindows
 	}
 
@@ -176,13 +177,13 @@ func (s *SubUnit) GetVADFloatSlice() []float64 {
 
 // GetStartTimeNumber 获取这个单元的起始时间,单位是秒
 func (s SubUnit) GetStartTimeNumber(realOrOffsetTime bool) float64 {
-	return my_util.Time2SecondNumber(s.GetStartTime(realOrOffsetTime))
+	return pkg.Time2SecondNumber(s.GetStartTime(realOrOffsetTime))
 }
 
 // GetStartTime 获取这个单元的起始时间
 func (s SubUnit) GetStartTime(realOrOffsetTime bool) time.Time {
 	if realOrOffsetTime == true {
-		return s.offsetStartTime.Add(my_util.Time2Duration(s.baseTime))
+		return s.offsetStartTime.Add(pkg.Time2Duration(s.baseTime))
 	} else {
 		return s.offsetStartTime
 	}
@@ -191,13 +192,13 @@ func (s SubUnit) GetStartTime(realOrOffsetTime bool) time.Time {
 // GetEndTimeNumber 获取这个单元的结束时间,单位是秒
 func (s SubUnit) GetEndTimeNumber(realOrOffsetTime bool) float64 {
 
-	return my_util.Time2SecondNumber(s.GetEndTime(realOrOffsetTime))
+	return pkg.Time2SecondNumber(s.GetEndTime(realOrOffsetTime))
 }
 
 // GetEndTime 获取这个单元的起始时间
 func (s SubUnit) GetEndTime(realOrOffsetTime bool) time.Time {
 	if realOrOffsetTime == true {
-		return s.offsetEndTime.Add(my_util.Time2Duration(s.baseTime))
+		return s.offsetEndTime.Add(pkg.Time2Duration(s.baseTime))
 	} else {
 		return s.offsetEndTime
 	}
@@ -213,7 +214,7 @@ func (s SubUnit) GetIndexTime(index int, realOrOffsetTime bool) (bool, time.Time
 	if realOrOffsetTime == true {
 		return true, time.Time{}.Add(s.VADList[index].Time)
 	} else {
-		return true, time.Time{}.Add(s.VADList[index].Time).Add(-my_util.Time2Duration(s.baseTime))
+		return true, time.Time{}.Add(s.VADList[index].Time).Add(-pkg.Time2Duration(s.baseTime))
 	}
 }
 
@@ -225,7 +226,7 @@ func (s SubUnit) GetIndexTimeNumber(index int, realOrOffsetTime bool) (bool, flo
 		return false, 0
 	}
 
-	return true, my_util.Time2SecondNumber(outTime)
+	return true, pkg.Time2SecondNumber(outTime)
 }
 
 // GetTimelineRange 开始到结束的时间长度,单位是秒
@@ -235,7 +236,7 @@ func (s SubUnit) GetTimelineRange() float64 {
 
 // GetOffsetTimeNumber 偏移时间,单位是秒
 func (s SubUnit) GetOffsetTimeNumber() float64 {
-	return my_util.Time2SecondNumber(s.baseTime)
+	return pkg.Time2SecondNumber(s.baseTime)
 }
 
 // GetFFMPEGCutRangeString 这里会生成导出 FFMPEG 的参数字段,起始时间和结束的时间长度
@@ -275,7 +276,7 @@ func (s SubUnit) GetExpandRangeIndex(expandTimeRange float64) (int, int) {
 		subTime := time.Duration(expandTimeRange) * time.Second
 		tmpStartTime := startTime.Add(-subTime)
 		// 需要从秒换算到偏移的 OffsetIndex 数值,一共多少份
-		tmpStartTimeIndex = int(my_util.Time2SecondNumber(tmpStartTime) / perWindows)
+		tmpStartTimeIndex = int(pkg.Time2SecondNumber(tmpStartTime) / perWindows)
 	}
 	// 结束时间 -> OffsetIndex
 	// 向右移动的时候,总长度是未知的,所以返回的值需要在外部重新 Check 是否会越界
@@ -283,14 +284,14 @@ func (s SubUnit) GetExpandRangeIndex(expandTimeRange float64) (int, int) {
 	subTime := time.Duration(expandTimeRange) * time.Second
 	tmpEndTime := endTime.Add(subTime)
 	// 需要从秒换算到偏移的 OffsetIndex 数值,一共多少份
-	tmpEndTimeIndex = int(my_util.Time2SecondNumber(tmpEndTime) / perWindows)
+	tmpEndTimeIndex = int(pkg.Time2SecondNumber(tmpEndTime) / perWindows)
 
 	return tmpStartTimeIndex, tmpEndTimeIndex
 }
 
 // RealTimeToOffsetTime 真实时间转偏移时间
 func (s SubUnit) RealTimeToOffsetTime(realTime time.Time) time.Time {
-	dd := my_util.Time2Duration(s.baseTime)
+	dd := pkg.Time2Duration(s.baseTime)
 	return realTime.Add(-dd)
 }
 

+ 1 - 2
pkg/sub_share_center/share_sub_cache_helper.go

@@ -6,7 +6,6 @@ import (
 
 	"github.com/allanpk716/ChineseSubFinder/pkg"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/sirupsen/logrus"
 )
 
@@ -31,7 +30,7 @@ func CopySub2Cache(log *logrus.Logger, orgSubFileFPath, imdbID string, year int,
 	}
 
 	desSubFileFPath := filepath.Join(nowFolderDir, imdbID, filepath.Base(orgSubFileFPath))
-	err = my_util.CopyFile(orgSubFileFPath, desSubFileFPath)
+	err = pkg.CopyFile(orgSubFileFPath, desSubFileFPath)
 	if err != nil {
 		log.Errorln("CheckOrgSubFileExistAndCopy2Cache.CopyFile", err)
 		return false, ""

+ 5 - 5
pkg/sub_timeline_fixer/pipeline.go

@@ -3,6 +3,7 @@ package sub_timeline_fixer
 import (
 	"errors"
 	"fmt"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
 	"os"
 	"sort"
 	"strings"
@@ -11,7 +12,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/subparser"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/gss"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/vad"
 	"github.com/huandu/go-clone"
@@ -200,11 +200,11 @@ func (p Pipeline) FixSubFileTimeline(infoSrc, scaledInfoSrc *subparser.FileInfo,
 	contentReplaceOffsetAll := -1
 	for index, scaledSrcOneDialogue := range scaledInfoSrc.Dialogues {
 
-		timeStart, err := my_util.ParseTime(scaledSrcOneDialogue.StartTime)
+		timeStart, err := pkg.ParseTime(scaledSrcOneDialogue.StartTime)
 		if err != nil {
 			return "", err
 		}
-		timeEnd, err := my_util.ParseTime(scaledSrcOneDialogue.EndTime)
+		timeEnd, err := pkg.ParseTime(scaledSrcOneDialogue.EndTime)
 		if err != nil {
 			return "", err
 		}
@@ -232,7 +232,7 @@ func (p Pipeline) FixSubFileTimeline(infoSrc, scaledInfoSrc *subparser.FileInfo,
 			continue
 		}
 		contentReplaceOffsetAll += contentReplaceOffsetNow
-		fixContent = fixContent[:contentReplaceOffsetAll] + strings.Replace(fixContent[contentReplaceOffsetAll:], orgStartTimeString, my_util.Time2SubTimeString(fixTimeStart, timeFormat), 1)
+		fixContent = fixContent[:contentReplaceOffsetAll] + strings.Replace(fixContent[contentReplaceOffsetAll:], orgStartTimeString, pkg.Time2SubTimeString(fixTimeStart, timeFormat), 1)
 
 		// contentReplaceOffsetAll 为 -1 的时候那么第一次搜索得到的就一定是可以替换的
 		if contentReplaceOffsetAll == -1 {
@@ -244,7 +244,7 @@ func (p Pipeline) FixSubFileTimeline(infoSrc, scaledInfoSrc *subparser.FileInfo,
 			continue
 		}
 		contentReplaceOffsetAll += contentReplaceOffsetNow
-		fixContent = fixContent[:contentReplaceOffsetAll] + strings.Replace(fixContent[contentReplaceOffsetAll:], orgEndTimeString, my_util.Time2SubTimeString(fixTimeEnd, timeFormat), 1)
+		fixContent = fixContent[:contentReplaceOffsetAll] + strings.Replace(fixContent[contentReplaceOffsetAll:], orgEndTimeString, pkg.Time2SubTimeString(fixTimeEnd, timeFormat), 1)
 	}
 
 	dstFile, err := os.Create(desSaveSubFileFullPath)

+ 3 - 2
pkg/sub_timeline_fixer/restore.go

@@ -5,7 +5,8 @@ import (
 	"path/filepath"
 	"strings"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/sirupsen/logrus"
 )
 
@@ -42,7 +43,7 @@ func Restore(log *logrus.Logger, movieDirs, seriesDirs []string) (int, error) {
 	for index, oneBkFile := range allBkFilesPath {
 
 		fixedFileName := strings.ReplaceAll(oneBkFile, BackUpExt, "")
-		if my_util.IsFile(fixedFileName) == true {
+		if pkg.IsFile(fixedFileName) == true {
 			err := os.Remove(fixedFileName)
 			if err != nil {
 				return 0, err

+ 16 - 17
pkg/subtitle_best_api/subtitle_best_api.go

@@ -20,7 +20,6 @@ import (
 
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/random_auth_key"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 )
@@ -48,7 +47,7 @@ func (s *SubtitleBestApi) CheckAlive(proxySettings ...*settings.ProxySettings) e
 	}
 
 	postUrl := webUrlBase + "/v1/subhd-code"
-	httpClient, err := my_util.NewHttpClient(proxySettings...)
+	httpClient, err := pkg.NewHttpClient(proxySettings...)
 	if err != nil {
 		return err
 	}
@@ -80,7 +79,7 @@ func (s *SubtitleBestApi) GetCode() (string, error) {
 	}
 
 	postUrl := webUrlBase + "/v1/subhd-code"
-	httpClient, err := my_util.NewHttpClient(s.proxySettings)
+	httpClient, err := pkg.NewHttpClient(s.proxySettings)
 	if err != nil {
 		return "", err
 	}
@@ -133,7 +132,7 @@ func (s *SubtitleBestApi) GetMediaInfo(id, source, videoType string) (*MediaInfo
 	}
 
 	postUrl := webUrlBase + "/v1/media-info"
-	httpClient, err := my_util.NewHttpClient(s.proxySettings)
+	httpClient, err := pkg.NewHttpClient(s.proxySettings)
 	if err != nil {
 		return nil, err
 	}
@@ -172,7 +171,7 @@ func (s *SubtitleBestApi) AskFroUpload(subSha256 string, IsMovie, trusted bool,
 		return nil, errors.New("auth key is not set")
 	}
 	postUrl := webUrlBase + "/v1/ask-for-upload"
-	httpClient, err := my_util.NewHttpClient(s.proxySettings)
+	httpClient, err := pkg.NewHttpClient(s.proxySettings)
 	if err != nil {
 		return nil, err
 	}
@@ -234,7 +233,7 @@ func (s *SubtitleBestApi) UploadSub(videoSubInfo *models.VideoSubInfo, subSaveRo
 	}
 
 	postUrl := webUrlBase + "/v1/upload-sub"
-	httpClient, err := my_util.NewHttpClient(s.proxySettings)
+	httpClient, err := pkg.NewHttpClient(s.proxySettings)
 	if err != nil {
 		return nil, err
 	}
@@ -246,7 +245,7 @@ func (s *SubtitleBestApi) UploadSub(videoSubInfo *models.VideoSubInfo, subSaveRo
 
 	// 从相对路径转换为绝对路径
 	subFileFPath := filepath.Join(subSaveRootDirPath, videoSubInfo.StoreRPath)
-	if my_util.IsFile(subFileFPath) == false {
+	if pkg.IsFile(subFileFPath) == false {
 		return nil, errors.New(fmt.Sprintf("sub file not exist, %s", subFileFPath))
 	}
 	file, err := os.Open(subFileFPath)
@@ -319,7 +318,7 @@ func (s *SubtitleBestApi) UploadLowTrustSub(lowTrustVideoSubInfo *models.LowVide
 	}
 
 	postUrl := webUrlBase + "/v1/upload-sub"
-	httpClient, err := my_util.NewHttpClient(s.proxySettings)
+	httpClient, err := pkg.NewHttpClient(s.proxySettings)
 	if err != nil {
 		return nil, err
 	}
@@ -331,7 +330,7 @@ func (s *SubtitleBestApi) UploadLowTrustSub(lowTrustVideoSubInfo *models.LowVide
 
 	// 从相对路径转换为绝对路径
 	subFileFPath := filepath.Join(subSaveRootDirPath, lowTrustVideoSubInfo.StoreRPath)
-	if my_util.IsFile(subFileFPath) == false {
+	if pkg.IsFile(subFileFPath) == false {
 		return nil, errors.New(fmt.Sprintf("sub file not exist, %s", subFileFPath))
 	}
 	file, err := os.Open(subFileFPath)
@@ -408,7 +407,7 @@ func (s *SubtitleBestApi) AskFindSub(VideoFeature, ImdbId, TmdbId, Season, Episo
 		return nil, errors.New("auth key is not set")
 	}
 	postUrl := webUrlBase + "/v1/ask-find-sub"
-	httpClient, err := my_util.NewHttpClient(s.proxySettings)
+	httpClient, err := pkg.NewHttpClient(s.proxySettings)
 	if err != nil {
 		return nil, err
 	}
@@ -453,7 +452,7 @@ func (s *SubtitleBestApi) FindSub(VideoFeature, ImdbId, TmdbId, Season, Episode,
 		return nil, errors.New("auth key is not set")
 	}
 	postUrl := webUrlBase + "/v1/find-sub"
-	httpClient, err := my_util.NewHttpClient(s.proxySettings)
+	httpClient, err := pkg.NewHttpClient(s.proxySettings)
 	if err != nil {
 		return nil, err
 	}
@@ -498,7 +497,7 @@ func (s *SubtitleBestApi) AskDownloadSub(SubSha256, DownloadToken, ApiKey string
 		return nil, errors.New("auth key is not set")
 	}
 	postUrl := webUrlBase + "/v1/ask-for-download"
-	httpClient, err := my_util.NewHttpClient(s.proxySettings)
+	httpClient, err := pkg.NewHttpClient(s.proxySettings)
 	if err != nil {
 		return nil, err
 	}
@@ -540,7 +539,7 @@ func (s *SubtitleBestApi) DownloadSub(SubSha256, DownloadToken, ApiKey, download
 		return nil, errors.New("auth key is not set")
 	}
 	postUrl := webUrlBase + "/v1/download-sub"
-	httpClient, err := my_util.NewHttpClient(s.proxySettings)
+	httpClient, err := pkg.NewHttpClient(s.proxySettings)
 	if err != nil {
 		return nil, err
 	}
@@ -558,7 +557,7 @@ func (s *SubtitleBestApi) DownloadSub(SubSha256, DownloadToken, ApiKey, download
 		postData["api_key"] = ApiKey
 	}
 
-	if my_util.IsFile(downloadFileDesFPath) == true {
+	if pkg.IsFile(downloadFileDesFPath) == true {
 		err = os.Remove(downloadFileDesFPath)
 		if err != nil {
 			return nil, errors.New("remove file error: " + err.Error())
@@ -613,7 +612,7 @@ func (s *SubtitleBestApi) ConvertId(id, source, videoType string) (*IdConvertRep
 	}
 
 	postUrl := webUrlBase + "/v1/id-convert"
-	httpClient, err := my_util.NewHttpClient(s.proxySettings)
+	httpClient, err := pkg.NewHttpClient(s.proxySettings)
 	if err != nil {
 		return nil, err
 	}
@@ -658,7 +657,7 @@ func (s *SubtitleBestApi) FeedBack(id, version, MediaServer string, EnableShare,
 	}
 
 	postUrl := webUrlBase + "/v1/feedback"
-	httpClient, err := my_util.NewHttpClient(s.proxySettings)
+	httpClient, err := pkg.NewHttpClient(s.proxySettings)
 	if err != nil {
 		return nil, err
 	}
@@ -705,7 +704,7 @@ func (s *SubtitleBestApi) AskDownloadTask(id string) (*AskDownloadTaskReply, err
 	}
 
 	postUrl := webUrlBase + "/v1/ask-download-task"
-	httpClient, err := my_util.NewHttpClient(s.proxySettings)
+	httpClient, err := pkg.NewHttpClient(s.proxySettings)
 	if err != nil {
 		return nil, err
 	}

+ 2 - 4
pkg/subtitle_best_api/subtitle_best_api_test.go

@@ -8,14 +8,12 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
-
 	"github.com/allanpk716/ChineseSubFinder/pkg/random_auth_key"
 )
 
 func TestSubtitleBestApi_GetMediaInfo(t *testing.T) {
 
-	my_util.ReadCustomAuthFile(log_helper.GetLogger4Tester())
+	pkg.ReadCustomAuthFile(log_helper.GetLogger4Tester())
 	bapi := NewSubtitleBestApi(
 		log_helper.GetLogger4Tester(),
 		random_auth_key.AuthKey{
@@ -30,7 +28,7 @@ func TestSubtitleBestApi_GetMediaInfo(t *testing.T) {
 	}
 	println(downloadTaskReply.Status, downloadTaskReply.Message)
 
-	feedReply, err := bapi.FeedBack(my_util.RandStringBytesMaskImprSrcSB(64), "1.0.0", "None", true, true)
+	feedReply, err := bapi.FeedBack(pkg.RandStringBytesMaskImprSrcSB(64), "1.0.0", "None", true, true)
 	if err != nil {
 		t.Fatal(err)
 	}

+ 1 - 2
pkg/task_queue/task_queue.go

@@ -14,7 +14,6 @@ import (
 	task_queue2 "github.com/allanpk716/ChineseSubFinder/pkg/types/task_queue"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/emirpasic/gods/maps/treemap"
 	"github.com/emirpasic/gods/sets/treeset"
@@ -292,7 +291,7 @@ func (t *TaskQueue) del(jobId string) (bool, error) {
 	// 删除任务的时候也需要删除对应的日志
 	pathRoot := filepath.Join(pkg.ConfigRootDirFPath(), "Logs")
 	fileFPath := filepath.Join(pathRoot, common.OnceLogPrefix+jobId+".log")
-	if my_util.IsFile(fileFPath) == true {
+	if pkg.IsFile(fileFPath) == true {
 		err = os.Remove(fileFPath)
 		if err != nil {
 			t.log.Errorln("del job", jobId, "logfile,error:", err)

+ 6 - 5
pkg/task_queue/task_queue_test.go

@@ -2,13 +2,14 @@ package task_queue
 
 import (
 	"fmt"
+	"testing"
+
+	"github.com/allanpk716/ChineseSubFinder/pkg"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 	task_queue2 "github.com/allanpk716/ChineseSubFinder/pkg/types/task_queue"
-	"testing"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/cache_center"
 	"github.com/allanpk716/ChineseSubFinder/pkg/log_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 )
 
@@ -26,7 +27,7 @@ func TestTaskQueue_AddAndGetAndDel(t *testing.T) {
 		taskQueue.Close()
 	}()
 	for i := taskPriorityCount; i >= 0; i-- {
-		bok, err := taskQueue.Add(*task_queue2.NewOneJob(common.Movie, my_util.RandStringBytesMaskImprSrcSB(10), i))
+		bok, err := taskQueue.Add(*task_queue2.NewOneJob(common.Movie, pkg.RandStringBytesMaskImprSrcSB(10), i))
 		if err != nil {
 			t.Fatal("TestTaskQueue.Add", err)
 		}
@@ -78,7 +79,7 @@ func TestTaskQueue_AddAndClear(t *testing.T) {
 
 	taskQueue := NewTaskQueue(cache_center.NewCacheCenter(taskQueueName, settings.GetSettings(), log_helper.GetLogger4Tester()))
 	for i := taskPriorityCount; i >= 0; i-- {
-		bok, err := taskQueue.Add(*task_queue2.NewOneJob(common.Movie, my_util.RandStringBytesMaskImprSrcSB(10), i))
+		bok, err := taskQueue.Add(*task_queue2.NewOneJob(common.Movie, pkg.RandStringBytesMaskImprSrcSB(10), i))
 		if err != nil {
 			t.Fatal("TestTaskQueue.Add", err)
 		}
@@ -106,7 +107,7 @@ func TestTaskQueue_Update(t *testing.T) {
 
 	taskQueue := NewTaskQueue(cache_center.NewCacheCenter(taskQueueName, settings.GetSettings(), log_helper.GetLogger4Tester()))
 	for i := taskPriorityCount; i >= 0; i-- {
-		bok, err := taskQueue.Add(*task_queue2.NewOneJob(common.Movie, my_util.RandStringBytesMaskImprSrcSB(10), i))
+		bok, err := taskQueue.Add(*task_queue2.NewOneJob(common.Movie, pkg.RandStringBytesMaskImprSrcSB(10), i))
 		if err != nil {
 			t.Fatal("TestTaskQueue.Add", err)
 		}

+ 1 - 0
pkg/types/backend/reply_series_list.go

@@ -14,6 +14,7 @@ type OneVideoInfo struct {
 	Season                   int      `json:"season"`
 	Episode                  int      `json:"episode"`
 	SubFPathList             []string `json:"sub_f_path_list"`
+	SubUrlList               []string `json:"sub_url_list"`
 	MediaServerInsideVideoID string   `json:"media_server_inside_video_id"`
 }
 

+ 30 - 30
pkg/types/subparser/fileinfo.go

@@ -7,10 +7,10 @@ import (
 	"strings"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/common"
 	"github.com/allanpk716/ChineseSubFinder/pkg/types/language"
-
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 )
 
 type FileInfo struct {
@@ -43,7 +43,7 @@ func (f *FileInfo) SaveTranslated(desSubFileFPath string) error {
 		allString += oneDialogueString + "\n"
 	}
 
-	return my_util.WriteFile(desSubFileFPath, []byte(allString))
+	return pkg.WriteFile(desSubFileFPath, []byte(allString))
 }
 
 // GetSourceTranslateString 获取翻以前的字符串,会移除 \N 这样的信息,替换为空格
@@ -138,14 +138,14 @@ func (f *FileInfo) changeOneDialoguesFramerateRatio(oneDialogues []OneDialogue,
 
 		timeStart := oneDialogues[i].GetStartTime()
 		timeEnd := oneDialogues[i].GetEndTime()
-		timeStartNumber := my_util.Time2SecondNumber(timeStart)
-		timeEndNumber := my_util.Time2SecondNumber(timeEnd)
+		timeStartNumber := pkg.Time2SecondNumber(timeStart)
+		timeEndNumber := pkg.Time2SecondNumber(timeEnd)
 
-		scaleTimeStart := my_util.TimeNumber2Time(timeStartNumber * framerateRatio)
-		scaleTimeEnd := my_util.TimeNumber2Time(timeEndNumber * framerateRatio)
+		scaleTimeStart := pkg.TimeNumber2Time(timeStartNumber * framerateRatio)
+		scaleTimeEnd := pkg.TimeNumber2Time(timeEndNumber * framerateRatio)
 
-		oneDialogues[i].StartTime = my_util.Time2SubTimeString(scaleTimeStart, timeFormat)
-		oneDialogues[i].EndTime = my_util.Time2SubTimeString(scaleTimeEnd, timeFormat)
+		oneDialogues[i].StartTime = pkg.Time2SubTimeString(scaleTimeStart, timeFormat)
+		oneDialogues[i].EndTime = pkg.Time2SubTimeString(scaleTimeEnd, timeFormat)
 	}
 }
 
@@ -154,14 +154,14 @@ func (f *FileInfo) changeOneDialogueExsFramerateRatio(oneDialogues []OneDialogue
 
 		timeStart := oneDialogues[i].GetStartTime()
 		timeEnd := oneDialogues[i].GetEndTime()
-		timeStartNumber := my_util.Time2SecondNumber(timeStart)
-		timeEndNumber := my_util.Time2SecondNumber(timeEnd)
+		timeStartNumber := pkg.Time2SecondNumber(timeStart)
+		timeEndNumber := pkg.Time2SecondNumber(timeEnd)
 
-		scaleTimeStart := my_util.TimeNumber2Time(timeStartNumber * framerateRatio)
-		scaleTimeEnd := my_util.TimeNumber2Time(timeEndNumber * framerateRatio)
+		scaleTimeStart := pkg.TimeNumber2Time(timeStartNumber * framerateRatio)
+		scaleTimeEnd := pkg.TimeNumber2Time(timeEndNumber * framerateRatio)
 
-		oneDialogues[i].StartTime = my_util.Time2SubTimeString(scaleTimeStart, timeFormat)
-		oneDialogues[i].EndTime = my_util.Time2SubTimeString(scaleTimeEnd, timeFormat)
+		oneDialogues[i].StartTime = pkg.Time2SubTimeString(scaleTimeStart, timeFormat)
+		oneDialogues[i].EndTime = pkg.Time2SubTimeString(scaleTimeEnd, timeFormat)
 	}
 }
 
@@ -170,10 +170,10 @@ func (f FileInfo) GetStartTime() time.Time {
 	startTime := math.MaxFloat64
 	for i := 0; i < len(f.Dialogues); i++ {
 		// 找到最小的开始时间
-		tmpNowStartTimeNumber := my_util.Time2SecondNumber(f.Dialogues[i].GetStartTime())
+		tmpNowStartTimeNumber := pkg.Time2SecondNumber(f.Dialogues[i].GetStartTime())
 		startTime = math.Min(startTime, tmpNowStartTimeNumber)
 	}
-	return my_util.TimeNumber2Time(startTime)
+	return pkg.TimeNumber2Time(startTime)
 }
 
 // GetEndTime 获取的是从 Dialogues 得到的
@@ -181,16 +181,16 @@ func (f FileInfo) GetEndTime() time.Time {
 	endTime := -math.MaxFloat64
 	for i := 0; i < len(f.Dialogues); i++ {
 		// 找到最大的结束时间
-		tmpNowEndTimeNumber := my_util.Time2SecondNumber(f.Dialogues[i].GetEndTime())
+		tmpNowEndTimeNumber := pkg.Time2SecondNumber(f.Dialogues[i].GetEndTime())
 		endTime = math.Max(endTime, tmpNowEndTimeNumber)
 	}
-	return my_util.TimeNumber2Time(endTime)
+	return pkg.TimeNumber2Time(endTime)
 }
 
 // GetNumFrames 获取这个字幕的时间 Frame 数量
 func (f FileInfo) GetNumFrames() int {
 
-	return int(math.Abs((my_util.Time2SecondNumber(f.GetEndTime()) - my_util.Time2SecondNumber(f.GetStartTime())) * 100))
+	return int(math.Abs((pkg.Time2SecondNumber(f.GetEndTime()) - pkg.Time2SecondNumber(f.GetStartTime())) * 100))
 }
 
 // OneDialogue 一句对话
@@ -209,7 +209,7 @@ func NewOneDialogue() OneDialogue {
 }
 
 func (o OneDialogue) GetStartTime() time.Time {
-	srcTimeStartNow, err := my_util.ParseTime(o.StartTime)
+	srcTimeStartNow, err := pkg.ParseTime(o.StartTime)
 	if err != nil {
 		return time.Time{}
 	}
@@ -217,7 +217,7 @@ func (o OneDialogue) GetStartTime() time.Time {
 }
 
 func (o OneDialogue) GetEndTime() time.Time {
-	srcTimeEndNow, err := my_util.ParseTime(o.EndTime)
+	srcTimeEndNow, err := pkg.ParseTime(o.EndTime)
 	if err != nil {
 		return time.Time{}
 	}
@@ -236,15 +236,15 @@ func (d OneDialogueByStartTime) Swap(i, j int) {
 
 func (d OneDialogueByStartTime) Less(i, j int) bool {
 
-	subStartTimeI, err := my_util.ParseTime(d[i].StartTime)
+	subStartTimeI, err := pkg.ParseTime(d[i].StartTime)
 	if err != nil {
 		return false
 	}
-	subStartTimeJ, err := my_util.ParseTime(d[j].StartTime)
+	subStartTimeJ, err := pkg.ParseTime(d[j].StartTime)
 	if err != nil {
 		return false
 	}
-	return my_util.Time2SecondNumber(subStartTimeI) < my_util.Time2SecondNumber(subStartTimeJ)
+	return pkg.Time2SecondNumber(subStartTimeI) < pkg.Time2SecondNumber(subStartTimeJ)
 }
 
 // OneDialogueEx 一句对话,这里会把一句话中支持的 中、英、韩、日 四国语言给分离出来
@@ -258,7 +258,7 @@ type OneDialogueEx struct {
 }
 
 func (o OneDialogueEx) GetStartTime() time.Time {
-	srcTimeStartNow, err := my_util.ParseTime(o.StartTime)
+	srcTimeStartNow, err := pkg.ParseTime(o.StartTime)
 	if err != nil {
 		return time.Time{}
 	}
@@ -266,7 +266,7 @@ func (o OneDialogueEx) GetStartTime() time.Time {
 }
 
 func (o OneDialogueEx) GetEndTime() time.Time {
-	srcTimeEndNow, err := my_util.ParseTime(o.EndTime)
+	srcTimeEndNow, err := pkg.ParseTime(o.EndTime)
 	if err != nil {
 		return time.Time{}
 	}
@@ -285,15 +285,15 @@ func (d OneDialogueByStartTimeEx) Swap(i, j int) {
 
 func (d OneDialogueByStartTimeEx) Less(i, j int) bool {
 
-	subStartTimeI, err := my_util.ParseTime(d[i].StartTime)
+	subStartTimeI, err := pkg.ParseTime(d[i].StartTime)
 	if err != nil {
 		return false
 	}
-	subStartTimeJ, err := my_util.ParseTime(d[j].StartTime)
+	subStartTimeJ, err := pkg.ParseTime(d[j].StartTime)
 	if err != nil {
 		return false
 	}
-	return my_util.Time2SecondNumber(subStartTimeI) < my_util.Time2SecondNumber(subStartTimeJ)
+	return pkg.Time2SecondNumber(subStartTimeI) < pkg.Time2SecondNumber(subStartTimeJ)
 }
 
 const (

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

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

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

@@ -1,4 +1,4 @@
-package my_util
+package pkg
 
 import (
 	"path/filepath"

+ 9 - 9
pkg/video_list_helper/poster.go

@@ -3,7 +3,7 @@ package video_list_helper
 import (
 	"path/filepath"
 
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
+	"github.com/allanpk716/ChineseSubFinder/pkg"
 )
 
 // GetMoviePoster 获取电影的海报,如果为空就是没有找到
@@ -24,32 +24,32 @@ func (v *VideoListHelper) GetMoviePoster(movieFPath string) string {
 		movieName := filepath.Base(movieFPath)
 		// 1. poster.ext
 		posterFPath := filepath.Join(movieRootDir, "poster"+ext)
-		if my_util.IsFile(posterFPath) {
+		if pkg.IsFile(posterFPath) {
 			return posterFPath
 		}
 		// 2. movie.ext
 		posterFPath = filepath.Join(movieRootDir, "movie"+ext)
-		if my_util.IsFile(posterFPath) {
+		if pkg.IsFile(posterFPath) {
 			return posterFPath
 		}
 		// 3. folder.ext
 		posterFPath = filepath.Join(movieRootDir, "folder"+ext)
-		if my_util.IsFile(posterFPath) {
+		if pkg.IsFile(posterFPath) {
 			return posterFPath
 		}
 		// 4. <movie filename>-poster.ext
 		posterFPath = filepath.Join(movieRootDir, movieName+"-poster"+ext)
-		if my_util.IsFile(posterFPath) {
+		if pkg.IsFile(posterFPath) {
 			return posterFPath
 		}
 		// 5. <movie filename>.ext
 		posterFPath = filepath.Join(movieRootDir, movieName+ext)
-		if my_util.IsFile(posterFPath) {
+		if pkg.IsFile(posterFPath) {
 			return posterFPath
 		}
 		// 6. cover.ext
 		posterFPath = filepath.Join(movieRootDir, "cover"+ext)
-		if my_util.IsFile(posterFPath) {
+		if pkg.IsFile(posterFPath) {
 			return posterFPath
 		}
 	}
@@ -72,12 +72,12 @@ func (v *VideoListHelper) GetSeriesPoster(seriesDir string) string {
 	for _, ext := range extList {
 		// 1. poster.ext
 		posterFPath := filepath.Join(seriesDir, "poster"+ext)
-		if my_util.IsFile(posterFPath) {
+		if pkg.IsFile(posterFPath) {
 			return posterFPath
 		}
 		// 2. folder.ext
 		posterFPath = filepath.Join(seriesDir, "folder"+ext)
-		if my_util.IsFile(posterFPath) {
+		if pkg.IsFile(posterFPath) {
 			return posterFPath
 		}
 	}

+ 3 - 2
pkg/video_list_helper/video_list_helper.go

@@ -3,11 +3,12 @@ package video_list_helper
 import (
 	"sync"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg/search"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	vsh "github.com/allanpk716/ChineseSubFinder/pkg/video_scan_and_refresh_helper"
 
 	seriesHelper "github.com/allanpk716/ChineseSubFinder/pkg/logic/series_helper"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/sirupsen/logrus"
 )
 
@@ -46,7 +47,7 @@ func (v *VideoListHelper) RefreshMainList() (*vsh.NormalScanVideoResult, error)
 		}()
 		// --------------------------------------------------
 		// 电影
-		normalScanResult.MoviesDirMap, errMovie = my_util.SearchMatchedVideoFileFromDirs(v.log, v.settings.CommonSettings.MoviePaths)
+		normalScanResult.MoviesDirMap, errMovie = search.MatchedVideoFileFromDirs(v.log, v.settings.CommonSettings.MoviePaths)
 	}()
 	wg.Add(1)
 	go func() {

+ 8 - 6
pkg/video_scan_and_refresh_helper/video_scan_and_refresh_helper.go

@@ -1,12 +1,15 @@
 package video_scan_and_refresh_helper
 
 import (
-	"github.com/allanpk716/ChineseSubFinder/pkg"
 	"path/filepath"
 	"strings"
 	"sync"
 	"time"
 
+	"github.com/allanpk716/ChineseSubFinder/pkg/search"
+
+	"github.com/allanpk716/ChineseSubFinder/pkg"
+
 	"github.com/allanpk716/ChineseSubFinder/pkg/path_helper"
 
 	"github.com/allanpk716/ChineseSubFinder/pkg/ifaces"
@@ -32,7 +35,6 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/pkg/imdb_helper"
 	"github.com/allanpk716/ChineseSubFinder/pkg/language"
 	"github.com/allanpk716/ChineseSubFinder/pkg/mix_media_info"
-	"github.com/allanpk716/ChineseSubFinder/pkg/my_util"
 	"github.com/allanpk716/ChineseSubFinder/pkg/settings"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sort_things"
 	"github.com/allanpk716/ChineseSubFinder/pkg/sub_file_hash"
@@ -202,7 +204,7 @@ func (v *VideoScanAndRefreshHelper) ScanNormalMovieAndSeries() (*ScanVideoResult
 		// --------------------------------------------------
 		// 电影
 		// 没有填写 emby_helper api 的信息,那么就走常规的全文件扫描流程
-		normalScanResult.MoviesDirMap, errMovie = my_util.SearchMatchedVideoFileFromDirs(v.log, v.settings.CommonSettings.MoviePaths)
+		normalScanResult.MoviesDirMap, errMovie = search.MatchedVideoFileFromDirs(v.log, v.settings.CommonSettings.MoviePaths)
 	}()
 	wg.Add(1)
 	go func() {
@@ -372,7 +374,7 @@ func (v *VideoScanAndRefreshHelper) scanLowVideoSubInfo(scanVideoResult *ScanVid
 			subSha256Map := make(map[string]string)
 			for _, orgSubFPath := range chineseSubFitVideoNameFullPathList {
 				// 计算需要插入字幕的 sha256
-				saveSHA256String, err := my_util.GetFileSHA256String(orgSubFPath)
+				saveSHA256String, err := pkg.GetFileSHA256String(orgSubFPath)
 				if err != nil {
 					v.log.Warningln("scanLowVideoSubInfo.GetFileSHA256String", orgSubFPath, err)
 					continue
@@ -433,7 +435,7 @@ func (v *VideoScanAndRefreshHelper) scanLowVideoSubInfo(scanVideoResult *ScanVid
 						continue
 					}
 					// 计算需要插入字幕的 sha256
-					saveSHA256String, err := my_util.GetFileSHA256String(orgSubFPath)
+					saveSHA256String, err := pkg.GetFileSHA256String(orgSubFPath)
 					if err != nil {
 						v.log.Warningln("scanLowVideoSubInfo.GetFileSHA256String", orgSubFPath, err)
 						continue
@@ -457,7 +459,7 @@ func (v *VideoScanAndRefreshHelper) scanLowVideoSubInfo(scanVideoResult *ScanVid
 func (v *VideoScanAndRefreshHelper) addLowVideoSubInfo(isMovie bool, Season, Eps int, orgSubFPath string, mixMediaInfo *models.MediaInfo, shareRootDir string, fileHash string) {
 
 	// 计算需要插入字幕的 sha256
-	saveSHA256String, err := my_util.GetFileSHA256String(orgSubFPath)
+	saveSHA256String, err := pkg.GetFileSHA256String(orgSubFPath)
 	if err != nil {
 		v.log.Warningln("scanLowVideoSubInfo.GetFileSHA256String", orgSubFPath, err)
 		return