-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
35 lines (30 loc) · 1.07 KB
/
main.go
File metadata and controls
35 lines (30 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
"fmt"
"net/http"
"github.com/jqtmviyu/iinaServer/internal/config"
"github.com/jqtmviyu/iinaServer/internal/httpapi"
"github.com/jqtmviyu/iinaServer/internal/review"
"github.com/jqtmviyu/iinaServer/internal/session"
)
func main() {
cfg := config.ParseFlags()
store := review.NewStore(20)
sessions := session.NewManager()
mux := http.NewServeMux()
handler := httpapi.Handler{
Store: store,
DirectPlay: newDirectPlayHandler(cfg, store, sessions),
EmbyPlay: newEmbyPlayHandler(cfg, store, sessions),
Stop: newStopHandler(store, sessions),
}
handler.Register(mux)
fmt.Printf("服务已启动,监听在 :%s 端口...\n", cfg.Port)
fmt.Printf("需要修改端口使用 -port=xxx 参数\n")
fmt.Println("通过 http://localhost:" + cfg.Port + "/play?video=xxx&subtitle=xxx 播放视频")
fmt.Println("健康检查: http://localhost:" + cfg.Port + "/healthz")
fmt.Println("最近一次 review: http://localhost:" + cfg.Port + "/v1/review/sessions/latest")
if err := http.ListenAndServe(":"+cfg.Port, mux); err != nil {
panic(err)
}
}