Parcourir la source

补充日志的细节

Signed-off-by: allan716 <[email protected]>
allan716 il y a 4 ans
Parent
commit
dd64f8031c

+ 1 - 1
movie_helper/movieHelper.go

@@ -22,7 +22,7 @@ func OneMovieDlSubInAllSite(Suppliers []_interface.ISupplier, oneVideoFullPath s
 		go func() {
 		go func() {
 			subInfos, err := OneMovieDlSubInOneSite(oneVideoFullPath, i, supplier)
 			subInfos, err := OneMovieDlSubInOneSite(oneVideoFullPath, i, supplier)
 			if err != nil {
 			if err != nil {
-				model.GetLogger().Errorln("oneMovieDlSubInOneSite", err)
+				model.GetLogger().Errorln(supplier.GetSupplierName(), "oneMovieDlSubInOneSite", err)
 			}
 			}
 			subInfosChannel <- subInfos
 			subInfosChannel <- subInfos
 		}()
 		}()

+ 1 - 1
series_helper/seriesHelper.go

@@ -192,7 +192,7 @@ func OneSeriesDlSubInAllSite(Suppliers []_interface.ISupplier, seriesInfo *commo
 			// 一次性把这一部连续剧的所有字幕下载完
 			// 一次性把这一部连续剧的所有字幕下载完
 			subInfos, err := supplier.GetSubListFromFile4Series(seriesInfo)
 			subInfos, err := supplier.GetSubListFromFile4Series(seriesInfo)
 			if err != nil {
 			if err != nil {
-				model.GetLogger().Errorln("GetSubListFromFile4Series", err)
+				model.GetLogger().Errorln(supplier.GetSupplierName(), "GetSubListFromFile4Series", err)
 			}
 			}
 			// 把后缀名给改好
 			// 把后缀名给改好
 			model.ChangeVideoExt2SubExt(subInfos)
 			model.ChangeVideoExt2SubExt(subInfos)

+ 9 - 8
sub_supplier/subSupplierHub.go

@@ -7,6 +7,7 @@ import (
 	"github.com/allanpk716/ChineseSubFinder/movie_helper"
 	"github.com/allanpk716/ChineseSubFinder/movie_helper"
 	"github.com/allanpk716/ChineseSubFinder/series_helper"
 	"github.com/allanpk716/ChineseSubFinder/series_helper"
 	"github.com/sirupsen/logrus"
 	"github.com/sirupsen/logrus"
+	"gopkg.in/errgo.v2/fmt/errors"
 	"path/filepath"
 	"path/filepath"
 )
 )
 
 
@@ -34,7 +35,7 @@ func (d SubSupplierHub) DownloadSub4Movie(videoFullPath string, index int) ([]st
 	// 跳过中文的电影,不是一定要跳过的
 	// 跳过中文的电影,不是一定要跳过的
 	skip, err := movie_helper.SkipChineseMovie(videoFullPath, d.Suppliers[0].GetReqParam())
 	skip, err := movie_helper.SkipChineseMovie(videoFullPath, d.Suppliers[0].GetReqParam())
 	if err != nil {
 	if err != nil {
-		d.log.Error("SkipChineseMovie", err)
+		d.log.Warnln("SkipChineseMovie", videoFullPath, err)
 	}
 	}
 	if skip == true {
 	if skip == true {
 		return nil, nil
 		return nil, nil
@@ -42,7 +43,7 @@ func (d SubSupplierHub) DownloadSub4Movie(videoFullPath string, index int) ([]st
 
 
 	needDlSub, err := movie_helper.MovieNeedDlSub(videoFullPath)
 	needDlSub, err := movie_helper.MovieNeedDlSub(videoFullPath)
 	if err != nil {
 	if err != nil {
-		return nil, err
+		return nil, errors.Newf("MovieNeedDlSub %v %v", videoFullPath , err)
 	}
 	}
 	if needDlSub == true {
 	if needDlSub == true {
 		// 需要下载字幕
 		// 需要下载字幕
@@ -51,7 +52,7 @@ func (d SubSupplierHub) DownloadSub4Movie(videoFullPath string, index int) ([]st
 		// 整理字幕,比如解压什么的
 		// 整理字幕,比如解压什么的
 		organizeSubFiles, err := model.OrganizeDlSubFiles(filepath.Base(videoFullPath), subInfos)
 		organizeSubFiles, err := model.OrganizeDlSubFiles(filepath.Base(videoFullPath), subInfos)
 		if err != nil {
 		if err != nil {
-			return nil, err
+			return nil, errors.Newf("OrganizeDlSubFiles %v %v", videoFullPath , err)
 		}
 		}
 		// 因为是下载电影,需要合并返回
 		// 因为是下载电影,需要合并返回
 		var outSubFileFullPathList = make([]string, 0)
 		var outSubFileFullPathList = make([]string, 0)
@@ -69,17 +70,17 @@ func (d SubSupplierHub) DownloadSub4Movie(videoFullPath string, index int) ([]st
 func (d SubSupplierHub) DownloadSub4Series(seriesDirPath string, index int) (*common.SeriesInfo, map[string][]string, error) {
 func (d SubSupplierHub) DownloadSub4Series(seriesDirPath string, index int) (*common.SeriesInfo, map[string][]string, error) {
 
 
 	// 跳过中文的连续剧,不是一定要跳过的
 	// 跳过中文的连续剧,不是一定要跳过的
-	skip, idmbInfo, err := series_helper.SkipChineseSeries(seriesDirPath, d.Suppliers[0].GetReqParam())
+	skip, imdbInfo, err := series_helper.SkipChineseSeries(seriesDirPath, d.Suppliers[0].GetReqParam())
 	if err != nil {
 	if err != nil {
-		d.log.Error("SkipChineseSeries", err)
+		d.log.Warnln("SkipChineseSeries", seriesDirPath, err)
 	}
 	}
 	if skip == true {
 	if skip == true {
 		return nil, nil, nil
 		return nil, nil, nil
 	}
 	}
 	// 读取本地的视频和字幕信息
 	// 读取本地的视频和字幕信息
-	seriesInfo, err := series_helper.ReadSeriesInfoFromDir(seriesDirPath, idmbInfo)
+	seriesInfo, err := series_helper.ReadSeriesInfoFromDir(seriesDirPath, imdbInfo)
 	if err != nil {
 	if err != nil {
-		return nil, nil, err
+		return nil, nil, errors.Newf("ReadSeriesInfoFromDir %v %v", seriesDirPath , err)
 	}
 	}
 	// 下载好的字幕
 	// 下载好的字幕
 	subInfos := series_helper.OneSeriesDlSubInAllSite(d.Suppliers, seriesInfo, index)
 	subInfos := series_helper.OneSeriesDlSubInAllSite(d.Suppliers, seriesInfo, index)
@@ -87,5 +88,5 @@ func (d SubSupplierHub) DownloadSub4Series(seriesDirPath string, index int) (*co
 	// 每一集 SxEx - 对应解压整理后的字幕列表
 	// 每一集 SxEx - 对应解压整理后的字幕列表
 	organizeSubFiles, err := model.OrganizeDlSubFiles(filepath.Base(seriesDirPath), subInfos)
 	organizeSubFiles, err := model.OrganizeDlSubFiles(filepath.Base(seriesDirPath), subInfos)
 
 
-	return seriesInfo, organizeSubFiles, err
+	return seriesInfo, organizeSubFiles, errors.Newf("OrganizeDlSubFiles %v %v", seriesDirPath , err)
 }
 }

+ 1 - 1
sub_supplier/subhd/subhd.go

@@ -242,7 +242,7 @@ func (s Supplier) whichEpisodeNeedDownloadSub(seriesInfo *common.SeriesInfo, all
 			value[0].Episode = epsInfo.Episode
 			value[0].Episode = epsInfo.Episode
 			subInfoNeedDownload = append(subInfoNeedDownload, value[0])
 			subInfoNeedDownload = append(subInfoNeedDownload, value[0])
 		} else {
 		} else {
-			s.log.Infoln("Not Find Sub can be download", epsInfo.Title, epsInfo.Season, epsInfo.Episode)
+			s.log.Infoln("SubHD Not Find Sub can be download", epsInfo.Title, epsInfo.Season, epsInfo.Episode)
 		}
 		}
 	}
 	}
 	// 全季的字幕列表,也拼进去,后面进行下载
 	// 全季的字幕列表,也拼进去,后面进行下载

+ 1 - 1
sub_supplier/zimuku/zimuku.go

@@ -214,7 +214,7 @@ func (s Supplier) whichEpisodeNeedDownloadSub(seriesInfo *common.SeriesInfo, All
 			value[0].Episode = epsInfo.Episode
 			value[0].Episode = epsInfo.Episode
 			subInfoNeedDownload = append(subInfoNeedDownload, value[0])
 			subInfoNeedDownload = append(subInfoNeedDownload, value[0])
 		} else {
 		} else {
-			s.log.Infoln("Not Find Sub can be download", epsInfo.Title, epsInfo.Season, epsInfo.Episode)
+			s.log.Infoln("ZiMuKu Not Find Sub can be download", epsInfo.Title, epsInfo.Season, epsInfo.Episode)
 		}
 		}
 	}
 	}
 	// 全季的字幕列表,也拼进去,后面进行下载
 	// 全季的字幕列表,也拼进去,后面进行下载