Skip to content

Commit

Permalink
Release 5th Aug 2024 (#362)
Browse files Browse the repository at this point in the history
Release 5th Aug 2024
  • Loading branch information
rabilrbl authored Aug 5, 2024
2 parents 2fe3a17 + 07c9d11 commit fbf568f
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 30 deletions.
18 changes: 18 additions & 0 deletions docs/usage/iptv.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,33 @@ JioTV Go offers a convenient M3U playlist endpoint to enhance your IPTV experien
```
This will filter only the specified languages (Tamil, English and Bengali).
The playlist will be split into categories like `Movies`, `Enterntainment`, `News`, `Music`, etc. but will only contain channels in the specified languages.
Available Languages to filter `Hindi, Marathi, Punjabi, Urdu, Bengali, English, Malayalam, Tamil, Gujarati, Odia, Telugu, Bhojpuri, Kannada, Assamese, Nepali, French, Other`
5. If you would like to group the M3U playlist by language only, append the `c=language` query parameter:
```
http://localhost:5001/playlist.m3u?c=language
```
This will group the playlist by language only, like `Hindi`, `Kannada`, `Marathi`, etc.
Please note that either `c=split` or `c=language` can be used at a time.
For both specific quality and split category, append the `q=` and `c=` query parameters:
```
http://localhost:5001/playlist.m3u?q=high&c=split
```
You can also combine the language grouping and language filtering:
```
http://localhost:5001/playlist.m3u?c=language&l=Hindi,Kannada,Marathi
```
## Electronic Program Guide (EPG)
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22
require (
github.com/BurntSushi/toml v1.4.0
github.com/ilyakaznacheev/cleanenv v1.5.0
github.com/urfave/cli/v2 v2.27.2
github.com/urfave/cli/v2 v2.27.3
golang.org/x/term v0.22.0
)

Expand All @@ -17,7 +17,7 @@ require (
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/text v0.16.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
Expand All @@ -35,7 +35,7 @@ require (
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/schollz/progressbar/v3 v3.14.4
github.com/schollz/progressbar/v3 v3.14.5
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.55.0
github.com/valyala/tcplisten v1.0.0 // indirect
Expand Down
14 changes: 6 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,28 @@ github.com/rs/xid v1.5.0 h1:mKX4bl4iPYJtEIxp6CYiUuLQ/8DYMoz0PUdtGgMFRVc=
github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/schollz/progressbar/v3 v3.14.4 h1:W9ZrDSJk7eqmQhd3uxFNNcTr0QL+xuGNI9dEMrw0r74=
github.com/schollz/progressbar/v3 v3.14.4/go.mod h1:aT3UQ7yGm+2ZjeXPqsjTenwL3ddUiuZ0kfQ/2tHlyNI=
github.com/schollz/progressbar/v3 v3.14.5 h1:97RrSxbBASxQuZN9yemnyGrFZ/swnG6IrEe2R0BseX8=
github.com/schollz/progressbar/v3 v3.14.5/go.mod h1:Nrzpuw3Nl0srLY0VlTvC4V6RL50pcEymjy6qyJAaLa0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/urfave/cli/v2 v2.27.2 h1:6e0H+AkS+zDckwPCUrZkKX38mRaau4nL2uipkJpbkcI=
github.com/urfave/cli/v2 v2.27.2/go.mod h1:g0+79LmHHATl7DAcHO99smiR/T7uGLw84w8Y42x+4eM=
github.com/urfave/cli/v2 v2.27.3 h1:/POWahRmdh7uztQ3CYnaDddk0Rm90PyOgIxgW2rr41M=
github.com/urfave/cli/v2 v2.27.3/go.mod h1:m4QzxcD2qpra4z7WhzEGn74WZLViBnMpb1ToCAKdGRQ=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.55.0 h1:Zkefzgt6a7+bVKHnu/YaYSOPfNYNisSVBo/unVCf8k8=
github.com/valyala/fasthttp v1.55.0/go.mod h1:NkY9JtkrpPKmgwV3HTaS2HWaJss9RSIsRVfcxxoHiOM=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913/go.mod h1:4aEEwZQutDLsQv2Deui4iYQ6DWTxR14g6m8Wv88+Xqk=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4=
github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk=
golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
Expand Down
10 changes: 6 additions & 4 deletions internal/handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ func RenderTSHandler(c *fiber.Ctx) error {
// Also to generate M3U playlist
func ChannelsHandler(c *fiber.Ctx) error {
quality := strings.TrimSpace(c.Query("q"))
isSplitCategory := strings.TrimSpace(c.Query("c")) == "split"
splitCategory := strings.TrimSpace(c.Query("c"))
languages := strings.TrimSpace(c.Query("l"))
apiResponse := television.Channels()
// hostUrl should be request URL like http://localhost:5001
Expand All @@ -383,8 +383,10 @@ func ChannelsHandler(c *fiber.Ctx) error {
}
channelLogoURL := fmt.Sprintf("%s/%s", logoURL, channel.LogoURL)
var groupTitle string
if isSplitCategory {
if splitCategory == "split" {
groupTitle = fmt.Sprintf("%s - %s", television.CategoryMap[channel.Category], television.LanguageMap[channel.Language])
} else if splitCategory == "language" {
groupTitle = television.LanguageMap[channel.Language]
} else {
groupTitle = television.CategoryMap[channel.Category]
}
Expand Down Expand Up @@ -466,9 +468,9 @@ func FaviconHandler(c *fiber.Ctx) error {
// For user convenience, redirect to /channels?type=m3u
func PlaylistHandler(c *fiber.Ctx) error {
quality := c.Query("q")
isSplitCategory := c.Query("c")
splitCategory := c.Query("c")
languages := c.Query("l")
return c.Redirect("/channels?type=m3u&q="+quality+"&c="+isSplitCategory+"&l="+languages, fiber.StatusMovedPermanently)
return c.Redirect("/channels?type=m3u&q="+quality+"&c="+splitCategory+"&l="+languages, fiber.StatusMovedPermanently)
}

// ImageHandler loads image from JioTV server
Expand Down
8 changes: 6 additions & 2 deletions pkg/epg/epg.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func Init() {
}

// NewProgramme creates a new Programme with the given parameters.
func NewProgramme(channelID int, start, stop, title, desc, iconSrc string) Programme {
func NewProgramme(channelID int, start, stop, title, desc, category, iconSrc string) Programme {
iconURL := fmt.Sprintf("/jtvposter/%s", iconSrc)
return Programme{
Channel: fmt.Sprint(channelID),
Expand All @@ -94,6 +94,10 @@ func NewProgramme(channelID int, start, stop, title, desc, iconSrc string) Progr
Value: desc,
Lang: "en",
},
Category: Category{
Value: category,
Lang: "en",
},
Icon: Icon{
Src: iconURL,
},
Expand Down Expand Up @@ -139,7 +143,7 @@ func genXML() ([]byte, error) {
for _, programme := range epgResponse.EPG {
startTime := formatTime(time.UnixMilli(programme.StartEpoch))
endTime := formatTime(time.UnixMilli(programme.EndEpoch))
programmes = append(programmes, NewProgramme(channel.ID, startTime, endTime, programme.Title, programme.Description, programme.Poster))
programmes = append(programmes, NewProgramme(channel.ID, startTime, endTime, programme.Title, programme.Description, programme.ShowCategory, programme.Poster))
}
}
bar.Add(1)
Expand Down
23 changes: 16 additions & 7 deletions pkg/epg/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ type Title struct {
Lang string `xml:"lang,attr"` // Language of the title
}

// Category XML tag for Programme XML tag in EPG
// Category is the type of the programme or show being aired on the channel
type Category struct {
XMLName xml.Name `xml:"category"`
Value string `xml:",chardata"` // Category of the programme
Lang string `xml:"lang,attr"` // Language of the category
}

// Desc represents Description XML tag for Programme XML tag in EPG
type Desc struct {
XMLName xml.Name `xml:"desc"`
Expand All @@ -37,13 +45,14 @@ type Desc struct {
// Programme XML tag structure for EPG
// Each programme tag represents a show being aired on a channel
type Programme struct {
XMLName xml.Name `xml:"programme"` // XML tag name
Channel string `xml:"channel,attr"` // Channel is attribute of programme tag
Start string `xml:"start,attr"` // Start time of the programme
Stop string `xml:"stop,attr"` // Stop time of the programme
Title Title `xml:"title"` // Title of the programme
Desc Desc `xml:"desc"` // Description of the programme
Icon Icon `xml:"icon"` // Icon of the programme
XMLName xml.Name `xml:"programme"` // XML tag name
Channel string `xml:"channel,attr"` // Channel is attribute of programme tag
Start string `xml:"start,attr"` // Start time of the programme
Stop string `xml:"stop,attr"` // Stop time of the programme
Title Title `xml:"title"` // Title of the programme
Desc Desc `xml:"desc"` // Description of the programme
Category Category `xml:"category"` // Category of the programme
Icon Icon `xml:"icon"` // Icon of the programme
}

// EPG XML tag structure
Expand Down
8 changes: 4 additions & 4 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"devDependencies": {
"daisyui": "^4.12.10",
"tailwindcss": "^3.4.4"
"tailwindcss": "^3.4.7"
},
"scripts": {
"build": "tailwindcss build -i ./static/input.css -o ./static/tailwind.css -m",
Expand Down
2 changes: 1 addition & 1 deletion web/static/tailwind.css

Large diffs are not rendered by default.

0 comments on commit fbf568f

Please sign in to comment.