Skip to content

Commit

Permalink
Merge pull request #12 from tunarrtv/main
Browse files Browse the repository at this point in the history
support tvg-chno
  • Loading branch information
evoactivity authored Sep 8, 2024
2 parents 565f082 + ed57222 commit e5a141a
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rotten-fans-tap.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@iptv/playlist": minor
---

Adds support for the tv-chno field
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export type M3uChannel = {
tvgLogo?: string;
tvgUrl?: string;
tvgRec?: string;
tvgChno?: string;
groupTitle?: string;
url?: string;
name?: string;
Expand Down
1 change: 1 addition & 0 deletions src/writer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ function writeM3U(playlist: M3uPlaylist) {
if (channel.tvgLanguage) m3u += ` tvg-language="${channel.tvgLanguage}"`;
if (channel.tvgLogo) m3u += ` tvg-logo="${channel.tvgLogo}"`;
if (channel.tvgRec) m3u += ` tvg-rec="${channel.tvgRec}"`;
if (channel.tvgChno) m3u += ` tvg-chno="${channel.tvgChno}"`;
if (channel.groupTitle) m3u += ` group-title="${channel.groupTitle}"`;
if (channel.tvgUrl) m3u += ` tvg-url="${channel.tvgUrl}"`;
if (channel.timeshift) m3u += ` timeshift="${channel.timeshift}"`;
Expand Down
2 changes: 1 addition & 1 deletion tests/__snapshots__/main.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ http://server:port/channel2"

exports[`Write a m3u file > Write a m3u file every attribute 1`] = `
"#EXTM3U x-tvg-url=\\"http://example.com\\"
#EXTINF:-1 tvg-id=\\"channel1.uk\\" tvg-name=\\"Channel 1\\" tvg-language=\\"English\\" tvg-logo=\\"http://example.com/logo.png\\" tvg-rec=\\"default\\" group-title=\\"News\\" tvg-url=\\"http://example.com\\" timeshift=\\"1\\" catchup=\\"default\\" catchup-days=\\"7\\" catchup-source=\\"http://example.com\\" some-other-key=\\"hello\\",Channel 1
#EXTINF:-1 tvg-id=\\"channel1.uk\\" tvg-name=\\"Channel 1\\" tvg-language=\\"English\\" tvg-logo=\\"http://example.com/logo.png\\" tvg-rec=\\"default\\" tvg-chno=\\"1\\" group-title=\\"News\\" tvg-url=\\"http://example.com\\" timeshift=\\"1\\" catchup=\\"default\\" catchup-days=\\"7\\" catchup-source=\\"http://example.com\\" some-other-key=\\"hello\\",Channel 1
http://server:port/channel1"
`;

Expand Down
1 change: 1 addition & 0 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ describe("Write a m3u file", () => {
tvgLogo: "http://example.com/logo.png",
tvgUrl: "http://example.com",
tvgRec: "default",
tvgChno: "1",
groupTitle: "News",
url: "http://server:port/channel1",
name: "Channel 1",
Expand Down

0 comments on commit e5a141a

Please sign in to comment.