mirror of https://github.com/stashapp/stash.git
Bug fixes
This commit is contained in:
parent
0472f9a8ed
commit
47e788ad64
|
@ -19,6 +19,7 @@ type ExportTask struct {
|
|||
}
|
||||
|
||||
func (t *ExportTask) Start(wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
// @manager.total = Scene.count + Gallery.count + Performer.count + Studio.count
|
||||
|
||||
t.Mappings = &jsonschema.Mappings{}
|
||||
|
@ -36,8 +37,6 @@ func (t *ExportTask) Start(wg *sync.WaitGroup) {
|
|||
}
|
||||
|
||||
t.ExportScrapedItems(ctx)
|
||||
|
||||
wg.Done()
|
||||
}
|
||||
|
||||
func (t *ExportTask) ExportScenes(ctx context.Context) {
|
||||
|
|
|
@ -16,18 +16,18 @@ type GenerateMarkersTask struct {
|
|||
}
|
||||
|
||||
func (t *GenerateMarkersTask) Start(wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
|
||||
instance.Paths.Generated.EmptyTmpDir()
|
||||
qb := models.NewSceneMarkerQueryBuilder()
|
||||
sceneMarkers, _ := qb.FindBySceneID(t.Scene.ID, nil)
|
||||
if len(sceneMarkers) == 0 {
|
||||
wg.Done()
|
||||
return
|
||||
}
|
||||
|
||||
videoFile, err := ffmpeg.NewVideoFile(instance.Paths.FixedPaths.FFProbe, t.Scene.Path)
|
||||
if err != nil {
|
||||
logger.Errorf("error reading video file: %s", err.Error())
|
||||
wg.Done()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,4 @@ func (t *GenerateMarkersTask) Start(wg *sync.WaitGroup) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
wg.Done()
|
||||
}
|
||||
|
|
|
@ -13,39 +13,35 @@ type GeneratePreviewTask struct {
|
|||
}
|
||||
|
||||
func (t *GeneratePreviewTask) Start(wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
|
||||
videoFilename := t.videoFilename()
|
||||
imageFilename := t.imageFilename()
|
||||
if t.doesPreviewExist(videoFilename, imageFilename) {
|
||||
wg.Done()
|
||||
if t.doesPreviewExist(t.Scene.Checksum) {
|
||||
return
|
||||
}
|
||||
|
||||
videoFile, err := ffmpeg.NewVideoFile(instance.Paths.FixedPaths.FFProbe, t.Scene.Path)
|
||||
if err != nil {
|
||||
logger.Errorf("error reading video file: %s", err.Error())
|
||||
wg.Done()
|
||||
return
|
||||
}
|
||||
|
||||
generator, err := NewPreviewGenerator(*videoFile, videoFilename, imageFilename, instance.Paths.Generated.Screenshots)
|
||||
if err != nil {
|
||||
logger.Errorf("error creating preview generator: %s", err.Error())
|
||||
wg.Done()
|
||||
return
|
||||
}
|
||||
|
||||
if err := generator.Generate(); err != nil {
|
||||
logger.Errorf("error generating preview: %s", err.Error())
|
||||
wg.Done()
|
||||
return
|
||||
}
|
||||
|
||||
wg.Done()
|
||||
}
|
||||
|
||||
func (t *GeneratePreviewTask) doesPreviewExist(videoFilename string, imageFilename string) bool {
|
||||
videoExists, _ := utils.FileExists(instance.Paths.Scene.GetStreamPreviewPath(videoFilename))
|
||||
imageExists, _ := utils.FileExists(instance.Paths.Scene.GetStreamPreviewImagePath(imageFilename))
|
||||
func (t *GeneratePreviewTask) doesPreviewExist(sceneChecksum string) bool {
|
||||
videoExists, _ := utils.FileExists(instance.Paths.Scene.GetStreamPreviewPath(sceneChecksum))
|
||||
imageExists, _ := utils.FileExists(instance.Paths.Scene.GetStreamPreviewImagePath(sceneChecksum))
|
||||
return videoExists && imageExists
|
||||
}
|
||||
|
||||
|
|
|
@ -13,15 +13,15 @@ type GenerateSpriteTask struct {
|
|||
}
|
||||
|
||||
func (t *GenerateSpriteTask) Start(wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
|
||||
if t.doesSpriteExist(t.Scene.Checksum) {
|
||||
wg.Done()
|
||||
return
|
||||
}
|
||||
|
||||
videoFile, err := ffmpeg.NewVideoFile(instance.Paths.FixedPaths.FFProbe, t.Scene.Path)
|
||||
if err != nil {
|
||||
logger.Errorf("error reading video file: %s", err.Error())
|
||||
wg.Done()
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -30,17 +30,13 @@ func (t *GenerateSpriteTask) Start(wg *sync.WaitGroup) {
|
|||
generator, err := NewSpriteGenerator(*videoFile, imagePath, vttPath, 9, 9)
|
||||
if err != nil {
|
||||
logger.Errorf("error creating sprite generator: %s", err.Error())
|
||||
wg.Done()
|
||||
return
|
||||
}
|
||||
|
||||
if err := generator.Generate(); err != nil {
|
||||
logger.Errorf("error generating sprite: %s", err.Error())
|
||||
wg.Done()
|
||||
return
|
||||
}
|
||||
|
||||
wg.Done()
|
||||
}
|
||||
|
||||
func (t *GenerateSpriteTask) doesSpriteExist(sceneChecksum string) bool {
|
||||
|
|
|
@ -20,9 +20,12 @@ type ImportTask struct {
|
|||
}
|
||||
|
||||
func (t *ImportTask) Start(wg *sync.WaitGroup) {
|
||||
defer wg.Done()
|
||||
|
||||
t.Mappings, _ = instance.JSON.getMappings()
|
||||
if t.Mappings == nil {
|
||||
panic("missing mappings json")
|
||||
logger.Error("missing mappings json")
|
||||
return
|
||||
}
|
||||
scraped, _ := instance.JSON.getScraped()
|
||||
if scraped == nil {
|
||||
|
@ -41,8 +44,6 @@ func (t *ImportTask) Start(wg *sync.WaitGroup) {
|
|||
|
||||
t.ImportScrapedItems(ctx)
|
||||
t.ImportScenes(ctx)
|
||||
|
||||
wg.Done()
|
||||
}
|
||||
|
||||
func (t *ImportTask) ImportPerformers(ctx context.Context) {
|
||||
|
@ -231,6 +232,7 @@ func (t *ImportTask) ImportTags(ctx context.Context) {
|
|||
for i, mappingJSON := range t.Mappings.Scenes {
|
||||
index := i + 1
|
||||
if mappingJSON.Checksum == "" || mappingJSON.Path == "" {
|
||||
_ = tx.Rollback()
|
||||
logger.Warn("[tags] scene mapping without checksum or path: ", mappingJSON)
|
||||
return
|
||||
}
|
||||
|
@ -350,6 +352,7 @@ func (t *ImportTask) ImportScenes(ctx context.Context) {
|
|||
for i, mappingJSON := range t.Mappings.Scenes {
|
||||
index := i + 1
|
||||
if mappingJSON.Checksum == "" || mappingJSON.Path == "" {
|
||||
_ = tx.Rollback()
|
||||
logger.Warn("[scenes] scene mapping without checksum or path: ", mappingJSON)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ func EnsureDir(path string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// TODO test
|
||||
func RemoveDir(path string) error {
|
||||
return os.RemoveAll(path)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue