From 19a1141af3f1aa52c706e402af734797d5d929ff Mon Sep 17 00:00:00 2001 From: Heinrich 'Henrik' Langos Date: Mon, 16 Jan 2023 11:33:12 +0000 Subject: preserve-video-filename (#49) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This should fix issue #40 I have not made the `allowed_characters` configurable yet nor the `replacement_character`. Mostly because I couldn't decide if I should define those "globally" on a server basis, or on the library nodes. Feel free to modify, extend, rip apart. 😁 Reviewed-on: https://git.mills.io/prologic/tube/pulls/49 Co-authored-by: Heinrich 'Henrik' Langos Co-committed-by: Heinrich 'Henrik' Langos --- app/config.go | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'app/config.go') diff --git a/app/config.go b/app/config.go index 2b11688..7d886c0 100644 --- a/app/config.go +++ b/app/config.go @@ -17,17 +17,19 @@ type Config struct { // PathConfig settings for media library path. type PathConfig struct { - Path string `json:"path"` - Prefix string `json:"prefix"` + Path string `json:"path"` + Prefix string `json:"prefix"` + PreserveUploadFilename bool `json:"preserve_upload_filename,omitempty"` } // ServerConfig settings for App Server. type ServerConfig struct { - Host string `json:"host"` - Port int `json:"port"` - StorePath string `json:"store_path"` - UploadPath string `json:"upload_path"` - MaxUploadSize int64 `json:"max_upload_size"` + Host string `json:"host"` + Port int `json:"port"` + StorePath string `json:"store_path"` + UploadPath string `json:"upload_path"` + PreserveUploadFilename bool `json:"preserve_upload_filename,omitempty"` + MaxUploadSize int64 `json:"max_upload_size"` } // ThumbnailerConfig settings for Transcoder @@ -68,16 +70,18 @@ func DefaultConfig() *Config { return &Config{ Library: []*PathConfig{ &PathConfig{ - Path: "videos", - Prefix: "", + Path: "videos", + Prefix: "", + PreserveUploadFilename: false, }, }, Server: &ServerConfig{ - Host: "0.0.0.0", - Port: 8000, - StorePath: "tube.db", - UploadPath: "uploads", - MaxUploadSize: 104857600, + Host: "0.0.0.0", + Port: 8000, + StorePath: "tube.db", + UploadPath: "uploads", + PreserveUploadFilename: false, + MaxUploadSize: 104857600, }, Thumbnailer: &ThumbnailerConfig{ Timeout: 60, -- cgit v1.2.3