Merge pull request #3031 from iptv-org/remove-adult-channels-from-most-playlists
Remove adult channels from most playlists, and implement new way of sorting them.
This commit is contained in:
commit
c02ab0e930
@ -18,6 +18,7 @@ Also you can instead use one of these playlists:
|
|||||||
- `https://iptv-org.github.io/iptv/index.country.m3u` (grouped by country)
|
- `https://iptv-org.github.io/iptv/index.country.m3u` (grouped by country)
|
||||||
- `https://iptv-org.github.io/iptv/index.category.m3u` (grouped by category)
|
- `https://iptv-org.github.io/iptv/index.category.m3u` (grouped by category)
|
||||||
- `https://iptv-org.github.io/iptv/index.language.m3u` (grouped by language)
|
- `https://iptv-org.github.io/iptv/index.language.m3u` (grouped by language)
|
||||||
|
- `https://iptv-org.github.io/iptv/index.nsfw.m3u` (includes adult channels)
|
||||||
|
|
||||||
Or select one of the playlists from the list below.
|
Or select one of the playlists from the list below.
|
||||||
|
|
||||||
@ -54,8 +55,6 @@ Or select one of the playlists from the list below.
|
|||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
**NOTE:** Add `.sfw` to the end of the filename for the lists without any adult channels (For example: `https://iptv-org.github.io/iptv/countries/fr.sfw.m3u`).
|
|
||||||
|
|
||||||
## For Developers
|
## For Developers
|
||||||
|
|
||||||
In addition to the above methods, you can also get a list of all available channels in JSON format.
|
In addition to the above methods, you can also get a list of all available channels in JSON format.
|
||||||
|
@ -34,15 +34,15 @@ function generateIndex() {
|
|||||||
const filename = `${ROOT_DIR}/index.m3u`
|
const filename = `${ROOT_DIR}/index.m3u`
|
||||||
utils.createFile(filename, '#EXTM3U\n')
|
utils.createFile(filename, '#EXTM3U\n')
|
||||||
|
|
||||||
const sfwFilename = `${ROOT_DIR}/index.sfw.m3u`
|
const nsfwFilename = `${ROOT_DIR}/index.nsfw.m3u`
|
||||||
utils.createFile(sfwFilename, '#EXTM3U\n')
|
utils.createFile(nsfwFilename, '#EXTM3U\n')
|
||||||
|
|
||||||
const channels = db.channels.sortBy(['name', 'url']).removeDuplicates().get()
|
const channels = db.channels.sortBy(['name', 'url']).removeDuplicates().get()
|
||||||
for (const channel of channels) {
|
for (const channel of channels) {
|
||||||
utils.appendToFile(filename, channel.toString())
|
if (!channel.isNSFW()) {
|
||||||
if (channel.isSFW()) {
|
utils.appendToFile(filename, channel.toString())
|
||||||
utils.appendToFile(sfwFilename, channel.toString())
|
|
||||||
}
|
}
|
||||||
|
utils.appendToFile(nsfwFilename, channel.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,15 +51,9 @@ function generateCategoryIndex() {
|
|||||||
const filename = `${ROOT_DIR}/index.category.m3u`
|
const filename = `${ROOT_DIR}/index.category.m3u`
|
||||||
utils.createFile(filename, '#EXTM3U\n')
|
utils.createFile(filename, '#EXTM3U\n')
|
||||||
|
|
||||||
const sfwFilename = `${ROOT_DIR}/index.category.sfw.m3u`
|
|
||||||
utils.createFile(sfwFilename, '#EXTM3U\n')
|
|
||||||
|
|
||||||
const channels = db.channels.sortBy(['category', 'name', 'url']).removeDuplicates().get()
|
const channels = db.channels.sortBy(['category', 'name', 'url']).removeDuplicates().get()
|
||||||
for (const channel of channels) {
|
for (const channel of channels) {
|
||||||
utils.appendToFile(filename, channel.toString())
|
utils.appendToFile(filename, channel.toString())
|
||||||
if (channel.isSFW()) {
|
|
||||||
utils.appendToFile(sfwFilename, channel.toString())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,9 +62,6 @@ 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 sfwFilename = `${ROOT_DIR}/index.country.sfw.m3u`
|
|
||||||
utils.createFile(sfwFilename, '#EXTM3U\n')
|
|
||||||
|
|
||||||
for (const country of [{ code: 'undefined' }, ...db.countries.sortBy(['name']).all()]) {
|
for (const country of [{ code: 'undefined' }, ...db.countries.sortBy(['name']).all()]) {
|
||||||
const channels = db.channels
|
const channels = db.channels
|
||||||
.sortBy(['name', 'url'])
|
.sortBy(['name', 'url'])
|
||||||
@ -79,11 +70,10 @@ function generateCountryIndex() {
|
|||||||
.get()
|
.get()
|
||||||
for (const channel of channels) {
|
for (const channel of channels) {
|
||||||
const category = channel.category
|
const category = channel.category
|
||||||
const sfw = channel.isSFW()
|
const nsfw = channel.isNSFW()
|
||||||
channel.category = country.name || ''
|
channel.category = country.name || ''
|
||||||
utils.appendToFile(filename, channel.toString())
|
if (!nsfw) {
|
||||||
if (sfw) {
|
utils.appendToFile(filename, channel.toString())
|
||||||
utils.appendToFile(sfwFilename, channel.toString())
|
|
||||||
}
|
}
|
||||||
channel.category = category
|
channel.category = category
|
||||||
}
|
}
|
||||||
@ -95,9 +85,6 @@ function generateLanguageIndex() {
|
|||||||
const filename = `${ROOT_DIR}/index.language.m3u`
|
const filename = `${ROOT_DIR}/index.language.m3u`
|
||||||
utils.createFile(filename, '#EXTM3U\n')
|
utils.createFile(filename, '#EXTM3U\n')
|
||||||
|
|
||||||
const sfwFilename = `${ROOT_DIR}/index.language.sfw.m3u`
|
|
||||||
utils.createFile(sfwFilename, '#EXTM3U\n')
|
|
||||||
|
|
||||||
for (const language of [{ code: 'undefined' }, ...db.languages.sortBy(['name']).all()]) {
|
for (const language of [{ code: 'undefined' }, ...db.languages.sortBy(['name']).all()]) {
|
||||||
const channels = db.channels
|
const channels = db.channels
|
||||||
.sortBy(['name', 'url'])
|
.sortBy(['name', 'url'])
|
||||||
@ -106,11 +93,10 @@ function generateLanguageIndex() {
|
|||||||
.get()
|
.get()
|
||||||
for (const channel of channels) {
|
for (const channel of channels) {
|
||||||
const category = channel.category
|
const category = channel.category
|
||||||
const sfw = channel.isSFW()
|
const nsfw = channel.isNSFW()
|
||||||
channel.category = language.name || ''
|
channel.category = language.name || ''
|
||||||
utils.appendToFile(filename, channel.toString())
|
if (!nsfw) {
|
||||||
if (sfw) {
|
utils.appendToFile(filename, channel.toString())
|
||||||
utils.appendToFile(sfwFilename, channel.toString())
|
|
||||||
}
|
}
|
||||||
channel.category = category
|
channel.category = category
|
||||||
}
|
}
|
||||||
@ -146,18 +132,14 @@ function generateCountries() {
|
|||||||
const filename = `${outputDir}/${country.code}.m3u`
|
const filename = `${outputDir}/${country.code}.m3u`
|
||||||
utils.createFile(filename, '#EXTM3U\n')
|
utils.createFile(filename, '#EXTM3U\n')
|
||||||
|
|
||||||
const sfwFilename = `${outputDir}/${country.code}.sfw.m3u`
|
|
||||||
utils.createFile(sfwFilename, '#EXTM3U\n')
|
|
||||||
|
|
||||||
const channels = db.channels
|
const channels = db.channels
|
||||||
.sortBy(['name', 'url'])
|
.sortBy(['name', 'url'])
|
||||||
.forCountry(country)
|
.forCountry(country)
|
||||||
.removeDuplicates()
|
.removeDuplicates()
|
||||||
.get()
|
.get()
|
||||||
for (const channel of channels) {
|
for (const channel of channels) {
|
||||||
utils.appendToFile(filename, channel.toString())
|
if (!channel.isNSFW()) {
|
||||||
if (channel.isSFW()) {
|
utils.appendToFile(filename, channel.toString())
|
||||||
utils.appendToFile(sfwFilename, channel.toString())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -172,18 +154,14 @@ function generateLanguages() {
|
|||||||
const filename = `${outputDir}/${language.code}.m3u`
|
const filename = `${outputDir}/${language.code}.m3u`
|
||||||
utils.createFile(filename, '#EXTM3U\n')
|
utils.createFile(filename, '#EXTM3U\n')
|
||||||
|
|
||||||
const sfwFilename = `${outputDir}/${language.code}.sfw.m3u`
|
|
||||||
utils.createFile(sfwFilename, '#EXTM3U\n')
|
|
||||||
|
|
||||||
const channels = db.channels
|
const channels = db.channels
|
||||||
.sortBy(['name', 'url'])
|
.sortBy(['name', 'url'])
|
||||||
.forLanguage(language)
|
.forLanguage(language)
|
||||||
.removeDuplicates()
|
.removeDuplicates()
|
||||||
.get()
|
.get()
|
||||||
for (const channel of channels) {
|
for (const channel of channels) {
|
||||||
utils.appendToFile(filename, channel.toString())
|
if (!channel.isNSFW()) {
|
||||||
if (channel.isSFW()) {
|
utils.appendToFile(filename, channel.toString())
|
||||||
utils.appendToFile(sfwFilename, channel.toString())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ const categories = require('./categories')
|
|||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const sfwCategories = categories.filter(c => !c.nsfw).map(c => c.name)
|
const sfwCategories = categories.filter(c => !c.nsfw).map(c => c.name)
|
||||||
|
const nsfwCategories = categories.filter(c => c.nsfw).map(c => c.name)
|
||||||
|
|
||||||
const parser = {}
|
const parser = {}
|
||||||
|
|
||||||
@ -234,6 +235,10 @@ class Channel {
|
|||||||
isSFW() {
|
isSFW() {
|
||||||
return sfwCategories.includes(this.category)
|
return sfwCategories.includes(this.category)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isNSFW() {
|
||||||
|
return nsfwCategories.includes(this.category)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = parser
|
module.exports = parser
|
||||||
|
Loading…
x
Reference in New Issue
Block a user