mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
[Files Refactor] Performance tuning (#2865)
* Don't load image files by default * Don't load gallery files by default * Don't load scene files by default * Retry locked transactions forever * Don't show release notes if config not loaded * Don't translate path slashes in export
This commit is contained in:
@@ -23,7 +23,7 @@ type GenerateTranscodeTask struct {
|
||||
}
|
||||
|
||||
func (t *GenerateTranscodeTask) GetDescription() string {
|
||||
return fmt.Sprintf("Generating transcode for %s", t.Scene.Path())
|
||||
return fmt.Sprintf("Generating transcode for %s", t.Scene.Path)
|
||||
}
|
||||
|
||||
func (t *GenerateTranscodeTask) Start(ctc context.Context) {
|
||||
@@ -32,11 +32,13 @@ func (t *GenerateTranscodeTask) Start(ctc context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
f := t.Scene.Files.Primary()
|
||||
|
||||
ffprobe := instance.FFProbe
|
||||
var container ffmpeg.Container
|
||||
|
||||
var err error
|
||||
container, err = GetSceneFileContainer(&t.Scene)
|
||||
container, err = GetVideoFileContainer(f)
|
||||
if err != nil {
|
||||
logger.Errorf("[transcode] error getting scene container: %s", err.Error())
|
||||
return
|
||||
@@ -44,13 +46,13 @@ func (t *GenerateTranscodeTask) Start(ctc context.Context) {
|
||||
|
||||
var videoCodec string
|
||||
|
||||
if t.Scene.VideoCodec() != "" {
|
||||
videoCodec = t.Scene.VideoCodec()
|
||||
if f.VideoCodec != "" {
|
||||
videoCodec = f.VideoCodec
|
||||
}
|
||||
|
||||
audioCodec := ffmpeg.MissingUnsupported
|
||||
if t.Scene.AudioCodec() != "" {
|
||||
audioCodec = ffmpeg.ProbeAudioCodec(t.Scene.AudioCodec())
|
||||
if f.AudioCodec != "" {
|
||||
audioCodec = ffmpeg.ProbeAudioCodec(f.AudioCodec)
|
||||
}
|
||||
|
||||
if !t.Force && ffmpeg.IsStreamable(videoCodec, audioCodec, container) == nil {
|
||||
@@ -59,7 +61,7 @@ func (t *GenerateTranscodeTask) Start(ctc context.Context) {
|
||||
|
||||
// TODO - move transcode generation logic elsewhere
|
||||
|
||||
videoFile, err := ffprobe.NewVideoFile(t.Scene.Path())
|
||||
videoFile, err := ffprobe.NewVideoFile(f.Path)
|
||||
if err != nil {
|
||||
logger.Errorf("[transcode] error reading video file: %s", err.Error())
|
||||
return
|
||||
@@ -100,6 +102,11 @@ func (t *GenerateTranscodeTask) Start(ctc context.Context) {
|
||||
// used only when counting files to generate, doesn't affect the actual transcode generation
|
||||
// if container is missing from DB it is treated as non supported in order not to delay the user
|
||||
func (t *GenerateTranscodeTask) isTranscodeNeeded() bool {
|
||||
f := t.Scene.Files.Primary()
|
||||
if f == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
hasTranscode := HasTranscode(&t.Scene, t.fileNamingAlgorithm)
|
||||
if !t.Overwrite && hasTranscode {
|
||||
return false
|
||||
@@ -110,17 +117,17 @@ func (t *GenerateTranscodeTask) isTranscodeNeeded() bool {
|
||||
}
|
||||
|
||||
var videoCodec string
|
||||
if t.Scene.VideoCodec() != "" {
|
||||
videoCodec = t.Scene.VideoCodec()
|
||||
if f.VideoCodec != "" {
|
||||
videoCodec = f.VideoCodec
|
||||
}
|
||||
container := ""
|
||||
audioCodec := ffmpeg.MissingUnsupported
|
||||
if t.Scene.AudioCodec() != "" {
|
||||
audioCodec = ffmpeg.ProbeAudioCodec(t.Scene.AudioCodec())
|
||||
if f.AudioCodec != "" {
|
||||
audioCodec = ffmpeg.ProbeAudioCodec(f.AudioCodec)
|
||||
}
|
||||
|
||||
if t.Scene.Format() != "" {
|
||||
container = t.Scene.Format()
|
||||
if f.Format != "" {
|
||||
container = f.Format
|
||||
}
|
||||
|
||||
if ffmpeg.IsStreamable(videoCodec, audioCodec, ffmpeg.Container(container)) == nil {
|
||||
|
||||
Reference in New Issue
Block a user