fix linter errror
use correct videopath on reindex after upload
This commit is contained in:
		@@ -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
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user