Update update-readme.js

This commit is contained in:
Aleksandr Statciuk 2022-01-30 20:24:14 +03:00
parent 797d7d816f
commit d2e43e46fe
4 changed files with 32 additions and 23 deletions

View File

@ -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: `<code>https://iptv-org.github.io/epg/guides/${item.group}.epg.xml</code>`
epg: `<code>https://iptv-org.github.io/epg/guides/${item.group}.epg.xml</code>`,
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: `<code>https://iptv-org.github.io/epg/guides/${item.group}.epg.xml</code>`
epg: `<code>https://iptv-org.github.io/epg/guides/${item.group}.epg.xml</code>`,
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: `<code>https://iptv-org.github.io/epg/guides/${item.group}.epg.xml</code>`
epg: `<code>https://iptv-org.github.io/epg/guides/${item.group}.epg.xml</code>`,
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)
}

View File

@ -24,6 +24,7 @@ markdown.createTable = function (data, cols) {
}
output += `<td align="right">${item.channels}</td>`
output += `<td align="left" nowrap>${item.epg}</td>`
output += `<td align="center" nowrap>${item.status}</td>`
output += '</tr>\n'
}
}

View File

@ -11,12 +11,12 @@ To load a program guide, all you need to do is copy the link to one or more of t
<!-- prettier-ignore -->
<table>
<thead>
<tr><th align="left">Country</th><th align="left">Channels</th><th align="left">EPG</th></tr>
<tr><th align="left">Country</th><th align="left">Channels</th><th align="left">EPG</th><th align="left">Status</th></tr>
</thead>
<tbody>
<tr><td align="left" valign="top" nowrap>🇿🇦 South Africa</td><td align="right">1</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/za/dstv.com.epg.xml</code></td></tr>
<tr><td align="left" valign="top" nowrap rowspan="2">🇺🇸 United States</td><td align="right">372</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/us/tvtv.us.epg.xml</code></td></tr>
<tr><td align="right">74</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/us/magticom.ge.epg.xml</code></td></tr>
<tr><td align="left" valign="top" nowrap>🇿🇦 South Africa</td><td align="right">1</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/za/dstv.com.epg.xml</code></td><td align="center" nowrap>🟢</td></tr>
<tr><td align="left" valign="top" nowrap rowspan="2">🇺🇸 United States</td><td align="right">372</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/us/tvtv.us.epg.xml</code></td><td align="center" nowrap>🟢</td></tr>
<tr><td align="right">74</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/us/magticom.ge.epg.xml</code></td><td align="center" nowrap>🟢</td></tr>
</tbody>
</table>
@ -25,12 +25,12 @@ To load a program guide, all you need to do is copy the link to one or more of t
<!-- prettier-ignore -->
<table>
<thead>
<tr><th align="left">State</th><th align="left">Channels</th><th align="left">EPG</th></tr>
<tr><th align="left">State</th><th align="left">Channels</th><th align="left">EPG</th><th align="left">Status</th></tr>
</thead>
<tbody>
<tr><td align="left" valign="top" nowrap rowspan="3">Puerto Rico</td><td align="right">14</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/us-pr/tvtv.us.epg.xml</code></td></tr>
<tr><td align="right">7</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/us-pr/gatotv.com.epg.xml</code></td></tr>
<tr><td align="right">1</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/us-pr/directv.com.epg.xml</code></td></tr>
<tr><td align="left" valign="top" nowrap rowspan="3">Puerto Rico</td><td align="right">14</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/us-pr/tvtv.us.epg.xml</code></td><td align="center" nowrap>🟢</td></tr>
<tr><td align="right">7</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/us-pr/gatotv.com.epg.xml</code></td><td align="center" nowrap>🔴</td></tr>
<tr><td align="right">0</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/us-pr/directv.com.epg.xml</code></td><td align="center" nowrap>🟢</td></tr>
</tbody>
</table>
@ -39,10 +39,10 @@ To load a program guide, all you need to do is copy the link to one or more of t
<!-- prettier-ignore -->
<table>
<thead>
<tr><th align="left">Province</th><th align="left">Channels</th><th align="left">EPG</th></tr>
<tr><th align="left">Province</th><th align="left">Channels</th><th align="left">EPG</th><th align="left">Status</th></tr>
</thead>
<tbody>
<tr><td align="left" valign="top" nowrap>Newfoundland and Labrador</td><td align="right">1</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/ca-nl/tvtv.us.epg.xml</code></td></tr>
<tr><td align="left" valign="top" nowrap>Newfoundland and Labrador</td><td align="right">1</td><td align="left" nowrap><code>https://iptv-org.github.io/epg/guides/ca-nl/tvtv.us.epg.xml</code></td><td align="center" nowrap>🟢</td></tr>
</tbody>
</table>

View File

@ -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}