Skip to content

Commit

Permalink
Add support for /play urls
Browse files Browse the repository at this point in the history
  • Loading branch information
tefinger committed Jul 6, 2021
1 parent 2166ac3 commit 5f8b49a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/server/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (c *Config) xtreamRoutes(r *gin.RouterGroup) {
r.GET(fmt.Sprintf("/series/%s/%s/:id", c.User, c.Password), c.xtreamStreamSeries)
r.GET(fmt.Sprintf("/hlsr/:token/%s/%s/:channel/:hash/:chunk", c.User, c.Password), c.xtreamHlsrStream)
r.GET("/hls/:token/:chunk", c.xtreamHlsStream)
r.GET("/play/:hash/ts", c.xtreamHlsStream)
r.GET("/play/:hash/:type", c.xtreamStreamPlay)
}

func (c *Config) m3uRoutes(r *gin.RouterGroup) {
Expand Down
12 changes: 12 additions & 0 deletions pkg/server/xtreamHandles.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,18 @@ func (c *Config) xtreamStreamLive(ctx *gin.Context) {
c.xtreamStream(ctx, rpURL)
}

func (c *Config) xtreamStreamPlay(ctx *gin.Context) {
hash := ctx.Param("hash")
t := ctx.Param("type")
rpURL, err := url.Parse(fmt.Sprintf("%s/play/%s/%s", c.XtreamBaseURL, hash, t))
if err != nil {
ctx.AbortWithError(http.StatusInternalServerError, err) // nolint: errcheck
return
}

c.xtreamStream(ctx, rpURL)
}

func (c *Config) xtreamStreamTimeshift(ctx *gin.Context) {
duration := ctx.Param("duration")
start := ctx.Param("start")
Expand Down

0 comments on commit 5f8b49a

Please sign in to comment.