u
This commit is contained in:
parent
4b107ea59f
commit
6bfd2d8736
6
main.go
6
main.go
@ -38,7 +38,9 @@ func input() {
|
||||
os.Exit(0)
|
||||
case "list":
|
||||
list := GlobalStreamer.GetVideoListPath()
|
||||
log.Println(strings.Join(list, "\n"))
|
||||
log.Println("\nvideo list:\n", strings.Join(list, "\n"))
|
||||
case "current":
|
||||
log.Println("current video: ", GlobalStreamer.GetCurrentVideo())
|
||||
default:
|
||||
log.Println("unknown command")
|
||||
}
|
||||
@ -73,10 +75,12 @@ func startWatcher() {
|
||||
}
|
||||
if event.Op&fsnotify.Create == fsnotify.Create {
|
||||
if utils.IsSupportedVideo(event.Name) {
|
||||
log.Println("new video added:", event.Name)
|
||||
GlobalStreamer.Add(event.Name)
|
||||
}
|
||||
}
|
||||
if event.Op&fsnotify.Remove == fsnotify.Remove {
|
||||
log.Println("video removed:", event.Name)
|
||||
GlobalStreamer.Remove(event.Name)
|
||||
}
|
||||
case err, ok := <-watcher.Errors:
|
||||
|
@ -161,6 +161,10 @@ func (s *Streamer) start() {
|
||||
|
||||
<-s.ctx.Done()
|
||||
log.Printf("stop stream: %s", videoPath)
|
||||
|
||||
if currentVideo == s.videoList[s.currentVideoIndex] {
|
||||
s.Next()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Streamer) Stop() {
|
||||
@ -169,7 +173,6 @@ func (s *Streamer) Stop() {
|
||||
go func() {
|
||||
done <- s.cmd.Wait()
|
||||
}()
|
||||
|
||||
s.cancel()
|
||||
s.mu.Lock()
|
||||
if s.cmd != nil && s.cmd.Process != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user