Browse Source

修复,在之前留下 OneJob 提交 Series 任务的时候忘记解析 SeriesRootDirPath 等信息的问题

Signed-off-by: allan716 <[email protected]>
allan716 3 years ago
parent
commit
4a4b97d58d
1 changed files with 19 additions and 0 deletions
  1. 19 0
      internal/pkg/downloader/downloader.go

+ 19 - 0
internal/pkg/downloader/downloader.go

@@ -14,6 +14,7 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_supplier/assrt"
 	"github.com/allanpk716/ChineseSubFinder/internal/logic/sub_timeline_fixer"
 	"github.com/allanpk716/ChineseSubFinder/internal/models"
+	"github.com/allanpk716/ChineseSubFinder/internal/pkg/decode"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/log_helper"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_folder"
 	"github.com/allanpk716/ChineseSubFinder/internal/pkg/my_util"
@@ -375,6 +376,24 @@ func (d *Downloader) seriesDlFunc(ctx context.Context, job taskQueue2.OneJob, do
 	// 设置只有一集需要下载
 	epsMap := make(map[int][]int, 0)
 	epsMap[job.Season] = []int{job.Episode}
+
+	if job.SeriesRootDirPath == "" {
+		// 连续剧的时候需要额外提交信息
+		torrentInfo, err := decode.GetVideoInfoFromFileName(job.VideoFPath)
+		if err != nil {
+			return err
+		}
+		seriesInfoDirPath := decode.GetSeriesDirRootFPath(job.VideoFPath)
+		if seriesInfoDirPath == "" {
+			err = errors.New(fmt.Sprintf("decode.GetSeriesDirRootFPath == Empty, %s", job.VideoFPath))
+			return err
+		}
+
+		job.Season = torrentInfo.Season
+		job.Episode = torrentInfo.Episode
+		job.SeriesRootDirPath = seriesInfoDirPath
+	}
+
 	// 这里拿到了这一部连续剧的所有的剧集信息,以及所有下载到的字幕信息
 	seriesInfo, err := series_helper.ReadSeriesInfoFromDir(
 		d.log, job.SeriesRootDirPath,