mirror of
https://github.com/stashapp/stash.git
synced 2026-04-23 23:41:38 +02:00
configurable sprite width
This commit is contained in:
parent
8830de78eb
commit
807501b4b7
7 changed files with 32 additions and 7 deletions
|
|
@ -189,6 +189,8 @@ input ConfigGeneralInput {
|
|||
spriteInterval: Int
|
||||
"Minimum number of sprites to be generated"
|
||||
minimumSprites: Int
|
||||
"Width of each sprite in pixels"
|
||||
spriteScreenshotWidth: Int
|
||||
}
|
||||
|
||||
type ConfigGeneralResult {
|
||||
|
|
@ -296,6 +298,8 @@ type ConfigGeneralResult {
|
|||
spriteInterval: Int!
|
||||
"Minimum number of sprites to be generated"
|
||||
minimumSprites: Int!
|
||||
"Width of the each sprite in pixels"
|
||||
spriteScreenshotWidth: Int!
|
||||
"Array of video file extensions"
|
||||
videoExtensions: [String!]!
|
||||
"Array of image file extensions"
|
||||
|
|
|
|||
|
|
@ -289,6 +289,7 @@ func (r *mutationResolver) ConfigureGeneral(ctx context.Context, input ConfigGen
|
|||
}
|
||||
r.setConfigInt(config.SpriteInterval, input.SpriteInterval)
|
||||
r.setConfigInt(config.MinimumSprites, input.MinimumSprites)
|
||||
r.setConfigInt(config.SpriteScreenshotWidth, input.SpriteScreenshotWidth)
|
||||
|
||||
r.setConfigBool(config.TranscodeHardwareAcceleration, input.TranscodeHardwareAcceleration)
|
||||
if input.MaxTranscodeSize != nil {
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ func makeConfigGeneralResult() *ConfigGeneralResult {
|
|||
VideoFileNamingAlgorithm: config.GetVideoFileNamingAlgorithm(),
|
||||
ParallelTasks: config.GetParallelTasks(),
|
||||
SpriteInterval: config.GetSpriteInterval(),
|
||||
SpriteScreenshotWidth: config.GetSpriteScreenshotWidth(),
|
||||
MinimumSprites: config.GetMinimumSprites(),
|
||||
PreviewAudio: config.GetPreviewAudio(),
|
||||
PreviewSegments: config.GetPreviewSegments(),
|
||||
|
|
|
|||
|
|
@ -89,6 +89,9 @@ const (
|
|||
MinimumSprites = "minimum_sprites"
|
||||
MinimumSpritesDefault = 10
|
||||
|
||||
SpriteScreenshotWidth = "sprite_screenshot_width"
|
||||
spriteScreenshotWidthDefault = 160
|
||||
|
||||
PreviewPreset = "preview_preset"
|
||||
TranscodeHardwareAcceleration = "ffmpeg.hardware_acceleration"
|
||||
|
||||
|
|
@ -989,7 +992,7 @@ func (i *Config) GetSpriteInterval() int {
|
|||
return value
|
||||
}
|
||||
|
||||
// GetMinimumSprites return the minimum number of sprites that have to be generated
|
||||
// GetMinimumSprites returns the minimum number of sprites that have to be generated
|
||||
func (i *Config) GetMinimumSprites() int {
|
||||
value := i.getInt(MinimumSprites)
|
||||
if value <= 0 {
|
||||
|
|
@ -998,6 +1001,16 @@ func (i *Config) GetMinimumSprites() int {
|
|||
return value
|
||||
}
|
||||
|
||||
// GetSpriteScreenshotWidth returns the required width of the screenshots to be taken
|
||||
// during sprite generation in pixels
|
||||
func (i *Config) GetSpriteScreenshotWidth() int {
|
||||
value := i.getInt(SpriteScreenshotWidth)
|
||||
if value <= 0 {
|
||||
return spriteScreenshotWidthDefault
|
||||
}
|
||||
return value
|
||||
}
|
||||
|
||||
func (i *Config) GetPreviewAudio() bool {
|
||||
return i.getBool(PreviewAudio)
|
||||
}
|
||||
|
|
@ -1879,6 +1892,7 @@ func (i *Config) setDefaultValues() {
|
|||
|
||||
i.setDefault(SpriteInterval, SpriteIntervalDefault)
|
||||
i.setDefault(MinimumSprites, MinimumSpritesDefault)
|
||||
i.setDefault(SpriteScreenshotWidth, spriteScreenshotWidthDefault)
|
||||
|
||||
i.setDefault(ThemeColor, DefaultThemeColor)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,16 +11,13 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/disintegration/imaging"
|
||||
"github.com/stashapp/stash/internal/manager/config"
|
||||
"github.com/stashapp/stash/pkg/ffmpeg"
|
||||
"github.com/stashapp/stash/pkg/ffmpeg/transcoder"
|
||||
"github.com/stashapp/stash/pkg/fsutil"
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
)
|
||||
|
||||
const (
|
||||
spriteScreenshotWidth = 160
|
||||
)
|
||||
|
||||
func (g Generator) SpriteScreenshot(ctx context.Context, input string, seconds float64) (image.Image, error) {
|
||||
lockCtx := g.LockManager.ReadLock(ctx, input)
|
||||
defer lockCtx.Cancel()
|
||||
|
|
@ -28,7 +25,7 @@ func (g Generator) SpriteScreenshot(ctx context.Context, input string, seconds f
|
|||
ssOptions := transcoder.ScreenshotOptions{
|
||||
OutputPath: "-",
|
||||
OutputType: transcoder.ScreenshotOutputTypeBMP,
|
||||
Width: spriteScreenshotWidth,
|
||||
Width: config.GetInstance().GetSpriteScreenshotWidth(),
|
||||
}
|
||||
|
||||
args := transcoder.ScreenshotTime(input, seconds, ssOptions)
|
||||
|
|
@ -43,7 +40,7 @@ func (g Generator) SpriteScreenshotSlow(ctx context.Context, input string, frame
|
|||
ssOptions := transcoder.ScreenshotOptions{
|
||||
OutputPath: "-",
|
||||
OutputType: transcoder.ScreenshotOutputTypeBMP,
|
||||
Width: spriteScreenshotWidth,
|
||||
Width: config.GetInstance().GetSpriteScreenshotWidth(),
|
||||
}
|
||||
|
||||
args := transcoder.ScreenshotFrame(input, frame, ssOptions)
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ fragment ConfigGeneralData on ConfigGeneralResult {
|
|||
logFileMaxSize
|
||||
spriteInterval
|
||||
minimumSprites
|
||||
spriteScreenshotWidth
|
||||
createGalleriesFromFolders
|
||||
galleryCoverRegex
|
||||
videoExtensions
|
||||
|
|
|
|||
|
|
@ -442,6 +442,13 @@ export const SettingsConfigurationPanel: React.FC = () => {
|
|||
value={general.minimumSprites ?? 10}
|
||||
onChange={(v) => saveGeneral({ minimumSprites: v })}
|
||||
/>
|
||||
<NumberSetting
|
||||
id="sprite-screenshot-width"
|
||||
headingID=/*"config.general.include_audio_head"todo*/"Sprite width"
|
||||
subHeadingID=/*"config.general.include_audio_desc"*/"todo: explain"
|
||||
value={general.spriteScreenshotWidth ?? 160}
|
||||
onChange={(v) => saveGeneral({ spriteScreenshotWidth: v })}
|
||||
/>
|
||||
</SettingSection>
|
||||
|
||||
<SettingSection headingID="config.general.heatmap_generation">
|
||||
|
|
|
|||
Loading…
Reference in a new issue