From ffb2d8ed5cef23141926c6215e660f56cc301c27 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Jacquier <15922119+pierre-emmanuelJ@users.noreply.github.com> Date: Tue, 11 Jan 2022 13:10:58 +0100 Subject: [PATCH] go.xtream-codes: bump version (FlexType fix) (#106) Signed-off-by: Pierre-Emmanuel Jacquier <15922119+pierre-emmanuelJ@users.noreply.github.com> --- go.mod | 5 +- go.sum | 26 ++- pkg/xtream-proxy/xtream-proxy.go | 6 +- .../tellytv/go.xtream-codes/flex_types.go | 143 ++++++++++++ .../tellytv/go.xtream-codes/structs.go | 218 ++++-------------- .../tellytv/go.xtream-codes/xtream-codes.go | 2 +- .../x/text/unicode/norm/tables10.0.0.go | 1 + .../x/text/unicode/norm/tables11.0.0.go | 1 + .../x/text/unicode/norm/tables12.0.0.go | 1 + .../x/text/unicode/norm/tables13.0.0.go | 1 + .../x/text/unicode/norm/tables9.0.0.go | 1 + vendor/modules.txt | 8 +- 12 files changed, 218 insertions(+), 195 deletions(-) create mode 100644 vendor/github.com/tellytv/go.xtream-codes/flex_types.go diff --git a/go.mod b/go.mod index 943f71ea..5bf2cdd2 100644 --- a/go.mod +++ b/go.mod @@ -6,11 +6,10 @@ require ( github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jamesnetherton/m3u v0.1.1-0.20180924175816-16741c7f081c github.com/mitchellh/go-homedir v1.1.0 - github.com/onsi/gomega v1.7.1 // indirect github.com/satori/go.uuid v1.2.0 github.com/spf13/cobra v1.2.1 github.com/spf13/viper v1.8.1 - github.com/tellytv/go.xtream-codes v0.0.0-20190427212115-45e8162ba888 + github.com/tellytv/go.xtream-codes v0.0.0-20220110144747-b72d9dcb3195 ) require ( @@ -37,7 +36,7 @@ require ( github.com/ugorji/go/codec v1.1.7 // indirect golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 // indirect golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect - golang.org/x/text v0.3.5 // indirect + golang.org/x/text v0.3.6 // indirect google.golang.org/protobuf v1.26.0 // indirect gopkg.in/ini.v1 v1.62.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index ca851061..a3624c09 100644 --- a/go.sum +++ b/go.sum @@ -90,6 +90,7 @@ github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD87 github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -229,9 +230,15 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/gomega v1.7.1 h1:K0jcRCwNQM3vFGh1ppMtDh/+7ApJrjldlX8fA0jDTLQ= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= @@ -275,8 +282,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/tellytv/go.xtream-codes v0.0.0-20190427212115-45e8162ba888 h1:AvoYr+NW3npUjbVjBMihfM699o+xlG6N5ftA+xEjurE= -github.com/tellytv/go.xtream-codes v0.0.0-20190427212115-45e8162ba888/go.mod h1:gWtQ2uZJ49dBh4cWiFuz7Tb5ALxLB9hY1GFoz34lsGs= +github.com/tellytv/go.xtream-codes v0.0.0-20220110144747-b72d9dcb3195 h1:Tm9sCv8fesKxX+NIfkbZPn6otBK+7lWWiz0czAf4sw8= +github.com/tellytv/go.xtream-codes v0.0.0-20220110144747-b72d9dcb3195/go.mod h1:8fbwWl4BCtFxxEhTTAqzjN11aC5TKWdc3yHlH/iXORo= github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181209151446-772ced7fd4c2/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= @@ -369,6 +376,7 @@ golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/ golang.org/x/net v0.0.0-20200501053045-e0ff5e5a1de5/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -380,8 +388,9 @@ golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= -golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781 h1:DzZ89McO9/gWPsQXS/FVKAlG02ZjaQ6AlZRBimEYOd0= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -418,8 +427,10 @@ golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -441,6 +452,7 @@ golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -448,6 +460,7 @@ golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -457,8 +470,9 @@ golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -509,6 +523,7 @@ golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82u golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= @@ -635,6 +650,7 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pkg/xtream-proxy/xtream-proxy.go b/pkg/xtream-proxy/xtream-proxy.go index df6afab0..1e88337f 100644 --- a/pkg/xtream-proxy/xtream-proxy.go +++ b/pkg/xtream-proxy/xtream-proxy.go @@ -80,10 +80,10 @@ func (c *Client) login(proxyUser, proxyPassword, proxyURL string, proxyPort int, }, ServerInfo: xtream.ServerInfo{ URL: proxyURL, - Port: proxyPort, - HTTPSPort: proxyPort, + Port: xtream.FlexInt(proxyPort), + HTTPSPort: xtream.FlexInt(proxyPort), Protocol: protocol, - RTMPPort: proxyPort, + RTMPPort: xtream.FlexInt(proxyPort), Timezone: c.ServerInfo.Timezone, TimestampNow: c.ServerInfo.TimestampNow, TimeNow: c.ServerInfo.TimeNow, diff --git a/vendor/github.com/tellytv/go.xtream-codes/flex_types.go b/vendor/github.com/tellytv/go.xtream-codes/flex_types.go new file mode 100644 index 00000000..63b2812f --- /dev/null +++ b/vendor/github.com/tellytv/go.xtream-codes/flex_types.go @@ -0,0 +1,143 @@ +package xtreamcodes + +import ( + "bytes" + "encoding/json" + "fmt" + "strconv" + "strings" + "time" +) + +// Timestamp is a helper struct to convert unix timestamp ints and strings to time.Time. +type Timestamp struct { + time.Time + quoted bool +} + +// MarshalJSON returns the Unix timestamp as a string. +func (t Timestamp) MarshalJSON() ([]byte, error) { + if t.quoted { + return []byte(`"` + strconv.FormatInt(t.Time.Unix(), 10) + `"`), nil + } + return []byte(strconv.FormatInt(t.Time.Unix(), 10)), nil +} + +// UnmarshalJSON converts the int or string to a Unix timestamp. +func (t *Timestamp) UnmarshalJSON(b []byte) error { + // Timestamps are sometimes quoted, sometimes not, lets just always remove quotes just in case... + t.quoted = strings.Contains(string(b), `"`) + ts, err := strconv.Atoi(strings.Replace(string(b), `"`, "", -1)) + if err != nil { + return err + } + t.Time = time.Unix(int64(ts), 0) + return nil +} + +// ConvertibleBoolean is a helper type to allow JSON documents using 0/1 or "true" and "false" be converted to bool. +type ConvertibleBoolean struct { + bool + quoted bool +} + +// MarshalJSON returns a 0 or 1 depending on bool state. +func (bit ConvertibleBoolean) MarshalJSON() ([]byte, error) { + var bitSetVar int8 + if bit.bool { + bitSetVar = 1 + } + + if bit.quoted { + return json.Marshal(fmt.Sprint(bitSetVar)) + } + + return json.Marshal(bitSetVar) +} + +// UnmarshalJSON converts a 0, 1, true or false into a bool +func (bit *ConvertibleBoolean) UnmarshalJSON(data []byte) error { + bit.quoted = strings.Contains(string(data), `"`) + // Bools as ints are sometimes quoted, sometimes not, lets just always remove quotes just in case... + asString := strings.Replace(string(data), `"`, "", -1) + if asString == "1" || asString == "true" { + bit.bool = true + } else if asString == "0" || asString == "false" { + bit.bool = false + } else { + return fmt.Errorf("Boolean unmarshal error: invalid input %s", asString) + } + return nil +} + +// FlexInt is a int64 which unmarshals from JSON +// as either unquoted or quoted (with any amount +// of internal leading/trailing whitespace). +// Originally found at https://bit.ly/2NkJ0SK and +// https://play.golang.org/p/KNPxDL1yqL +type FlexInt int64 + +func (f FlexInt) MarshalJSON() ([]byte, error) { + return json.Marshal(int64(f)) +} + +func (f *FlexInt) UnmarshalJSON(data []byte) error { + var v int64 + + data = bytes.Trim(data, `" `) + + err := json.Unmarshal(data, &v) + *f = FlexInt(v) + return err +} + +type FlexFloat float64 + +func (ff *FlexFloat) UnmarshalJSON(b []byte) error { + if b[0] != '"' { + return json.Unmarshal(b, (*float64)(ff)) + } + + var s string + if err := json.Unmarshal(b, &s); err != nil { + return err + } + + if len(s) == 0 { + s = "0" + } + + f, err := strconv.ParseFloat(s, 64) + if err != nil { + f = 0 + } + *ff = FlexFloat(f) + return nil +} + +// JSONStringSlice is a struct containing a slice of strings. +// It is needed for cases in which we may get an array or may get +// a single string in a JSON response. +type JSONStringSlice struct { + Slice []string `json:"-"` + SingleString bool `json:"-"` +} + +// MarshalJSON returns b as the JSON encoding of b. +func (b JSONStringSlice) MarshalJSON() ([]byte, error) { + if !b.SingleString { + return json.Marshal(b.Slice) + } + return json.Marshal(b.Slice[0]) +} + +// UnmarshalJSON sets *b to a copy of data. +func (b *JSONStringSlice) UnmarshalJSON(data []byte) error { + if data[0] == '"' { + data = append([]byte(`[`), data...) + data = append(data, []byte(`]`)...) + b.SingleString = true + } + + return json.Unmarshal(data, &b.Slice) +} diff --git a/vendor/github.com/tellytv/go.xtream-codes/structs.go b/vendor/github.com/tellytv/go.xtream-codes/structs.go index eb055fe8..833689de 100644 --- a/vendor/github.com/tellytv/go.xtream-codes/structs.go +++ b/vendor/github.com/tellytv/go.xtream-codes/structs.go @@ -1,102 +1,14 @@ package xtreamcodes -import ( - "bytes" - "encoding/json" - "fmt" - "strconv" - "strings" - "time" -) - -// Timestamp is a helper struct to convert unix timestamp ints and strings to time.Time. -type Timestamp struct { - time.Time - quoted bool -} - -// MarshalJSON returns the Unix timestamp as a string. -func (t Timestamp) MarshalJSON() ([]byte, error) { - if t.quoted { - return []byte(`"` + strconv.FormatInt(t.Time.Unix(), 10) + `"`), nil - } - return []byte(strconv.FormatInt(t.Time.Unix(), 10)), nil -} - -// UnmarshalJSON converts the int or string to a Unix timestamp. -func (t *Timestamp) UnmarshalJSON(b []byte) error { - // Timestamps are sometimes quoted, sometimes not, lets just always remove quotes just in case... - t.quoted = strings.Contains(string(b), `"`) - ts, err := strconv.Atoi(strings.Replace(string(b), `"`, "", -1)) - if err != nil { - return err - } - t.Time = time.Unix(int64(ts), 0) - return nil -} - -// ConvertibleBoolean is a helper type to allow JSON documents using 0/1 or "true" and "false" be converted to bool. -type ConvertibleBoolean struct { - bool - quoted bool -} - -// MarshalJSON returns a 0 or 1 depending on bool state. -func (bit ConvertibleBoolean) MarshalJSON() ([]byte, error) { - var bitSetVar int8 - if bit.bool { - bitSetVar = 1 - } - - if bit.quoted { - return json.Marshal(fmt.Sprint(bitSetVar)) - } - - return json.Marshal(bitSetVar) -} - -// UnmarshalJSON converts a 0, 1, true or false into a bool -func (bit *ConvertibleBoolean) UnmarshalJSON(data []byte) error { - bit.quoted = strings.Contains(string(data), `"`) - // Bools as ints are sometimes quoted, sometimes not, lets just always remove quotes just in case... - asString := strings.Replace(string(data), `"`, "", -1) - if asString == "1" || asString == "true" { - bit.bool = true - } else if asString == "0" || asString == "false" { - bit.bool = false - } else { - return fmt.Errorf("Boolean unmarshal error: invalid input %s", asString) - } - return nil -} - -// jsonInt is a int64 which unmarshals from JSON -// as either unquoted or quoted (with any amount -// of internal leading/trailing whitespace). -// Originally found at https://bit.ly/2NkJ0SK and -// https://play.golang.org/p/KNPxDL1yqL -type jsonInt int64 - -func (f jsonInt) MarshalJSON() ([]byte, error) { - return json.Marshal(int64(f)) -} - -func (f *jsonInt) UnmarshalJSON(data []byte) error { - var v int64 - - data = bytes.Trim(data, `" `) - - err := json.Unmarshal(data, &v) - *f = jsonInt(v) - return err -} +// TODO: Add more flex types on IDs if needed +// for future potential provider issues. // ServerInfo describes the state of the Xtream-Codes server. type ServerInfo struct { - HTTPSPort int `json:"https_port,string"` - Port int `json:"port,string"` + HTTPSPort FlexInt `json:"https_port,string"` + Port FlexInt `json:"port,string"` Process bool `json:"process"` - RTMPPort int `json:"rtmp_port,string"` + RTMPPort FlexInt `json:"rtmp_port,string"` Protocol string `json:"server_protocol"` TimeNow string `json:"time_now"` TimestampNow Timestamp `json:"timestamp_now,string"` @@ -106,13 +18,13 @@ type ServerInfo struct { // UserInfo is the current state of the user as it relates to the Xtream-Codes server. type UserInfo struct { - ActiveConnections int `json:"active_cons,string"` + ActiveConnections FlexInt `json:"active_cons,string"` AllowedOutputFormats []string `json:"allowed_output_formats"` Auth ConvertibleBoolean `json:"auth"` CreatedAt Timestamp `json:"created_at"` ExpDate *Timestamp `json:"exp_date"` IsTrial ConvertibleBoolean `json:"is_trial,string"` - MaxConnections int `json:"max_connections,string"` + MaxConnections FlexInt `json:"max_connections,string"` Message string `json:"message"` Password string `json:"password"` Status string `json:"status"` @@ -127,9 +39,9 @@ type AuthenticationResponse struct { // Category describes a grouping of Stream. type Category struct { - ID int `json:"category_id,string"` - Name string `json:"category_name"` - Parent int `json:"parent_id"` + ID FlexInt `json:"category_id,string"` + Name string `json:"category_name"` + Parent FlexInt `json:"parent_id"` // Set by us, not Xtream. Type string `json:"-"` @@ -138,79 +50,56 @@ type Category struct { // Stream is a streamble video source. type Stream struct { Added *Timestamp `json:"added"` - CategoryID int `json:"category_id,string"` + CategoryID FlexInt `json:"category_id,string"` + CategoryName string `json:"category_name"` ContainerExtension string `json:"container_extension"` CustomSid string `json:"custom_sid"` DirectSource string `json:"direct_source,omitempty"` EPGChannelID string `json:"epg_channel_id"` Icon string `json:"stream_icon"` - ID int `json:"stream_id"` + ID FlexInt `json:"stream_id"` Name string `json:"name"` - Number int `json:"num"` + Number FlexInt `json:"num"` Rating FlexFloat `json:"rating"` - Rating5based float64 `json:"rating_5based"` - TVArchive int `json:"tv_archive"` - TVArchiveDuration *jsonInt `json:"tv_archive_duration"` + Rating5based FlexFloat `json:"rating_5based"` + TVArchive FlexInt `json:"tv_archive"` + TVArchiveDuration *FlexInt `json:"tv_archive_duration"` Type string `json:"stream_type"` } -type FlexFloat float64 - -func (ff *FlexFloat) UnmarshalJSON(b []byte) error { - if b[0] != '"' { - return json.Unmarshal(b, (*float64)(ff)) - } - - var s string - if err := json.Unmarshal(b, &s); err != nil { - return err - } - - if len(s) == 0 { - s = "0" - } - - f, err := strconv.ParseFloat(s, 64) - if err != nil { - f = 0 - } - *ff = FlexFloat(f) - return nil -} - // SeriesInfo contains information about a TV series. type SeriesInfo struct { BackdropPath *JSONStringSlice `json:"backdrop_path,omitempty"` Cast string `json:"cast"` - CategoryID *int `json:"category_id,string"` + CategoryID *FlexInt `json:"category_id,string"` Cover string `json:"cover"` Director string `json:"director"` EpisodeRunTime string `json:"episode_run_time"` Genre string `json:"genre"` LastModified *Timestamp `json:"last_modified,omitempty"` Name string `json:"name"` - Num int `json:"num"` + Num FlexInt `json:"num"` Plot string `json:"plot"` - Rating int `json:"rating,string"` - Rating5 float64 `json:"rating_5based"` + Rating FlexInt `json:"rating,string"` + Rating5 FlexFloat `json:"rating_5based"` ReleaseDate string `json:"releaseDate"` - SeriesID int `json:"series_id"` + SeriesID FlexInt `json:"series_id"` StreamType string `json:"stream_type"` YoutubeTrailer string `json:"youtube_trailer"` } type SeriesEpisode struct { - Added string `json:"added"` - ContainerExtension string `json:"container_extension"` - CustomSid string `json:"custom_sid"` - DirectSource string `json:"direct_source"` - EpisodeNum int `json:"episode_num"` - ID string `json:"id"` + Added string `json:"added"` + ContainerExtension string `json:"container_extension"` + CustomSid string `json:"custom_sid"` + DirectSource string `json:"direct_source"` + EpisodeNum FlexInt `json:"episode_num"` + ID string `json:"id"` Info struct { Audio FFMPEGStreamInfo `json:"audio"` - Bitrate int `json:"bitrate"` + Bitrate FlexInt `json:"bitrate"` Duration string `json:"duration"` - DurationSecs int `json:"duration_secs"` + DurationSecs FlexInt `json:"duration_secs"` MovieImage string `json:"movie_image"` Name string `json:"name"` Plot string `json:"plot"` @@ -218,8 +107,8 @@ type SeriesEpisode struct { ReleaseDate string `json:"releasedate"` Video FFMPEGStreamInfo `json:"video"` } `json:"info"` - Season int `json:"season"` - Title string `json:"title"` + Season FlexInt `json:"season"` + Title string `json:"title"` } type Series struct { @@ -233,28 +122,28 @@ type VideoOnDemandInfo struct { Info struct { Audio FFMPEGStreamInfo `json:"audio"` BackdropPath []string `json:"backdrop_path"` - Bitrate int `json:"bitrate"` + Bitrate FlexInt `json:"bitrate"` Cast string `json:"cast"` Director string `json:"director"` Duration string `json:"duration"` - DurationSecs int `json:"duration_secs"` + DurationSecs FlexInt `json:"duration_secs"` Genre string `json:"genre"` MovieImage string `json:"movie_image"` Plot string `json:"plot"` - Rating string `json:"rating"` + Rating FlexFloat `json:"rating"` ReleaseDate string `json:"releasedate"` - TmdbID string `json:"tmdb_id"` + TmdbID FlexInt `json:"tmdb_id"` Video FFMPEGStreamInfo `json:"video"` YoutubeTrailer string `json:"youtube_trailer"` } `json:"info"` MovieData struct { Added Timestamp `json:"added"` - CategoryID int `json:"category_id,string"` + CategoryID FlexInt `json:"category_id,string"` ContainerExtension string `json:"container_extension"` CustomSid string `json:"custom_sid"` DirectSource string `json:"direct_source"` Name string `json:"name"` - StreamID int `json:"stream_id"` + StreamID FlexInt `json:"stream_id"` } `json:"movie_data"` } @@ -267,9 +156,9 @@ type EPGInfo struct { ChannelID string `json:"channel_id"` Description Base64Value `json:"description"` End string `json:"end"` - EPGID int `json:"epg_id,string"` + EPGID FlexInt `json:"epg_id,string"` HasArchive ConvertibleBoolean `json:"has_archive"` - ID int `json:"id,string"` + ID FlexInt `json:"id,string"` Lang string `json:"lang"` NowPlaying ConvertibleBoolean `json:"now_playing"` Start string `json:"start"` @@ -277,30 +166,3 @@ type EPGInfo struct { StopTimestamp Timestamp `json:"stop_timestamp"` Title Base64Value `json:"title"` } - -// JSONStringSlice is a struct containing a slice of strings. -// It is needed for cases in which we may get an array or may get -// a single string in a JSON response. -type JSONStringSlice struct { - Slice []string `json:"-"` - SingleString bool `json:"-"` -} - -// MarshalJSON returns b as the JSON encoding of b. -func (b JSONStringSlice) MarshalJSON() ([]byte, error) { - if !b.SingleString { - return json.Marshal(b.Slice) - } - return json.Marshal(b.Slice[0]) -} - -// UnmarshalJSON sets *b to a copy of data. -func (b *JSONStringSlice) UnmarshalJSON(data []byte) error { - if data[0] == '"' { - data = append([]byte(`[`), data...) - data = append(data, []byte(`]`)...) - b.SingleString = true - } - - return json.Unmarshal(data, &b.Slice) -} diff --git a/vendor/github.com/tellytv/go.xtream-codes/xtream-codes.go b/vendor/github.com/tellytv/go.xtream-codes/xtream-codes.go index 9065367c..0bb0cf09 100644 --- a/vendor/github.com/tellytv/go.xtream-codes/xtream-codes.go +++ b/vendor/github.com/tellytv/go.xtream-codes/xtream-codes.go @@ -187,7 +187,7 @@ func (c *XtreamClient) GetStreams(streamAction, categoryID string) ([]Stream, er } for _, stream := range streams { - c.streams[stream.ID] = stream + c.streams[int(stream.ID)] = stream } return streams, nil diff --git a/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go index 26fbd55a..f5a07882 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables10.0.0.go @@ -1,5 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +//go:build go1.10 && !go1.13 // +build go1.10,!go1.13 package norm diff --git a/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go index 2c58f09b..cb7239c4 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables11.0.0.go @@ -1,5 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +//go:build go1.13 && !go1.14 // +build go1.13,!go1.14 package norm diff --git a/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go index 7e1ae096..11b27330 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables12.0.0.go @@ -1,5 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +//go:build go1.14 && !go1.16 // +build go1.14,!go1.16 package norm diff --git a/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go index 9ea1b421..96a130d3 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables13.0.0.go @@ -1,5 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +//go:build go1.16 // +build go1.16 package norm diff --git a/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go b/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go index 94290692..0175eae5 100644 --- a/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go +++ b/vendor/golang.org/x/text/unicode/norm/tables9.0.0.go @@ -1,5 +1,6 @@ // Code generated by running "go generate" in golang.org/x/text. DO NOT EDIT. +//go:build !go1.10 // +build !go1.10 package norm diff --git a/vendor/modules.txt b/vendor/modules.txt index 3ba073f6..fff26c64 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -69,8 +69,6 @@ github.com/modern-go/concurrent # github.com/modern-go/reflect2 v1.0.1 ## explicit github.com/modern-go/reflect2 -# github.com/onsi/gomega v1.7.1 -## explicit # github.com/pelletier/go-toml v1.9.3 ## explicit; go 1.12 github.com/pelletier/go-toml @@ -99,8 +97,8 @@ github.com/spf13/viper # github.com/subosito/gotenv v1.2.0 ## explicit github.com/subosito/gotenv -# github.com/tellytv/go.xtream-codes v0.0.0-20190427212115-45e8162ba888 -## explicit +# github.com/tellytv/go.xtream-codes v0.0.0-20220110144747-b72d9dcb3195 +## explicit; go 1.17 github.com/tellytv/go.xtream-codes # github.com/ugorji/go/codec v1.1.7 ## explicit @@ -113,7 +111,7 @@ golang.org/x/crypto/sha3 golang.org/x/sys/cpu golang.org/x/sys/internal/unsafeheader golang.org/x/sys/unix -# golang.org/x/text v0.3.5 +# golang.org/x/text v0.3.6 ## explicit; go 1.11 golang.org/x/text/transform golang.org/x/text/unicode/norm