mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 02:16:40 -05:00
2
.github/workflows/format.yml
vendored
2
.github/workflows/format.yml
vendored
@@ -50,7 +50,7 @@ jobs:
|
||||
- name: Commit changed *.channels.xml files
|
||||
if: steps.files.outputs.channels_any_changed == 'true'
|
||||
run: |
|
||||
git add streams
|
||||
git add sites
|
||||
git status
|
||||
git commit -m "[Bot] Format *.channels.xml files" -m "Committed by [iptv-bot](https://github.com/apps/iptv-bot) via [format](https://github.com/iptv-org/epg/actions/runs/${{ github.run_id }}) workflow." --no-verify
|
||||
- name: Push all changes to the repository
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,6 +1,7 @@
|
||||
/node_modules/
|
||||
/temp/
|
||||
/channels.xml
|
||||
/custom.xml
|
||||
/guide.xml
|
||||
/guide.xml.gz
|
||||
.secrets
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Logger, Timer, Collection, Template } from '@freearhey/core'
|
||||
import epgGrabber, { EPGGrabber, EPGGrabberMock } from 'epg-grabber'
|
||||
import { loadJs, parseProxy, Queue, parseNumber } from '../../core'
|
||||
import { loadJs, parseProxy, parseNumber } from '../../core'
|
||||
import { CurlBody } from 'curl-generator/dist/bodies/body'
|
||||
import { Channel, Guide, Program } from '../../models'
|
||||
import { SocksProxyAgent } from 'socks-proxy-agent'
|
||||
@@ -187,9 +187,9 @@ async function main() {
|
||||
await loadData()
|
||||
|
||||
logger.info('creating queue...')
|
||||
let index = 0
|
||||
const queue = new Queue()
|
||||
const queue = new Collection<QueueItem>()
|
||||
|
||||
let index = 0
|
||||
for (const channel of channelsFromXML.all()) {
|
||||
channel.index = index++
|
||||
if (!channel.site || !channel.site_id || !channel.name) continue
|
||||
@@ -204,12 +204,10 @@ async function main() {
|
||||
const dates = Array.from({ length: days }, (_, day) => currDate.add(day, 'd'))
|
||||
|
||||
dates.forEach((date: Dayjs) => {
|
||||
const key = `${channel.site}:${channel.lang}:${channel.xmltv_id}:${date.toJSON()}`
|
||||
if (queue.has(key)) return
|
||||
queue.add(key, {
|
||||
queue.add({
|
||||
channel,
|
||||
date,
|
||||
config,
|
||||
config: { ...config },
|
||||
error: null
|
||||
})
|
||||
})
|
||||
@@ -219,15 +217,13 @@ async function main() {
|
||||
|
||||
const taskQueue = new TaskQueue(Promise as PromisyClass, maxConnections)
|
||||
|
||||
const queueItems = queue.getItems()
|
||||
|
||||
const channels = new Collection<Channel>()
|
||||
const programs = new Collection<Program>()
|
||||
|
||||
let i = 1
|
||||
const total = queueItems.count()
|
||||
const total = queue.count()
|
||||
|
||||
const requests = queueItems.map(
|
||||
const requests = queue.map(
|
||||
taskQueue.wrap(async (queueItem: QueueItem) => {
|
||||
const { channel, config, date } = queueItem
|
||||
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
export * from './htmlTable'
|
||||
export * from './utils'
|
||||
export * from './queue'
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
import { Collection, Dictionary } from '@freearhey/core'
|
||||
import { QueueItem } from '../types/queue'
|
||||
|
||||
export class Queue {
|
||||
#items: Dictionary<QueueItem> = new Dictionary<QueueItem>()
|
||||
|
||||
add(key: string, data: QueueItem) {
|
||||
this.#items.set(key, data)
|
||||
}
|
||||
|
||||
has(key: string): boolean {
|
||||
return this.#items.has(key)
|
||||
}
|
||||
|
||||
getItems(): Collection<QueueItem> {
|
||||
return new Collection<QueueItem>(Object.values(this.#items.data()))
|
||||
}
|
||||
}
|
||||
@@ -3,18 +3,16 @@
|
||||
<channel id="Channel1.us"><display-name>Channel 1</display-name><icon src="https://i.imgur.com/GPzH88J.png"/><url>https://example2.com</url></channel>
|
||||
<channel id="Channel4.us@HD"><display-name>Channel 4</display-name><icon src="https://i.imgur.com/BPzH88J.png"/><url>https://example2.com</url></channel>
|
||||
<channel id="Channel3.us@Wrong"><display-name>Channel 3</display-name><icon src="https://upload.wikimedia.org/wikipedia/commons/6/64/6%27eren_2015.png"/><url>https://example2.com</url></channel>
|
||||
<channel id="Channel1.us"><display-name>Channel 1</display-name><icon src="https://i.imgur.com/GPzH88J.png"/><url>https://example.com</url></channel>
|
||||
<channel id="140"><display-name>Channel 1</display-name><url>https://example.com</url></channel>
|
||||
<channel id="Channel2.us"><display-name>Custom Channel 2</display-name><icon src="https://i.imgur.com/qmRnD0M.png"/><url>https://example.com</url></channel>
|
||||
<programme start="20221020043100 +0000" stop="20221020071000 +0000" channel="Channel1.us"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221021043100 +0000" stop="20221021071000 +0000" channel="Channel1.us"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221020043100 +0000" stop="20221020071000 +0000" channel="Channel1.us"><title lang="en">Program1 (example.com)</title></programme>
|
||||
<programme start="20221021043100 +0000" stop="20221021071000 +0000" channel="Channel1.us"><title lang="en">Program1 (example.com)</title></programme>
|
||||
<programme start="20221021044000 +0000" stop="20221021071000 +0000" channel="Channel1.us"><title lang="fr">Programme1 (example2.com)</title></programme>
|
||||
<programme start="20221020044000 +0000" stop="20221020071000 +0000" channel="Channel1.us"><title lang="fr">Programme1 (example2.com)</title></programme>
|
||||
<programme start="20221021043100 +0000" stop="20221021071000 +0000" channel="Channel4.us@HD"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221020043100 +0000" stop="20221020071000 +0000" channel="Channel4.us@HD"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221021043100 +0000" stop="20221021071000 +0000" channel="Channel3.us@Wrong"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221020043100 +0000" stop="20221020071000 +0000" channel="Channel3.us@Wrong"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221021044000 +0000" stop="20221021071000 +0000" channel="Channel1.us"><title lang="fr">Programme1 (example2.com)</title></programme>
|
||||
<programme start="20221020044000 +0000" stop="20221020071000 +0000" channel="Channel1.us"><title lang="fr">Programme1 (example2.com)</title></programme>
|
||||
<programme start="20221021043100 +0000" stop="20221021071000 +0000" channel="Channel2.us"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221020043100 +0000" stop="20221020071000 +0000" channel="Channel2.us"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221021043000 +0000" stop="20221021071000 +0000" channel="140"><title lang="fr">Programme1 (example.com)</title></programme>
|
||||
<programme start="20221020043000 +0000" stop="20221020071000 +0000" channel="140"><title lang="fr">Programme1 (example.com)</title></programme>
|
||||
</tv>
|
||||
@@ -6,18 +6,16 @@
|
||||
<channel id="Channel3.us"><display-name>Channel 3</display-name><icon src="https://upload.wikimedia.org/wikipedia/commons/6/64/6%27eren_2015.png"/><url>https://example.com</url></channel>
|
||||
<channel id="140"><display-name>Channel 1</display-name><url>https://example.com</url></channel>
|
||||
<channel id="Channel2.us"><display-name>Channel 2</display-name><icon src="https://i.imgur.com/qmRnD0M.png"/><url>https://example.com</url><lcn>36</lcn></channel>
|
||||
<programme start="20221020043100 +0000" stop="20221020071000 +0000" channel="Channel1.us@HD"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221021043100 +0000" stop="20221021071000 +0000" channel="Channel1.us@HD"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221020043100 +0000" stop="20221020071000 +0000" channel="Channel1.us@HD"><title lang="en">Program1 (example.com)</title></programme>
|
||||
<programme start="20221021043100 +0000" stop="20221021071000 +0000" channel="Channel1.us@HD"><title lang="en">Program1 (example.com)</title></programme>
|
||||
<programme start="20221021044000 +0000" stop="20221021071000 +0000" channel="Channel1.us"><title lang="fr">Programme1 (example2.com)</title></programme>
|
||||
<programme start="20221020044000 +0000" stop="20221020071000 +0000" channel="Channel1.us"><title lang="fr">Programme1 (example2.com)</title></programme>
|
||||
<programme start="20221021043100 +0000" stop="20221021071000 +0000" channel="Channel4.us@HD"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221020043100 +0000" stop="20221020071000 +0000" channel="Channel4.us@HD"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221021043100 +0000" stop="20221021071000 +0000" channel="Channel3.us"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221020043100 +0000" stop="20221020071000 +0000" channel="Channel3.us"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221021043100 +0000" stop="20221021071000 +0000" channel="Channel3.us"><title lang="it">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221020043100 +0000" stop="20221020071000 +0000" channel="Channel3.us"><title lang="it">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221021044000 +0000" stop="20221021071000 +0000" channel="140"><title lang="fr">Programme1 (example2.com)</title></programme>
|
||||
<programme start="20221020044000 +0000" stop="20221020071000 +0000" channel="140"><title lang="fr">Programme1 (example2.com)</title></programme>
|
||||
<programme start="20221021043100 +0000" stop="20221021071000 +0000" channel="Channel2.us"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221020043100 +0000" stop="20221020071000 +0000" channel="Channel2.us"><title lang="en">Program1 (example2.com)</title></programme>
|
||||
<programme start="20221021043100 +0000" stop="20221021071000 +0000" channel="Channel3.us"><title lang="it">Program1 (example.com)</title></programme>
|
||||
<programme start="20221020043100 +0000" stop="20221020071000 +0000" channel="Channel3.us"><title lang="it">Program1 (example.com)</title></programme>
|
||||
<programme start="20221021043000 +0000" stop="20221021071000 +0000" channel="140"><title lang="fr">Programme1 (example.com)</title></programme>
|
||||
<programme start="20221020043000 +0000" stop="20221020071000 +0000" channel="140"><title lang="fr">Programme1 (example.com)</title></programme>
|
||||
</tv>
|
||||
@@ -2,7 +2,7 @@
|
||||
<channels>
|
||||
<channel site="example.com" lang="en" xmltv_id="Channel1.us" site_id="140">Custom Channel 1</channel>
|
||||
<channel site="example.com" lang="en" xmltv_id="Channel2.us" site_id="142" logo="https://i.imgur.com/qmRnD0M.png">Custom Channel 2</channel>
|
||||
<channel site="example.com" lang="fr" xmltv_id="Channel1.us" site_id="140">Channel 1</channel>
|
||||
<channel site="example.com" lang="fr" xmltv_id="" site_id="140">Channel 1</channel>
|
||||
<channel site="example2.com" lang="en" xmltv_id="Channel3.us@Wrong" site_id="150">Channel 3</channel>
|
||||
<channel site="example2.com" lang="en" xmltv_id="Channel4.us@HD" site_id="152">Channel 4</channel>
|
||||
<channel site="example2.com" lang="fr" xmltv_id="Channel1.us" site_id="140">Channel 1</channel>
|
||||
|
||||
Reference in New Issue
Block a user