Update update.js
This commit is contained in:
		| @@ -47,15 +47,27 @@ async function createCountryTable() { | |||||||
|   logger.info('creating country table...') |   logger.info('creating country table...') | ||||||
|   const rows = [] |   const rows = [] | ||||||
|   await api.countries.load() |   await api.countries.load() | ||||||
|  |   await api.subdivisions.load() | ||||||
|   const items = await parser.parseLogs(`${LOGS_DIR}/countries.log`) |   const items = await parser.parseLogs(`${LOGS_DIR}/countries.log`) | ||||||
|   for (const item of items) { |   for (const item of items) { | ||||||
|     const code = file.getFilename(item.filepath) |     const code = file.getFilename(item.filepath) | ||||||
|     const country = await api.countries.find({ code: code.toUpperCase() }) |     const country = await api.countries.find({ code: code.toUpperCase() }) | ||||||
|  |     if (country) { | ||||||
|       rows.push({ |       rows.push({ | ||||||
|       name: country ? `${country.flag} ${country.name}` : 'Undefined', |         name: `${country.flag} ${country.name}`, | ||||||
|         channels: item.count, |         channels: item.count, | ||||||
|         playlist: `<code>https://iptv-org.github.io/iptv/${item.filepath}</code>` |         playlist: `<code>https://iptv-org.github.io/iptv/${item.filepath}</code>` | ||||||
|       }) |       }) | ||||||
|  |     } else { | ||||||
|  |       const subdivision = await api.subdivisions.find({ code: code.toUpperCase() }) | ||||||
|  |       if (subdivision) { | ||||||
|  |         rows.push({ | ||||||
|  |           name: `      ${subdivision.name}`, | ||||||
|  |           channels: item.count, | ||||||
|  |           playlist: `<code>https://iptv-org.github.io/iptv/${item.filepath}</code>` | ||||||
|  |         }) | ||||||
|  |       } | ||||||
|  |     } | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   const table = createTable(rows, [ |   const table = createTable(rows, [ | ||||||
| @@ -99,12 +111,14 @@ async function createRegionTable() { | |||||||
|   for (const item of items) { |   for (const item of items) { | ||||||
|     const code = file.getFilename(item.filepath) |     const code = file.getFilename(item.filepath) | ||||||
|     const region = await api.regions.find({ code: code.toUpperCase() }) |     const region = await api.regions.find({ code: code.toUpperCase() }) | ||||||
|  |     if (region) { | ||||||
|       rows.push({ |       rows.push({ | ||||||
|       name: region ? region.name : 'Undefined', |         name: region.name, | ||||||
|         channels: item.count, |         channels: item.count, | ||||||
|         playlist: `<code>https://iptv-org.github.io/iptv/${item.filepath}</code>` |         playlist: `<code>https://iptv-org.github.io/iptv/${item.filepath}</code>` | ||||||
|       }) |       }) | ||||||
|     } |     } | ||||||
|  |   } | ||||||
|  |  | ||||||
|   const table = createTable(rows, [ |   const table = createTable(rows, [ | ||||||
|     { name: 'Region', align: 'left' }, |     { name: 'Region', align: 'left' }, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user