diff --git a/CHANGELOG.md b/CHANGELOG.md index 0597251..2a3d272 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ # Voodio Change Log All notable changes to this project will be documented in this file. +## [1.3.1] +- 26d7df7 Added IP server information +- 6b82771 Merge tag 'v1.3.0' into develop + ## [1.3.0] - ee2927b Update readme - ca46c1f Merge branch 'master' of github.com:slaveofcode/voodio into develop diff --git a/README.md b/README.md index c224cc4..c7f0702 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,11 @@ Go to the prebuilt binary on the [release section here](https://github.com/slave // run the binary with path to the parent of video directories from your module binary path // options for port and ffmpeg-bin are optional - ~/go/bin/voodio -port 8080 -tmdb-key -ffmpeg-bin /usr/bin/ffmpeg -path /path/to/videos/dir -resolution 720p -resolution 480p + GOPATH/bin/voodio -port 8080 -tmdb-key -ffmpeg-bin /path/to/ffmpeg -path /path/to/videos -resolution 720p -resolution 480p -If the configuration and steps above is complete, you can heads up to http://[your-ip-host-or-localhost]:8080 on your browser to start watching. +If the configuration and steps above is complete, you can heads up to http://[your-ip-host-or-localhost]:8080 on your browser to start select the movie and generate HLS first before starting to watch. -### Running Options +### Options - `-path` The full path of the video directory - `-tmdb-key` API key of TMDB, you can grab one at [Official TMDB API](https://www.themoviedb.org/documentation/api) @@ -40,7 +40,6 @@ If the configuration and steps above is complete, you can heads up to http://[yo - `-ffmpeg-bin` (optional) The path of FFmpeg binary, if you have a different path of FFmpeg - `-resolution` (optional) By default the program will produce 4 resolution (360p, 480p, 720p and 1080p), this option can be supplied multiple times - ### Screenshot diff --git a/main.go b/main.go index 36870be..fed4c10 100644 --- a/main.go +++ b/main.go @@ -3,10 +3,12 @@ package main import ( "context" "flag" + "net" "net/http" "os" "os/signal" "path/filepath" + "strconv" "strings" "time" @@ -187,7 +189,8 @@ func main() { }() log.Infoln("Activate API Server") - log.Infoln("Server is alive on port", *serverPort) + log.Infoln("Server is alive") + showIPServer(*serverPort) if err = webServer.ListenAndServe(); err != nil && err != http.ErrServerClosed { log.Errorln("Unable to start server on port", *serverPort) } @@ -199,6 +202,18 @@ func main() { log.Infoln("Server closed") } +func showIPServer(port int) { + addrs, _ := net.InterfaceAddrs() + + for _, a := range addrs { + if ipnet, ok := a.(*net.IPNet); ok { + if ipnet.IP.To4() != nil { + log.Infoln("http://" + ipnet.IP.String() + ":" + strconv.Itoa(port)) + } + } + } +} + func saveMovies(dbConn *gorm.DB, movies []collections.MovieDirInfo) { for _, movie := range movies { dirName := filepath.Base(movie.Dir)