parent
f5dc1387ce
commit
ed490849fb
|
@ -41,12 +41,10 @@ function generateIndex() {
|
|||
const info = channel.getInfo()
|
||||
if (!buffer.includes(info)) {
|
||||
utils.appendToFile(filename, channel.toString())
|
||||
if (channel.filename !== 'unsorted') {
|
||||
buffer.push(info)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateSFWIndex() {
|
||||
console.log('Generating index.sfw.m3u...')
|
||||
|
@ -59,12 +57,10 @@ function generateSFWIndex() {
|
|||
const info = channel.getInfo()
|
||||
if (!buffer.includes(info)) {
|
||||
utils.appendToFile(filename, channel.toString())
|
||||
if (channel.filename !== 'unsorted') {
|
||||
buffer.push(info)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateChannelsJson() {
|
||||
console.log('Generating channels.json...')
|
||||
|
@ -81,15 +77,19 @@ function generateCountryIndex() {
|
|||
const filename = `${ROOT_DIR}/index.country.m3u`
|
||||
utils.createFile(filename, '#EXTM3U\n')
|
||||
|
||||
const buffer = []
|
||||
const unsorted = db.playlists.only(['unsorted'])[0]
|
||||
for (const channel of unsorted.channels) {
|
||||
const category = channel.category
|
||||
channel.category = ''
|
||||
const info = channel.getInfo()
|
||||
if (!buffer.includes(info)) {
|
||||
utils.appendToFile(filename, channel.toString())
|
||||
buffer.push(info)
|
||||
}
|
||||
channel.category = category
|
||||
}
|
||||
|
||||
const buffer = []
|
||||
const playlists = db.playlists.sortBy(['country']).except(['unsorted'])
|
||||
for (const playlist of playlists) {
|
||||
for (const channel of playlist.channels) {
|
||||
|
@ -118,16 +118,13 @@ function generateLanguageIndex() {
|
|||
const info = channel.getInfo()
|
||||
if (!buffer.includes(info)) {
|
||||
utils.appendToFile(filename, channel.toString())
|
||||
if (channel.filename !== 'unsorted') {
|
||||
buffer.push(info)
|
||||
}
|
||||
}
|
||||
channel.category = category
|
||||
}
|
||||
|
||||
const languages = db.languages.sortBy(['name']).all()
|
||||
for (const language of languages) {
|
||||
const buffer = []
|
||||
const channels = db.channels.sortBy(['name', 'url']).forLanguage(language).get()
|
||||
for (const channel of channels) {
|
||||
const category = channel.category
|
||||
|
@ -153,12 +150,10 @@ function generateCategoryIndex() {
|
|||
const info = channel.getInfo()
|
||||
if (!buffer.includes(info)) {
|
||||
utils.appendToFile(filename, channel.toString())
|
||||
if (channel.filename !== 'unsorted') {
|
||||
buffer.push(info)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateCategories() {
|
||||
console.log(`Generating /categories...`)
|
||||
|
@ -175,12 +170,10 @@ function generateCategories() {
|
|||
const info = channel.getInfo()
|
||||
if (!buffer.includes(info)) {
|
||||
utils.appendToFile(filename, channel.toString())
|
||||
if (channel.filename !== 'unsorted') {
|
||||
buffer.push(info)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const buffer = []
|
||||
const other = `${outputDir}/other.m3u`
|
||||
|
@ -190,12 +183,10 @@ function generateCategories() {
|
|||
const info = channel.getInfo()
|
||||
if (!buffer.includes(info)) {
|
||||
utils.appendToFile(other, channel.toString())
|
||||
if (channel.filename !== 'unsorted') {
|
||||
buffer.push(info)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateCountries() {
|
||||
console.log(`Generating /countries...`)
|
||||
|
@ -212,12 +203,10 @@ function generateCountries() {
|
|||
const info = channel.getInfo()
|
||||
if (!buffer.includes(info)) {
|
||||
utils.appendToFile(filename, channel.toString())
|
||||
if (channel.filename !== 'unsorted') {
|
||||
buffer.push(info)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const buffer = []
|
||||
const other = `${outputDir}/undefined.m3u`
|
||||
|
@ -227,12 +216,10 @@ function generateCountries() {
|
|||
const info = channel.getInfo()
|
||||
if (!buffer.includes(info)) {
|
||||
utils.appendToFile(other, channel.toString())
|
||||
if (channel.filename !== 'unsorted') {
|
||||
buffer.push(info)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function generateLanguages() {
|
||||
console.log(`Generating /languages...`)
|
||||
|
@ -249,12 +236,10 @@ function generateLanguages() {
|
|||
const info = channel.getInfo()
|
||||
if (!buffer.includes(info)) {
|
||||
utils.appendToFile(filename, channel.toString())
|
||||
if (channel.filename !== 'unsorted') {
|
||||
buffer.push(info)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const buffer = []
|
||||
const other = `${outputDir}/undefined.m3u`
|
||||
|
@ -264,12 +249,10 @@ function generateLanguages() {
|
|||
const info = channel.getInfo()
|
||||
if (!buffer.includes(info)) {
|
||||
utils.appendToFile(other, channel.toString())
|
||||
if (channel.filename !== 'unsorted') {
|
||||
buffer.push(info)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function finish() {
|
||||
console.log(
|
||||
|
|
Loading…
Reference in New Issue