Update generate.js
Removed extra check
This commit is contained in:
parent
f5dc1387ce
commit
ed490849fb
@ -41,12 +41,10 @@ function generateIndex() {
|
|||||||
const info = channel.getInfo()
|
const info = channel.getInfo()
|
||||||
if (!buffer.includes(info)) {
|
if (!buffer.includes(info)) {
|
||||||
utils.appendToFile(filename, channel.toString())
|
utils.appendToFile(filename, channel.toString())
|
||||||
if (channel.filename !== 'unsorted') {
|
|
||||||
buffer.push(info)
|
buffer.push(info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function generateSFWIndex() {
|
function generateSFWIndex() {
|
||||||
console.log('Generating index.sfw.m3u...')
|
console.log('Generating index.sfw.m3u...')
|
||||||
@ -59,12 +57,10 @@ function generateSFWIndex() {
|
|||||||
const info = channel.getInfo()
|
const info = channel.getInfo()
|
||||||
if (!buffer.includes(info)) {
|
if (!buffer.includes(info)) {
|
||||||
utils.appendToFile(filename, channel.toString())
|
utils.appendToFile(filename, channel.toString())
|
||||||
if (channel.filename !== 'unsorted') {
|
|
||||||
buffer.push(info)
|
buffer.push(info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function generateChannelsJson() {
|
function generateChannelsJson() {
|
||||||
console.log('Generating channels.json...')
|
console.log('Generating channels.json...')
|
||||||
@ -81,15 +77,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 buffer = []
|
||||||
const unsorted = db.playlists.only(['unsorted'])[0]
|
const unsorted = db.playlists.only(['unsorted'])[0]
|
||||||
for (const channel of unsorted.channels) {
|
for (const channel of unsorted.channels) {
|
||||||
const category = channel.category
|
const category = channel.category
|
||||||
channel.category = ''
|
channel.category = ''
|
||||||
|
const info = channel.getInfo()
|
||||||
|
if (!buffer.includes(info)) {
|
||||||
utils.appendToFile(filename, channel.toString())
|
utils.appendToFile(filename, channel.toString())
|
||||||
|
buffer.push(info)
|
||||||
|
}
|
||||||
channel.category = category
|
channel.category = category
|
||||||
}
|
}
|
||||||
|
|
||||||
const buffer = []
|
|
||||||
const playlists = db.playlists.sortBy(['country']).except(['unsorted'])
|
const playlists = db.playlists.sortBy(['country']).except(['unsorted'])
|
||||||
for (const playlist of playlists) {
|
for (const playlist of playlists) {
|
||||||
for (const channel of playlist.channels) {
|
for (const channel of playlist.channels) {
|
||||||
@ -118,16 +118,13 @@ function generateLanguageIndex() {
|
|||||||
const info = channel.getInfo()
|
const info = channel.getInfo()
|
||||||
if (!buffer.includes(info)) {
|
if (!buffer.includes(info)) {
|
||||||
utils.appendToFile(filename, channel.toString())
|
utils.appendToFile(filename, channel.toString())
|
||||||
if (channel.filename !== 'unsorted') {
|
|
||||||
buffer.push(info)
|
buffer.push(info)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
channel.category = category
|
channel.category = category
|
||||||
}
|
}
|
||||||
|
|
||||||
const languages = db.languages.sortBy(['name']).all()
|
const languages = db.languages.sortBy(['name']).all()
|
||||||
for (const language of languages) {
|
for (const language of languages) {
|
||||||
const buffer = []
|
|
||||||
const channels = db.channels.sortBy(['name', 'url']).forLanguage(language).get()
|
const channels = db.channels.sortBy(['name', 'url']).forLanguage(language).get()
|
||||||
for (const channel of channels) {
|
for (const channel of channels) {
|
||||||
const category = channel.category
|
const category = channel.category
|
||||||
@ -153,12 +150,10 @@ function generateCategoryIndex() {
|
|||||||
const info = channel.getInfo()
|
const info = channel.getInfo()
|
||||||
if (!buffer.includes(info)) {
|
if (!buffer.includes(info)) {
|
||||||
utils.appendToFile(filename, channel.toString())
|
utils.appendToFile(filename, channel.toString())
|
||||||
if (channel.filename !== 'unsorted') {
|
|
||||||
buffer.push(info)
|
buffer.push(info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function generateCategories() {
|
function generateCategories() {
|
||||||
console.log(`Generating /categories...`)
|
console.log(`Generating /categories...`)
|
||||||
@ -175,12 +170,10 @@ function generateCategories() {
|
|||||||
const info = channel.getInfo()
|
const info = channel.getInfo()
|
||||||
if (!buffer.includes(info)) {
|
if (!buffer.includes(info)) {
|
||||||
utils.appendToFile(filename, channel.toString())
|
utils.appendToFile(filename, channel.toString())
|
||||||
if (channel.filename !== 'unsorted') {
|
|
||||||
buffer.push(info)
|
buffer.push(info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const buffer = []
|
const buffer = []
|
||||||
const other = `${outputDir}/other.m3u`
|
const other = `${outputDir}/other.m3u`
|
||||||
@ -190,12 +183,10 @@ function generateCategories() {
|
|||||||
const info = channel.getInfo()
|
const info = channel.getInfo()
|
||||||
if (!buffer.includes(info)) {
|
if (!buffer.includes(info)) {
|
||||||
utils.appendToFile(other, channel.toString())
|
utils.appendToFile(other, channel.toString())
|
||||||
if (channel.filename !== 'unsorted') {
|
|
||||||
buffer.push(info)
|
buffer.push(info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function generateCountries() {
|
function generateCountries() {
|
||||||
console.log(`Generating /countries...`)
|
console.log(`Generating /countries...`)
|
||||||
@ -212,12 +203,10 @@ function generateCountries() {
|
|||||||
const info = channel.getInfo()
|
const info = channel.getInfo()
|
||||||
if (!buffer.includes(info)) {
|
if (!buffer.includes(info)) {
|
||||||
utils.appendToFile(filename, channel.toString())
|
utils.appendToFile(filename, channel.toString())
|
||||||
if (channel.filename !== 'unsorted') {
|
|
||||||
buffer.push(info)
|
buffer.push(info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const buffer = []
|
const buffer = []
|
||||||
const other = `${outputDir}/undefined.m3u`
|
const other = `${outputDir}/undefined.m3u`
|
||||||
@ -227,12 +216,10 @@ function generateCountries() {
|
|||||||
const info = channel.getInfo()
|
const info = channel.getInfo()
|
||||||
if (!buffer.includes(info)) {
|
if (!buffer.includes(info)) {
|
||||||
utils.appendToFile(other, channel.toString())
|
utils.appendToFile(other, channel.toString())
|
||||||
if (channel.filename !== 'unsorted') {
|
|
||||||
buffer.push(info)
|
buffer.push(info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function generateLanguages() {
|
function generateLanguages() {
|
||||||
console.log(`Generating /languages...`)
|
console.log(`Generating /languages...`)
|
||||||
@ -249,12 +236,10 @@ function generateLanguages() {
|
|||||||
const info = channel.getInfo()
|
const info = channel.getInfo()
|
||||||
if (!buffer.includes(info)) {
|
if (!buffer.includes(info)) {
|
||||||
utils.appendToFile(filename, channel.toString())
|
utils.appendToFile(filename, channel.toString())
|
||||||
if (channel.filename !== 'unsorted') {
|
|
||||||
buffer.push(info)
|
buffer.push(info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const buffer = []
|
const buffer = []
|
||||||
const other = `${outputDir}/undefined.m3u`
|
const other = `${outputDir}/undefined.m3u`
|
||||||
@ -264,12 +249,10 @@ function generateLanguages() {
|
|||||||
const info = channel.getInfo()
|
const info = channel.getInfo()
|
||||||
if (!buffer.includes(info)) {
|
if (!buffer.includes(info)) {
|
||||||
utils.appendToFile(other, channel.toString())
|
utils.appendToFile(other, channel.toString())
|
||||||
if (channel.filename !== 'unsorted') {
|
|
||||||
buffer.push(info)
|
buffer.push(info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function finish() {
|
function finish() {
|
||||||
console.log(
|
console.log(
|
||||||
|
Loading…
Reference in New Issue
Block a user