From cd22d4b244d75c1efd4921875501a0dc511869c4 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Jacquier Date: Fri, 15 Nov 2019 12:07:28 +0000 Subject: [PATCH] Add get_simple_data_table Signed-off-by: Pierre-Emmanuel Jacquier <15922119+pierre-emmanuelJ@users.noreply.github.com> --- pkg/routes/xtream.go | 15 +++++++++++++++ pkg/xtream-proxy/xtream-proxy.go | 1 + 2 files changed, 16 insertions(+) diff --git a/pkg/routes/xtream.go b/pkg/routes/xtream.go index 09e58b4..66f7548 100644 --- a/pkg/routes/xtream.go +++ b/pkg/routes/xtream.go @@ -9,6 +9,7 @@ import ( "net/http" "net/url" "path/filepath" + "strconv" "strings" "sync" "time" @@ -199,6 +200,20 @@ func (p *proxy) xtreamPlayerAPI(c *gin.Context, q url.Values) { } respBody, err = client.GetSeriesInfo(q["series_id"][0]) case xtreamapi.GetShortEPG: + if len(q["stream_id"]) < 1 { + c.AbortWithError(http.StatusBadRequest, fmt.Errorf(`bad body url query parameters: missing "stream_id"`)) + return + } + limit := 0 + if len(q["limit"][0]) > 0 { + limit, err = strconv.Atoi(q["limit"][0]) + if err != nil { + c.AbortWithError(http.StatusInternalServerError, err) + return + } + } + respBody, err = client.GetShortEPG(q["stream_id"][0], limit) + case xtreamapi.GetSimpleDataTable: if len(q["stream_id"]) < 1 { c.AbortWithError(http.StatusBadRequest, fmt.Errorf(`bad body url query parameters: missing "stream_id"`)) return diff --git a/pkg/xtream-proxy/xtream-proxy.go b/pkg/xtream-proxy/xtream-proxy.go index 3709a2a..cd69bb3 100644 --- a/pkg/xtream-proxy/xtream-proxy.go +++ b/pkg/xtream-proxy/xtream-proxy.go @@ -14,6 +14,7 @@ const ( GetSeries = "get_series" GetSerieInfo = "get_series_info" GetShortEPG = "get_short_epg" + GetSimpleDataTable = "get_simple_data_table" ) type Client struct {