From 6517e9552c2dabe310cdb2c3a90a2fa5ab01b741 Mon Sep 17 00:00:00 2001 From: freearhey Date: Sat, 20 Feb 2021 15:47:41 +0300 Subject: [PATCH] Update generate.js --- scripts/generate.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/generate.js b/scripts/generate.js index 6c6a0af262..369483ecd5 100644 --- a/scripts/generate.js +++ b/scripts/generate.js @@ -67,20 +67,19 @@ function generateCountryIndex() { const filename = `${ROOT_DIR}/index.country.m3u` utils.createFile(filename, '#EXTM3U\n') - const channels = db.channels.sortBy(['name', 'url']).forCountry({ code: null }).get() - for (const channel of channels) { + const unsorted = db.playlists.only(['unsorted'])[0] + for (const channel of unsorted.channels) { const category = channel.category channel.category = '' utils.appendToFile(filename, channel.toString()) channel.category = category } - const countries = db.countries.sortBy(['name']).all() - for (const country of countries) { - const channels = db.channels.sortBy(['name', 'url']).forCountry(country).get() - for (const channel of channels) { + const playlists = db.playlists.sortBy(['country']).except(['unsorted']) + for (const playlist of playlists) { + for (const channel of playlist.channels) { const category = channel.category - channel.category = country.name + channel.category = playlist.country utils.appendToFile(filename, channel.toString()) channel.category = category }