Skip to content

Commit

Permalink
refactor: removed gpu acceleration option
Browse files Browse the repository at this point in the history
  • Loading branch information
alxarno committed Nov 18, 2024
1 parent 0c13a6a commit fd9f165
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 41 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ GLOBAL OPTIONS:
--index-save, --is the program creates a special file in the working directory “index.tinytune”. This file stores all necessary data obtained during indexing of the working directory.
You can turn off its saving, but at the next startup, the application will start processing again (default: true)
FFmpeg:
This application uses the FFmpeg program as a tool for interacting with video files.
Make sure that it is available for calling.
--acceleration allows to utilize GPU computing power for ffmpeg (default: true)
Processing:
In order for the web interface to be able to view thumbnails of media files, as well as play them, the program needs to process them and get meta information.
This process can be long, so here are the options that will help limit the number of files to process.
Expand Down
8 changes: 0 additions & 8 deletions cmd/tinytune/tinytune.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,6 @@ func main() {
Destination: &rawConfig.MediaTimeout,
Category: ProcessingCLICategory,
},
&cli.BoolFlag{
Name: "acceleration",
Value: rawConfig.Acceleration,
Usage: "allows to utilize GPU computing power for ffmpeg",
Destination: &rawConfig.Acceleration,
Category: FFmpegCLICategory,
},
&cli.StringFlag{
Name: "streaming",
Usage: `some files cannot be played in the browser, such as flv and avi. Therefore, such files need to be transcoded.
Expand Down Expand Up @@ -241,7 +234,6 @@ func start(config internal.Config) {
previewer, err := preview.NewPreviewer(
preview.WithImage(config.Process.Image.Process),
preview.WithVideo(config.Process.Video.Process),
preview.WithAcceleration(config.Process.Acceleration),
preview.WithExcludedFiles(excludedFromPreview),
preview.WithMaxImages(config.Process.Image.MaxItems),
preview.WithMaxVideos(config.Process.Video.MaxItems),
Expand Down
33 changes: 14 additions & 19 deletions internal/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ type RawConfig struct {
Parallel int
Video bool
Images bool
Acceleration bool
MaxImages int64
MaxVideos int64
Includes string
Expand Down Expand Up @@ -53,14 +52,13 @@ func (c MediaTypeConfig) Print(name string) {
}

type ProcessConfig struct {
Parallel int
Video MediaTypeConfig
Timeout time.Duration
Image MediaTypeConfig
Acceleration bool
Includes []*regexp.Regexp
Excludes []*regexp.Regexp
MaxFileSize int64
Parallel int
Video MediaTypeConfig
Timeout time.Duration
Image MediaTypeConfig
Includes []*regexp.Regexp
Excludes []*regexp.Regexp
MaxFileSize int64
}

func (c ProcessConfig) Print() {
Expand All @@ -77,7 +75,6 @@ func (c ProcessConfig) Print() {

params := []any{
slog.Int("parallel", c.Parallel),
slog.Bool("acceleration", c.Acceleration),
}

if includes != "" {
Expand Down Expand Up @@ -136,7 +133,6 @@ func DefaultRawConfig() RawConfig {
Port: defaultPort,
Video: true,
Images: true,
Acceleration: true,
IndexFileSave: true,
MaxImages: -1,
MaxVideos: -1,
Expand All @@ -157,14 +153,13 @@ func NewConfig(raw RawConfig) Config {
Streaming: getRegularExpressions(raw.Streaming),
IndexFileSave: raw.IndexFileSave,
Process: ProcessConfig{
Timeout: getDuration(raw.MediaTimeout),
Parallel: raw.Parallel,
Video: MediaTypeConfig{raw.Video, raw.MaxVideos},
Image: MediaTypeConfig{raw.Images, raw.MaxImages},
Acceleration: raw.Acceleration,
Includes: getRegularExpressions(raw.Includes),
Excludes: getRegularExpressions(raw.Excludes),
MaxFileSize: getMaxFileSize(raw.MaxFileSize),
Timeout: getDuration(raw.MediaTimeout),
Parallel: raw.Parallel,
Video: MediaTypeConfig{raw.Video, raw.MaxVideos},
Image: MediaTypeConfig{raw.Images, raw.MaxImages},
Includes: getRegularExpressions(raw.Includes),
Excludes: getRegularExpressions(raw.Excludes),
MaxFileSize: getMaxFileSize(raw.MaxFileSize),
},
}
}
Expand Down
8 changes: 1 addition & 7 deletions pkg/preview/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,7 @@ func WithVideo(param bool) Option {
}
}

func WithAcceleration(param bool) Option {
return func(p *Previewer) {
p.acceleration = param
}
}

// files = map[FilePath]struct.
// files = map[FilePath]struct{}.
func WithExcludedFiles(files map[string]struct{}) Option {
return func(p *Previewer) {
p.excludedFiles = files
Expand Down
1 change: 0 additions & 1 deletion pkg/preview/preview.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ type Source interface {
type Previewer struct {
image bool
video bool
acceleration bool
maxImages int64
maxVideos int64
excludedFiles map[string]struct{}
Expand Down

0 comments on commit fd9f165

Please sign in to comment.