fix linter errror
use correct videopath on reindex after upload
This commit is contained in:
		@@ -46,6 +46,7 @@ module.exports = {
 | 
				
			|||||||
    // Map from global var to bool specifying if it can be redefined
 | 
					    // Map from global var to bool specifying if it can be redefined
 | 
				
			||||||
    globals: {
 | 
					    globals: {
 | 
				
			||||||
        File: true,
 | 
					        File: true,
 | 
				
			||||||
 | 
					        FileList: true,
 | 
				
			||||||
        jest: true,
 | 
					        jest: true,
 | 
				
			||||||
        __DEV__: true,
 | 
					        __DEV__: true,
 | 
				
			||||||
        __dirname: false,
 | 
					        __dirname: false,
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,7 +54,6 @@ func addUploadHandler() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
				if err == io.EOF {
 | 
									if err == io.EOF {
 | 
				
			||||||
					fmt.Printf("Finished uploading file %s\n", part.FileName())
 | 
										fmt.Printf("Finished uploading file %s\n", part.FileName())
 | 
				
			||||||
 | 
					 | 
				
			||||||
					videoparser.InitDeps(&mSettings)
 | 
										videoparser.InitDeps(&mSettings)
 | 
				
			||||||
					videoparser.ProcessVideo(part.FileName())
 | 
										videoparser.ProcessVideo(part.FileName())
 | 
				
			||||||
					break
 | 
										break
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,7 @@ import (
 | 
				
			|||||||
	"database/sql"
 | 
						"database/sql"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"openmediacenter/apiGo/api/types"
 | 
						"openmediacenter/apiGo/api/types"
 | 
				
			||||||
 | 
						"openmediacenter/apiGo/config"
 | 
				
			||||||
	"openmediacenter/apiGo/database"
 | 
						"openmediacenter/apiGo/database"
 | 
				
			||||||
	"openmediacenter/apiGo/videoparser/tmdb"
 | 
						"openmediacenter/apiGo/videoparser/tmdb"
 | 
				
			||||||
	"regexp"
 | 
						"regexp"
 | 
				
			||||||
@@ -122,8 +123,10 @@ func addVideo(videoName string, fileName string, year int) {
 | 
				
			|||||||
		Width:    0,
 | 
							Width:    0,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						vidFolder := config.GetConfig().General.ReindexPrefix + mSettings.VideoPath
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if mExtDepsAvailable.FFMpeg {
 | 
						if mExtDepsAvailable.FFMpeg {
 | 
				
			||||||
		ppic, err = parseFFmpegPic(mSettings.VideoPath + fileName)
 | 
							ppic, err = parseFFmpegPic(vidFolder + fileName)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			fmt.Printf("FFmpeg error occured: %s\n", err.Error())
 | 
								fmt.Printf("FFmpeg error occured: %s\n", err.Error())
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
@@ -132,7 +135,7 @@ func addVideo(videoName string, fileName string, year int) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if mExtDepsAvailable.MediaInfo {
 | 
						if mExtDepsAvailable.MediaInfo {
 | 
				
			||||||
		atr := getVideoAttributes(mSettings.VideoPath + fileName)
 | 
							atr := getVideoAttributes(vidFolder + fileName)
 | 
				
			||||||
		if atr != nil {
 | 
							if atr != nil {
 | 
				
			||||||
			vidAtr = atr
 | 
								vidAtr = atr
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ package videoparser
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
	"io/ioutil"
 | 
						"io/ioutil"
 | 
				
			||||||
 | 
						"openmediacenter/apiGo/config"
 | 
				
			||||||
	"openmediacenter/apiGo/database"
 | 
						"openmediacenter/apiGo/database"
 | 
				
			||||||
	"os"
 | 
						"os"
 | 
				
			||||||
	"path/filepath"
 | 
						"path/filepath"
 | 
				
			||||||
@@ -19,20 +20,21 @@ func StartReindex() bool {
 | 
				
			|||||||
	SendEvent("start")
 | 
						SendEvent("start")
 | 
				
			||||||
	AppendMessage("starting reindex..")
 | 
						AppendMessage("starting reindex..")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	mSettings, PathPrefix, _ := database.GetSettings()
 | 
						mSettings, _, _ := database.GetSettings()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// add the path prefix to videopath
 | 
						// add the path prefix to videopath
 | 
				
			||||||
	mSettings.VideoPath = PathPrefix + mSettings.VideoPath
 | 
						vidFolder := config.GetConfig().General.ReindexPrefix + mSettings.VideoPath
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// check if path even exists
 | 
						// 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!")
 | 
							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")
 | 
							SendEvent("stop")
 | 
				
			||||||
		return false
 | 
							return false
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var files []string
 | 
						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 {
 | 
							if err != nil {
 | 
				
			||||||
			fmt.Println(err.Error())
 | 
								fmt.Println(err.Error())
 | 
				
			||||||
			return err
 | 
								return err
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user