removed base64 field from Stream struct because it was unused

This commit is contained in:
BroodjeAap 2020-08-18 18:40:21 +00:00
parent e1e4df6ad5
commit 31aaa3db30

View file

@ -19,7 +19,6 @@ import (
type Stream struct { type Stream struct {
Name string `json:"name"` Name string `json:"name"`
URL string `json:"url"` URL string `json:"url"`
Base64 string `json:"base64"`
Interval int `json:"interval"` Interval int `json:"interval"`
MotionInterval int `json:"motionInterval"` MotionInterval int `json:"motionInterval"`
WatchAreas []WatchArea `json:"watchAreas"` WatchAreas []WatchArea `json:"watchAreas"`
@ -29,12 +28,10 @@ type Stream struct {
// NewStream creates a new Stream Object // NewStream creates a new Stream Object
func NewStream(Name string, URL string, Interval int, MotionInterval int) *Stream { func NewStream(Name string, URL string, Interval int, MotionInterval int) *Stream {
base64 := URLToBase64(URL)
stream := Stream{ stream := Stream{
Name: Name, Name: Name,
URL: URL, URL: URL,
Base64: base64,
Interval: Interval, Interval: Interval,
MotionInterval: MotionInterval, MotionInterval: MotionInterval,
WatchAreas: make([]WatchArea, 0), WatchAreas: make([]WatchArea, 0),
@ -200,12 +197,12 @@ func (s *Stream) WriteStreamJSON() {
_ = ioutil.WriteFile(s.GetStreamJSONPath(), file, 0644) _ = ioutil.WriteFile(s.GetStreamJSONPath(), file, 0644)
} }
// GetStreamStoreDirPath returns filepath.Join(s.GetStreamDirPath(), s.Base64) // GetStreamStoreDirPath returns filepath.Join(s.GetStreamDirPath(), s.Name)
func (s *Stream) GetStreamStoreDirPath() string { func (s *Stream) GetStreamStoreDirPath() string {
return filepath.Join(GetStreamDirPath(), s.Name) return filepath.Join(GetStreamDirPath(), s.Name)
} }
// GetPreviousInstantPath returns filepath.Join(GetStreamDirPath(), s.Base64, "previous.jpg") // GetPreviousInstantPath returns filepath.Join(GetStreamStoreDirPath(), "previous.jpg")
func (s *Stream) GetPreviousInstantPath() string { func (s *Stream) GetPreviousInstantPath() string {
return filepath.Join(s.GetStreamStoreDirPath(), "previous.jpg") return filepath.Join(s.GetStreamStoreDirPath(), "previous.jpg")
} }
@ -225,7 +222,7 @@ func (s *Stream) IMReadPrevious() gocv.Mat {
return gocv.IMRead(s.GetPreviousInstantPath(), gocv.IMReadGrayScale) return gocv.IMRead(s.GetPreviousInstantPath(), gocv.IMReadGrayScale)
} }
// GetCurrentInstantPath returns filepath.Join(s.GetStreamDirPath(), s.Base64, "current.jpg") // GetCurrentInstantPath returns filepath.Join(s.GetStreamStoreDirPath(), "current.jpg")
func (s *Stream) GetCurrentInstantPath() string { func (s *Stream) GetCurrentInstantPath() string {
return filepath.Join(s.GetStreamStoreDirPath(), "current.jpg") return filepath.Join(s.GetStreamStoreDirPath(), "current.jpg")
} }
@ -245,7 +242,7 @@ func (s *Stream) IMReadCurrent() gocv.Mat {
return gocv.IMRead(s.GetCurrentInstantPath(), gocv.IMReadGrayScale) return gocv.IMRead(s.GetCurrentInstantPath(), gocv.IMReadGrayScale)
} }
// GetCurrentColorInstantPath returns filepath.Join(s.GetStreamDirPath(), s.Base64, "current_color.jpg") // GetCurrentColorInstantPath returns filepath.Join(s.GetStreamStoreDirPath(), "current_color.jpg")
func (s *Stream) GetCurrentColorInstantPath() string { func (s *Stream) GetCurrentColorInstantPath() string {
return filepath.Join(s.GetStreamStoreDirPath(), "current_color.jpg") return filepath.Join(s.GetStreamStoreDirPath(), "current_color.jpg")
} }
@ -265,7 +262,7 @@ func (s *Stream) IMReadCurrentColor() gocv.Mat {
return gocv.IMRead(s.GetCurrentColorInstantPath(), gocv.IMReadColor) return gocv.IMRead(s.GetCurrentColorInstantPath(), gocv.IMReadColor)
} }
// GetNextInstantPath returns filepath.Join(s.GetStreamDirPath(), s.Base64, "last.jpg") // GetNextInstantPath returns filepath.Join(s.GetStreamStoreDirPath(), "last.jpg")
func (s *Stream) GetNextInstantPath() string { func (s *Stream) GetNextInstantPath() string {
return filepath.Join(s.GetStreamStoreDirPath(), "last.jpg") return filepath.Join(s.GetStreamStoreDirPath(), "last.jpg")
} }
@ -285,7 +282,7 @@ func (s *Stream) IMReadNext() gocv.Mat {
return gocv.IMRead(s.GetNextInstantPath(), gocv.IMReadGrayScale) return gocv.IMRead(s.GetNextInstantPath(), gocv.IMReadGrayScale)
} }
// GetDebugInstantPath returns filepath.Join(s.GetStreamDirPath(), s.Base64, "debug.jpg") // GetDebugInstantPath returns filepath.Join(s.GetStreamStoreDirPath(), "debug.jpg")
func (s *Stream) GetDebugInstantPath() string { func (s *Stream) GetDebugInstantPath() string {
return filepath.Join(s.GetStreamStoreDirPath(), "debug.jpg") return filepath.Join(s.GetStreamStoreDirPath(), "debug.jpg")
} }