fix linter errror

use correct videopath on reindex after upload
This commit is contained in:
lukas 2021-09-23 19:45:58 +02:00
parent a92ce73806
commit afaad81849
4 changed files with 13 additions and 8 deletions

View File

@ -46,6 +46,7 @@ module.exports = {
// Map from global var to bool specifying if it can be redefined
globals: {
File: true,
FileList: true,
jest: true,
__DEV__: true,
__dirname: false,

View File

@ -54,7 +54,6 @@ func addUploadHandler() {
if err == io.EOF {
fmt.Printf("Finished uploading file %s\n", part.FileName())
videoparser.InitDeps(&mSettings)
videoparser.ProcessVideo(part.FileName())
break

View File

@ -4,6 +4,7 @@ import (
"database/sql"
"fmt"
"openmediacenter/apiGo/api/types"
"openmediacenter/apiGo/config"
"openmediacenter/apiGo/database"
"openmediacenter/apiGo/videoparser/tmdb"
"regexp"
@ -122,8 +123,10 @@ func addVideo(videoName string, fileName string, year int) {
Width: 0,
}
vidFolder := config.GetConfig().General.ReindexPrefix + mSettings.VideoPath
if mExtDepsAvailable.FFMpeg {
ppic, err = parseFFmpegPic(mSettings.VideoPath + fileName)
ppic, err = parseFFmpegPic(vidFolder + fileName)
if err != nil {
fmt.Printf("FFmpeg error occured: %s\n", err.Error())
} else {
@ -132,7 +135,7 @@ func addVideo(videoName string, fileName string, year int) {
}
if mExtDepsAvailable.MediaInfo {
atr := getVideoAttributes(mSettings.VideoPath + fileName)
atr := getVideoAttributes(vidFolder + fileName)
if atr != nil {
vidAtr = atr
}

View File

@ -3,6 +3,7 @@ package videoparser
import (
"fmt"
"io/ioutil"
"openmediacenter/apiGo/config"
"openmediacenter/apiGo/database"
"os"
"path/filepath"
@ -19,20 +20,21 @@ func StartReindex() bool {
SendEvent("start")
AppendMessage("starting reindex..")
mSettings, PathPrefix, _ := database.GetSettings()
mSettings, _, _ := database.GetSettings()
// add the path prefix to videopath
mSettings.VideoPath = PathPrefix + mSettings.VideoPath
vidFolder := config.GetConfig().General.ReindexPrefix + mSettings.VideoPath
// check if path even exists
if _, err := os.Stat(mSettings.VideoPath); os.IsNotExist(err) {
if _, err := os.Stat(vidFolder); os.IsNotExist(err) {
fmt.Println("Reindex path doesn't exist!")
AppendMessage(fmt.Sprintf("Reindex path doesn't exist! :%s", mSettings.VideoPath))
AppendMessage(fmt.Sprintf("Reindex path doesn't exist! :%s", vidFolder))
SendEvent("stop")
return false
}
var files []string
err := filepath.Walk(mSettings.VideoPath, func(path string, info os.FileInfo, err error) error {
err := filepath.Walk(vidFolder, func(path string, info os.FileInfo, err error) error {
if err != nil {
fmt.Println(err.Error())
return err