Calculate and print job totals for scan and generate tasks (#188)

* Calculate and print job totals for scan and generate tasks

* Cosmetic print fixes
This commit is contained in:
bnkai
2019-11-15 19:23:58 +02:00
committed by Leopere
parent 4a5d2bd6e5
commit 5c0ec39db1
4 changed files with 113 additions and 1 deletions

View File

@@ -75,3 +75,27 @@ func (t *GenerateMarkersTask) Start(wg *sync.WaitGroup) {
}
}
}
func (t *GenerateMarkersTask) isMarkerNeeded() int {
markers := 0
qb := models.NewSceneMarkerQueryBuilder()
sceneMarkers, _ := qb.FindBySceneID(t.Scene.ID, nil)
if len(sceneMarkers) == 0 {
return 0
}
for _, sceneMarker := range sceneMarkers {
seconds := int(sceneMarker.Seconds)
videoPath := instance.Paths.SceneMarkers.GetStreamPath(t.Scene.Checksum, seconds)
imagePath := instance.Paths.SceneMarkers.GetStreamPreviewImagePath(t.Scene.Checksum, seconds)
videoExists, _ := utils.FileExists(videoPath)
imageExists, _ := utils.FileExists(imagePath)
if (!videoExists) || (!imageExists) {
markers++
}
}
return markers
}