Skip to content

Commit

Permalink
插入数据库的时候将填写 isMovie 字段信息
Browse files Browse the repository at this point in the history
Signed-off-by: allan716 <525223688@qq.com>
  • Loading branch information
allanpk716 committed Jun 10, 2022
1 parent 829bc43 commit da3c682
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -522,6 +522,7 @@ func (s *ScanPlayedVideoSubInfo) dealOneVideo(index int, videoFPath, orgSubFPath
subRelPath,
extraSubPreName,
saveSHA256String,
isMovie,
)
oneVideoSubInfo.IsSend = false

Expand Down
4 changes: 2 additions & 2 deletions internal/models/low_video_sub_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ type LowVideoSubInfo struct {
IsSend bool `json:"is_send"` // 是否已经发送
}

func NewLowVideoSubInfo(imdbID, tmdbID, feature string, subName string, languageISO string, isDouble bool, chineseISO string, myLanguage string, storeFPath string, extraPreName string, sha256String string) *LowVideoSubInfo {
return &LowVideoSubInfo{IMDBID: imdbID, TMDBID: tmdbID, Feature: feature, SubName: subName, LanguageISO: languageISO, IsDouble: isDouble, ChineseISO: chineseISO, MyLanguage: myLanguage, StoreRPath: storeFPath, ExtraPreName: extraPreName, SHA256: sha256String}
func NewLowVideoSubInfo(imdbID, tmdbID, feature string, subName string, languageISO string, isDouble bool, chineseISO string, myLanguage string, storeFPath string, extraPreName string, sha256String string, IsMovie bool) *LowVideoSubInfo {
return &LowVideoSubInfo{IMDBID: imdbID, TMDBID: tmdbID, Feature: feature, SubName: subName, LanguageISO: languageISO, IsDouble: isDouble, ChineseISO: chineseISO, MyLanguage: myLanguage, StoreRPath: storeFPath, ExtraPreName: extraPreName, SHA256: sha256String, IsMovie: IsMovie}
}
4 changes: 2 additions & 2 deletions internal/models/video_sub_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ type VideoSubInfo struct {
IMDBInfoID string `json:"imdb_info_id" binding:"required"` // IMDB ID
}

func NewVideoSubInfo(feature string, subName string, languageISO string, isDouble bool, chineseISO string, myLanguage string, storeFPath string, extraPreName string, sha256String string) *VideoSubInfo {
return &VideoSubInfo{Feature: feature, SubName: subName, LanguageISO: languageISO, IsDouble: isDouble, ChineseISO: chineseISO, MyLanguage: myLanguage, StoreRPath: storeFPath, ExtraPreName: extraPreName, SHA256: sha256String}
func NewVideoSubInfo(feature string, subName string, languageISO string, isDouble bool, chineseISO string, myLanguage string, storeFPath string, extraPreName string, sha256String string, IsMovie bool) *VideoSubInfo {
return &VideoSubInfo{Feature: feature, SubName: subName, LanguageISO: languageISO, IsDouble: isDouble, ChineseISO: chineseISO, MyLanguage: myLanguage, StoreRPath: storeFPath, ExtraPreName: extraPreName, SHA256: sha256String, IsMovie: IsMovie}
}
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ func (v *VideoScanAndRefreshHelper) scanLowVideoSubInfo(scanVideoResult *ScanVid
for _, orgSubFPath := range subSha256Map {
v.log.Infoln(orgSubFPath)
// 需要得到这个视频对应的字幕的绝对地址
v.addLowVideoSubInfo(0, 0, orgSubFPath, mixMediaInfo, shareRootDir, fileHash)
v.addLowVideoSubInfo(true, 0, 0, orgSubFPath, mixMediaInfo, shareRootDir, fileHash)
}
}

Expand Down Expand Up @@ -438,7 +438,7 @@ func (v *VideoScanAndRefreshHelper) scanLowVideoSubInfo(scanVideoResult *ScanVid
for _, orgSubFPath := range subSha256Map {
v.log.Infoln(orgSubFPath)
// 需要得到这个视频对应的字幕的绝对地址
v.addLowVideoSubInfo(episodeInfo.Season, episodeInfo.Episode, orgSubFPath, mixMediaInfo, shareRootDir, fileHash)
v.addLowVideoSubInfo(false, episodeInfo.Season, episodeInfo.Episode, orgSubFPath, mixMediaInfo, shareRootDir, fileHash)
}
}
}
Expand All @@ -448,7 +448,7 @@ func (v *VideoScanAndRefreshHelper) scanLowVideoSubInfo(scanVideoResult *ScanVid
}

// 从绝对字幕路径和 mixMediaInfo 信息判断是否需要存储这个低可信度的字幕
func (v *VideoScanAndRefreshHelper) addLowVideoSubInfo(Season, Eps int, orgSubFPath string, mixMediaInfo *models.MediaInfo, shareRootDir string, fileHash string) {
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)
Expand Down Expand Up @@ -515,6 +515,7 @@ func (v *VideoScanAndRefreshHelper) addLowVideoSubInfo(Season, Eps int, orgSubFP
subRelPath,
extraSubPreName,
saveSHA256String,
isMovie,
)

oneLowVideoSubInfo.Season = Season
Expand Down

0 comments on commit da3c682

Please sign in to comment.