mirror of
https://github.com/iptv-org/iptv-org.github.io.git
synced 2025-05-12 10:00:07 -04:00
wip
This commit is contained in:
parent
b6e7d1e947
commit
50365756f7
64 changed files with 122 additions and 89 deletions
1
src/data/blocklist.json
Normal file
1
src/data/blocklist.json
Normal file
File diff suppressed because one or more lines are too long
1
src/data/categories.json
Normal file
1
src/data/categories.json
Normal file
|
@ -0,0 +1 @@
|
|||
[{"id":"auto","name":"Auto"},{"id":"animation","name":"Animation"},{"id":"business","name":"Business"},{"id":"classic","name":"Classic"},{"id":"comedy","name":"Comedy"},{"id":"cooking","name":"Cooking"},{"id":"culture","name":"Culture"},{"id":"documentary","name":"Documentary"},{"id":"education","name":"Education"},{"id":"entertainment","name":"Entertainment"},{"id":"family","name":"Family"},{"id":"general","name":"General"},{"id":"kids","name":"Kids"},{"id":"legislative","name":"Legislative"},{"id":"lifestyle","name":"Lifestyle"},{"id":"movies","name":"Movies"},{"id":"music","name":"Music"},{"id":"news","name":"News"},{"id":"outdoor","name":"Outdoor"},{"id":"relax","name":"Relax"},{"id":"religious","name":"Religious"},{"id":"series","name":"Series"},{"id":"science","name":"Science"},{"id":"shop","name":"Shop"},{"id":"sports","name":"Sports"},{"id":"travel","name":"Travel"},{"id":"weather","name":"Weather"},{"id":"xxx","name":"XXX"}]
|
1
src/data/channels.json
Normal file
1
src/data/channels.json
Normal file
File diff suppressed because one or more lines are too long
1
src/data/countries.json
Normal file
1
src/data/countries.json
Normal file
File diff suppressed because one or more lines are too long
1
src/data/languages.json
Normal file
1
src/data/languages.json
Normal file
File diff suppressed because one or more lines are too long
1
src/data/regions.json
Normal file
1
src/data/regions.json
Normal file
File diff suppressed because one or more lines are too long
1
src/data/streams.json
Normal file
1
src/data/streams.json
Normal file
File diff suppressed because one or more lines are too long
1
src/data/subdivisions.json
Normal file
1
src/data/subdivisions.json
Normal file
File diff suppressed because one or more lines are too long
52
src/store.js
52
src/store.js
|
@ -2,6 +2,14 @@ import { writable, get } from 'svelte/store'
|
|||
import { Playlist, Link } from 'iptv-playlist-generator'
|
||||
import sj from '@freearhey/search-js'
|
||||
import _ from 'lodash'
|
||||
import api_channels from '~/data/channels.json'
|
||||
import api_regions from '~/data/regions.json'
|
||||
import api_countries from '~/data/countries.json'
|
||||
import api_languages from '~/data/languages.json'
|
||||
import api_streams from '~/data/streams.json'
|
||||
import api_subdivisions from '~/data/subdivisions.json'
|
||||
import api_blocklist from '~/data/blocklist.json'
|
||||
import api_categories from '~/data/categories.json'
|
||||
|
||||
export const query = writable('')
|
||||
export const hasQuery = writable(false)
|
||||
|
@ -104,6 +112,30 @@ export function setPageTitle(value) {
|
|||
async function loadAPI() {
|
||||
const api = {}
|
||||
|
||||
api.countries = _.keyBy(
|
||||
api_countries.map(i => {
|
||||
i.expanded = false
|
||||
return i
|
||||
}),
|
||||
'code'
|
||||
)
|
||||
|
||||
api.regions = _.keyBy(api_regions, 'code')
|
||||
api.subdivisions = _.keyBy(api_subdivisions, 'code')
|
||||
api.languages = _.keyBy(api_languages, 'code')
|
||||
api.categories = _.keyBy(api_categories, 'id')
|
||||
api.streams = _.keyBy(api_streams, 'channel')
|
||||
api.blocklist = _.keyBy(api_blocklist, 'channel')
|
||||
api.guides = {}
|
||||
|
||||
api.channels = api_channels
|
||||
|
||||
return api
|
||||
}
|
||||
|
||||
async function _loadAPI() {
|
||||
const api = {}
|
||||
|
||||
api.countries = await fetch('https://iptv-org.github.io/api/countries.json')
|
||||
.then(r => r.json())
|
||||
.then(data => (data.length ? data : []))
|
||||
|
@ -153,11 +185,6 @@ async function loadAPI() {
|
|||
.catch(console.error)
|
||||
|
||||
api.guides = {}
|
||||
// api.guides = await fetch('https://iptv-org.github.io/api/guides.json')
|
||||
// .then(r => r.json())
|
||||
// .then(data => (data.length ? data : []))
|
||||
// .then(data => _.groupBy(data, 'channel'))
|
||||
// .catch(console.error)
|
||||
|
||||
api.channels = await fetch('https://iptv-org.github.io/api/channels.json')
|
||||
.then(r => r.json())
|
||||
|
@ -169,18 +196,6 @@ async function loadAPI() {
|
|||
return api
|
||||
}
|
||||
|
||||
function getGuides() {
|
||||
let guides = {}
|
||||
get(selected).forEach(channel => {
|
||||
let guide = channel._guides.length ? channel._guides[0] : null
|
||||
if (guide && !guides[guide.url]) {
|
||||
guides[guide.url] = guide.url
|
||||
}
|
||||
})
|
||||
|
||||
return Object.values(guides)
|
||||
}
|
||||
|
||||
function getStreams() {
|
||||
let streams = []
|
||||
get(selected).forEach(channel => {
|
||||
|
@ -212,9 +227,6 @@ function getStreams() {
|
|||
export function createPlaylist() {
|
||||
const playlist = new Playlist()
|
||||
|
||||
// let guides = getGuides()
|
||||
// playlist.header = { 'x-tvg-url': guides.sort().join(',') }
|
||||
|
||||
let streams = getStreams()
|
||||
streams.forEach(stream => {
|
||||
const link = new Link(stream.url)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue