Update generate.js
This commit is contained in:
parent
4998c24d3b
commit
6517e9552c
|
@ -67,20 +67,19 @@ function generateCountryIndex() {
|
||||||
const filename = `${ROOT_DIR}/index.country.m3u`
|
const filename = `${ROOT_DIR}/index.country.m3u`
|
||||||
utils.createFile(filename, '#EXTM3U\n')
|
utils.createFile(filename, '#EXTM3U\n')
|
||||||
|
|
||||||
const channels = db.channels.sortBy(['name', 'url']).forCountry({ code: null }).get()
|
const unsorted = db.playlists.only(['unsorted'])[0]
|
||||||
for (const channel of channels) {
|
for (const channel of unsorted.channels) {
|
||||||
const category = channel.category
|
const category = channel.category
|
||||||
channel.category = ''
|
channel.category = ''
|
||||||
utils.appendToFile(filename, channel.toString())
|
utils.appendToFile(filename, channel.toString())
|
||||||
channel.category = category
|
channel.category = category
|
||||||
}
|
}
|
||||||
|
|
||||||
const countries = db.countries.sortBy(['name']).all()
|
const playlists = db.playlists.sortBy(['country']).except(['unsorted'])
|
||||||
for (const country of countries) {
|
for (const playlist of playlists) {
|
||||||
const channels = db.channels.sortBy(['name', 'url']).forCountry(country).get()
|
for (const channel of playlist.channels) {
|
||||||
for (const channel of channels) {
|
|
||||||
const category = channel.category
|
const category = channel.category
|
||||||
channel.category = country.name
|
channel.category = playlist.country
|
||||||
utils.appendToFile(filename, channel.toString())
|
utils.appendToFile(filename, channel.toString())
|
||||||
channel.category = category
|
channel.category = category
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue