Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加入队列阶段: 跳过不必要的文件读取 #429

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (
"github.com/allanpk716/ChineseSubFinder/internal/types/backend"
"github.com/allanpk716/ChineseSubFinder/internal/types/common"
"github.com/allanpk716/ChineseSubFinder/internal/types/emby"
embyType "github.com/allanpk716/ChineseSubFinder/internal/types/emby"
TTaskqueue "github.com/allanpk716/ChineseSubFinder/internal/types/task_queue"
"github.com/emirpasic/gods/maps/treemap"
"github.com/huandu/go-clone"
Expand Down Expand Up @@ -108,10 +109,14 @@ func (v *VideoScanAndRefreshHelper) Start() error {
v.log.Infoln("------------------------------------")
v.log.Infoln("Video Scan Started...")
// 先进行扫描
scanResult, err := v.ScanNormalMovieAndSeries()
if err != nil {
v.log.Errorln("ScanNormalMovieAndSeries", err)
return err
var err error
scanResult := &ScanVideoResult{}
if v.settings.EmbySettings.Enable == false {
scanResult, err = v.ScanNormalMovieAndSeries()
if err != nil {
v.log.Errorln("ScanNormalMovieAndSeries", err)
return err
}
}
err = v.ScanEmbyMovieAndSeries(scanResult)
if err != nil {
Expand Down Expand Up @@ -1203,13 +1208,13 @@ func (v *VideoScanAndRefreshHelper) filterMovieAndSeriesNeedDownloadEmby(emby *E
// Emby 过滤,电影
for _, oneMovieMixInfo := range emby.MovieSubNeedDlEmbyMixInfoList {
// 放入队列
if v.subSupplierHub.MovieNeedDlSub(oneMovieMixInfo.PhysicalVideoFileFullPath, v.NeedForcedScanAndDownSub) == false {
continue
}
nowOneJob := TTaskqueue.NewOneJob(
common.Movie, oneMovieMixInfo.PhysicalVideoFileFullPath, task_queue.DefaultTaskPriorityLevel,
-1, oneMovieMixInfo.PhysicalVideoFileFullPath, task_queue.DefaultTaskPriorityLevel,
oneMovieMixInfo.VideoInfo.Id,
)
nowOneJob.VideoType = common.Movie
nowOneJob.CreatedTime = embyType.Time(oneMovieMixInfo.VideoInfo.PremiereDate)

bok, err := v.downloadQueue.Add(*nowOneJob)
if err != nil {
v.log.Errorln("filterMovieAndSeriesNeedDownloadEmby.Movie.NewOneJob", err)
Expand Down Expand Up @@ -1247,9 +1252,11 @@ func (v *VideoScanAndRefreshHelper) filterMovieAndSeriesNeedDownloadEmby(emby *E
// 在 GetRecentlyAddVideoListWithNoChineseSubtitle 的时候就进行了筛选,所以这里就直接加入队列了
// 放入队列
oneJob := TTaskqueue.NewOneJob(
common.Series, mixInfo.PhysicalVideoFileFullPath, task_queue.DefaultTaskPriorityLevel,
-1, mixInfo.PhysicalVideoFileFullPath, task_queue.DefaultTaskPriorityLevel,
mixInfo.VideoInfo.Id,
)
oneJob.VideoType = common.Series
oneJob.CreatedTime = embyType.Time(mixInfo.VideoInfo.PremiereDate)

info, err := decode.GetSeriesSeasonVideoNfoInfoFromEpisode(mixInfo.PhysicalVideoFileFullPath)
if err != nil {
Expand Down