mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Feature: Add trash support (#6237)
This commit is contained in:
@@ -21,6 +21,7 @@ type FileDeleter struct {
|
||||
}
|
||||
|
||||
// MarkGeneratedFiles marks for deletion the generated files for the provided scene.
|
||||
// Generated files bypass trash and are permanently deleted since they can be regenerated.
|
||||
func (d *FileDeleter) MarkGeneratedFiles(scene *models.Scene) error {
|
||||
sceneHash := scene.GetHash(d.FileNamingAlgo)
|
||||
|
||||
@@ -32,7 +33,7 @@ func (d *FileDeleter) MarkGeneratedFiles(scene *models.Scene) error {
|
||||
|
||||
exists, _ := fsutil.FileExists(markersFolder)
|
||||
if exists {
|
||||
if err := d.Dirs([]string{markersFolder}); err != nil {
|
||||
if err := d.DirsWithoutTrash([]string{markersFolder}); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -75,11 +76,12 @@ func (d *FileDeleter) MarkGeneratedFiles(scene *models.Scene) error {
|
||||
files = append(files, heatmapPath)
|
||||
}
|
||||
|
||||
return d.Files(files)
|
||||
return d.FilesWithoutTrash(files)
|
||||
}
|
||||
|
||||
// MarkMarkerFiles deletes generated files for a scene marker with the
|
||||
// provided scene and timestamp.
|
||||
// Generated files bypass trash and are permanently deleted since they can be regenerated.
|
||||
func (d *FileDeleter) MarkMarkerFiles(scene *models.Scene, seconds int) error {
|
||||
videoPath := d.Paths.SceneMarkers.GetVideoPreviewPath(scene.GetHash(d.FileNamingAlgo), seconds)
|
||||
imagePath := d.Paths.SceneMarkers.GetWebpPreviewPath(scene.GetHash(d.FileNamingAlgo), seconds)
|
||||
@@ -102,7 +104,7 @@ func (d *FileDeleter) MarkMarkerFiles(scene *models.Scene, seconds int) error {
|
||||
files = append(files, screenshotPath)
|
||||
}
|
||||
|
||||
return d.Files(files)
|
||||
return d.FilesWithoutTrash(files)
|
||||
}
|
||||
|
||||
// Destroy deletes a scene and its associated relationships from the
|
||||
|
||||
Reference in New Issue
Block a user