mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-10-29 17:18:43 +08:00
feature (thumbnail): video thumbnail plugin
up until now, the stance was to refuse video thumbnail because it's too slow but really many people don't seem to care that much about it and keep insisting to have it. With this solution, it's not in the base build but it gives an option for those people to make it happen
This commit is contained in:
@ -32,14 +32,19 @@ var (
|
||||
)
|
||||
|
||||
func init() {
|
||||
ffmpegIsInstalled := false
|
||||
ffprobeIsInstalled := false
|
||||
if _, err := exec.LookPath("ffmpeg"); err == nil {
|
||||
ffmpegIsInstalled = true
|
||||
if _, err := exec.LookPath("ffmpeg"); err != nil {
|
||||
Hooks.Register.Onload(func() {
|
||||
Log.Warning("plg_video_thumbnail::init error=ffmpeg_not_installed")
|
||||
})
|
||||
return
|
||||
}
|
||||
if _, err := exec.LookPath("ffprobe"); err == nil {
|
||||
ffprobeIsInstalled = true
|
||||
if _, err := exec.LookPath("ffprobe"); err != nil {
|
||||
Hooks.Register.Onload(func() {
|
||||
Log.Warning("plg_video_thumbnail::init error=ffprobe_not_installed")
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
plugin_enable = func() bool {
|
||||
return Config.Get("features.video.enable_transcoder").Schema(func(f *FormElement) *FormElement {
|
||||
if f == nil {
|
||||
@ -50,9 +55,6 @@ func init() {
|
||||
f.Target = []string{"transcoding_blacklist_format"}
|
||||
f.Description = "Enable/Disable on demand video transcoding. The transcoder"
|
||||
f.Default = true
|
||||
if ffmpegIsInstalled == false || ffprobeIsInstalled == false {
|
||||
f.Default = false
|
||||
}
|
||||
return f
|
||||
}).Bool()
|
||||
}
|
||||
@ -80,13 +82,6 @@ func init() {
|
||||
cachePath := GetAbsolutePath(VideoCachePath)
|
||||
os.RemoveAll(cachePath)
|
||||
os.MkdirAll(cachePath, os.ModePerm)
|
||||
if ffmpegIsInstalled == false {
|
||||
Log.Warning("[plugin video transcoder] ffmpeg needs to be installed")
|
||||
return
|
||||
} else if ffprobeIsInstalled == false {
|
||||
Log.Warning("[plugin video transcoder] ffprobe needs to be installed")
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
Hooks.Register.HttpEndpoint(func(r *mux.Router, app *App) error {
|
||||
|
||||
Reference in New Issue
Block a user