Prevent invalid date tag in video file from aborting scan (#836)

* Give more context when ffprobe fails
* Suppress JSONTime unmarshal error
* Tidy scan logging
This commit is contained in:
WithoutPants
2020-10-11 12:02:41 +11:00
committed by GitHub
parent ca14859339
commit 98dda782aa
4 changed files with 24 additions and 15 deletions

View File

@@ -47,10 +47,6 @@ func (t *ScanTask) scanGallery() {
return
}
ok, err := utils.IsZipFileUncompressed(t.FilePath)
if err == nil && !ok {
logger.Warnf("%s is using above store (0) level compression.", t.FilePath)
}
checksum, err := t.calculateChecksum()
if err != nil {
logger.Error(err.Error())
@@ -82,6 +78,12 @@ func (t *ScanTask) scanGallery() {
// don't create gallery if it has no images
if newGallery.CountFiles() > 0 {
// only warn when creating the gallery
ok, err := utils.IsZipFileUncompressed(t.FilePath)
if err == nil && !ok {
logger.Warnf("%s is using above store (0) level compression.", t.FilePath)
}
logger.Infof("%s doesn't exist. Creating new item...", t.FilePath)
_, err = qb.Create(newGallery, tx)
}
@@ -251,7 +253,7 @@ func (t *ScanTask) scanScene() {
var checksum string
logger.Infof("%s not found. Calculating oshash...", t.FilePath)
logger.Infof("%s not found. Calculating oshash...", t.FilePath)
oshash, err := utils.OSHashFromFilePath(t.FilePath)
if err != nil {
logger.Error(err.Error())
@@ -289,9 +291,9 @@ func (t *ScanTask) scanScene() {
if scene != nil {
exists, _ := utils.FileExists(scene.Path)
if exists {
logger.Infof("%s already exists. Duplicate of %s ", t.FilePath, scene.Path)
logger.Infof("%s already exists. Duplicate of %s", t.FilePath, scene.Path)
} else {
logger.Infof("%s already exists. Updating path...", t.FilePath)
logger.Infof("%s already exists. Updating path...", t.FilePath)
scenePartial := models.ScenePartial{
ID: scene.ID,
Path: &t.FilePath,
@@ -299,7 +301,7 @@ func (t *ScanTask) scanScene() {
_, err = qb.Update(scenePartial, tx)
}
} else {
logger.Infof("%s doesn't exist. Creating new item...", t.FilePath)
logger.Infof("%s doesn't exist. Creating new item...", t.FilePath)
currentTime := time.Now()
newScene := models.Scene{
Checksum: sql.NullString{String: checksum, Valid: checksum != ""},
@@ -342,7 +344,6 @@ func (t *ScanTask) makeScreenshots(probeResult *ffmpeg.VideoFile, checksum strin
normalExists, _ := utils.FileExists(normalPath)
if thumbExists && normalExists {
logger.Debug("Screenshots already exist for this path... skipping")
return
}