Replace os.Rename with util.SafeMove to allow cross device moving to not fail. (#745)

Fixed annoyingly noisy transcoding progress log messages.
Fixed minor minor issue with directories than are named "blah.mp4" being detected as files to be scanned.
This commit is contained in:
JoeSmithStarkers
2020-08-21 17:57:07 +10:00
committed by GitHub
parent 6a3588e4e0
commit 85aa1d8790
7 changed files with 70 additions and 14 deletions

View File

@@ -42,6 +42,11 @@ func (t *ScanTask) scanGallery() {
return
}
// Ignore directories.
if isDir, _ := utils.DirExists(t.FilePath); isDir {
return
}
ok, err := utils.IsZipFileUncompressed(t.FilePath)
if err == nil && !ok {
logger.Warnf("%s is using above store (0) level compression.", t.FilePath)
@@ -95,8 +100,9 @@ func (t *ScanTask) associateGallery(wg *sync.WaitGroup) {
qb := models.NewGalleryQueryBuilder()
gallery, _ := qb.FindByPath(t.FilePath)
if gallery == nil {
// shouldn't happen , associate is run after scan is finished
logger.Errorf("associate: gallery %s not found in DB", t.FilePath)
// associate is run after scan is finished
// should only happen if gallery is a directory or an io error occurs during hashing
logger.Warnf("associate: gallery %s not found in DB", t.FilePath)
wg.Done()
return
}
@@ -226,6 +232,11 @@ func (t *ScanTask) scanScene() {
return
}
// Ignore directories.
if isDir, _ := utils.DirExists(t.FilePath); isDir {
return
}
videoFile, err := ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath)
if err != nil {
logger.Error(err.Error())