diff --git a/scripts/commands/update-readme.js b/scripts/commands/update-readme.js index 641dfc6e..8fca31d1 100644 --- a/scripts/commands/update-readme.js +++ b/scripts/commands/update-readme.js @@ -9,6 +9,11 @@ const options = program .parse(process.argv) .opts() +const statuses = { + 0: '🟒', + 1: 'πŸ”΄' +} + async function main() { await api.countries.load() await api.subdivisions.load() @@ -33,14 +38,15 @@ async function generateCountriesTable(items = []) { flag: country.flag, name: country.name, channels: item.count, - epg: `https://iptv-org.github.io/epg/guides/${item.group}.epg.xml` + epg: `https://iptv-org.github.io/epg/guides/${item.group}.epg.xml`, + status: statuses[item.status] }) } rows = _.orderBy(rows, ['name', 'channels'], ['asc', 'desc']) rows = _.groupBy(rows, 'name') - const table = markdown.createTable(rows, ['Country', 'Channels', 'EPG']) + const table = markdown.createTable(rows, ['Country', 'Channels', 'EPG', 'Status']) await file.create('./.readme/_countries.md', table) } @@ -57,14 +63,15 @@ async function generateUSStatesTable(items = []) { rows.push({ name: state.name, channels: item.count, - epg: `https://iptv-org.github.io/epg/guides/${item.group}.epg.xml` + epg: `https://iptv-org.github.io/epg/guides/${item.group}.epg.xml`, + status: statuses[item.status] }) } rows = _.orderBy(rows, ['name', 'channels'], ['asc', 'desc']) rows = _.groupBy(rows, 'name') - const table = markdown.createTable(rows, ['State', 'Channels', 'EPG']) + const table = markdown.createTable(rows, ['State', 'Channels', 'EPG', 'Status']) await file.create('./.readme/_us-states.md', table) } @@ -81,14 +88,15 @@ async function generateCanadaProvincesTable(items = []) { rows.push({ name: province.name, channels: item.count, - epg: `https://iptv-org.github.io/epg/guides/${item.group}.epg.xml` + epg: `https://iptv-org.github.io/epg/guides/${item.group}.epg.xml`, + status: statuses[item.status] }) } rows = _.orderBy(rows, ['name', 'channels'], ['asc', 'desc']) rows = _.groupBy(rows, 'name') - const table = markdown.createTable(rows, ['Province', 'Channels', 'EPG']) + const table = markdown.createTable(rows, ['Province', 'Channels', 'EPG', 'Status']) await file.create('./.readme/_ca-provinces.md', table) } diff --git a/scripts/core/markdown.js b/scripts/core/markdown.js index 8d7d8750..3d735b18 100644 --- a/scripts/core/markdown.js +++ b/scripts/core/markdown.js @@ -24,6 +24,7 @@ markdown.createTable = function (data, cols) { } output += `${item.channels}` output += `${item.epg}` + output += `${item.status}` output += '\n' } } diff --git a/tests/__data__/expected/readme.md b/tests/__data__/expected/readme.md index c408129f..66277c4f 100644 --- a/tests/__data__/expected/readme.md +++ b/tests/__data__/expected/readme.md @@ -11,12 +11,12 @@ To load a program guide, all you need to do is copy the link to one or more of t - + - - - + + +
CountryChannelsEPG
CountryChannelsEPGStatus
πŸ‡ΏπŸ‡¦ South Africa1https://iptv-org.github.io/epg/guides/za/dstv.com.epg.xml
πŸ‡ΊπŸ‡Έ United States372https://iptv-org.github.io/epg/guides/us/tvtv.us.epg.xml
74https://iptv-org.github.io/epg/guides/us/magticom.ge.epg.xml
πŸ‡ΏπŸ‡¦ South Africa1https://iptv-org.github.io/epg/guides/za/dstv.com.epg.xml🟒
πŸ‡ΊπŸ‡Έ United States372https://iptv-org.github.io/epg/guides/us/tvtv.us.epg.xml🟒
74https://iptv-org.github.io/epg/guides/us/magticom.ge.epg.xml🟒
@@ -25,12 +25,12 @@ To load a program guide, all you need to do is copy the link to one or more of t - + - - - + + +
StateChannelsEPG
StateChannelsEPGStatus
Puerto Rico14https://iptv-org.github.io/epg/guides/us-pr/tvtv.us.epg.xml
7https://iptv-org.github.io/epg/guides/us-pr/gatotv.com.epg.xml
1https://iptv-org.github.io/epg/guides/us-pr/directv.com.epg.xml
Puerto Rico14https://iptv-org.github.io/epg/guides/us-pr/tvtv.us.epg.xml🟒
7https://iptv-org.github.io/epg/guides/us-pr/gatotv.com.epg.xmlπŸ”΄
0https://iptv-org.github.io/epg/guides/us-pr/directv.com.epg.xml🟒
@@ -39,10 +39,10 @@ To load a program guide, all you need to do is copy the link to one or more of t - + - +
ProvinceChannelsEPG
ProvinceChannelsEPGStatus
Newfoundland and Labrador1https://iptv-org.github.io/epg/guides/ca-nl/tvtv.us.epg.xml
Newfoundland and Labrador1https://iptv-org.github.io/epg/guides/ca-nl/tvtv.us.epg.xml🟒
diff --git a/tests/__data__/input/logs/update-guides.log b/tests/__data__/input/logs/update-guides.log index 39141054..d71cf47e 100644 --- a/tests/__data__/input/logs/update-guides.log +++ b/tests/__data__/input/logs/update-guides.log @@ -1,7 +1,7 @@ -{"group":"us/magticom.ge","count":74} -{"group":"za/dstv.com","count":1} -{"group":"us-pr/tvtv.us","count":14} -{"group":"us-pr/gatotv.com","count":7} -{"group":"us-pr/directv.com","count":1} -{"group":"ca-nl/tvtv.us","count":1} -{"group":"us/tvtv.us","count":372} +{"group":"us/magticom.ge","count":74,"status":0} +{"group":"za/dstv.com","count":1,"status":0} +{"group":"us-pr/tvtv.us","count":14,"status":0} +{"group":"us-pr/gatotv.com","count":7,"status":1} +{"group":"us-pr/directv.com","count":0,"status":0} +{"group":"ca-nl/tvtv.us","count":1,"status":0} +{"group":"us/tvtv.us","count":372,"status":0}