seperate component for file drop and upload
correct save position of uploaded files then parse video file
This commit is contained in:
@ -11,7 +11,7 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
var mSettings types.SettingsType
|
||||
var mSettings *types.SettingsType
|
||||
var mExtDepsAvailable *ExtDependencySupport
|
||||
|
||||
// default Tag ids
|
||||
@ -32,20 +32,22 @@ type VideoAttributes struct {
|
||||
Width uint
|
||||
}
|
||||
|
||||
func ReIndexVideos(path []string, sett types.SettingsType) {
|
||||
func InitDeps(sett *types.SettingsType) {
|
||||
mSettings = sett
|
||||
// check if the extern dependencies are available
|
||||
mExtDepsAvailable = checkExtDependencySupport()
|
||||
fmt.Printf("FFMPEG support: %t\n", mExtDepsAvailable.FFMpeg)
|
||||
fmt.Printf("MediaInfo support: %t\n", mExtDepsAvailable.MediaInfo)
|
||||
}
|
||||
|
||||
func ReIndexVideos(path []string) {
|
||||
// filter out those urls which are already existing in db
|
||||
nonExisting := filterExisting(path)
|
||||
|
||||
fmt.Printf("There are %d videos not existing in db.\n", len(*nonExisting))
|
||||
|
||||
for _, s := range *nonExisting {
|
||||
processVideo(s)
|
||||
ProcessVideo(s)
|
||||
}
|
||||
|
||||
AppendMessage("reindex finished successfully!")
|
||||
@ -92,8 +94,8 @@ func filterExisting(paths []string) *[]string {
|
||||
return &resultarr
|
||||
}
|
||||
|
||||
func processVideo(fileNameOrig string) {
|
||||
fmt.Printf("Processing %s video-", fileNameOrig)
|
||||
func ProcessVideo(fileNameOrig string) {
|
||||
fmt.Printf("Processing %s video\n", fileNameOrig)
|
||||
|
||||
// match the file extension
|
||||
r := regexp.MustCompile(`\.[a-zA-Z0-9]+$`)
|
||||
|
@ -49,7 +49,8 @@ func StartReindex() bool {
|
||||
}
|
||||
// start reindex process
|
||||
AppendMessage("Starting Reindexing!")
|
||||
go ReIndexVideos(files, mSettings)
|
||||
InitDeps(&mSettings)
|
||||
go ReIndexVideos(files)
|
||||
return true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user