From 4cd00f5bf1ecc2025036c9176ea4e61bc9563f62 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Tue, 4 Nov 2025 05:29:15 +0300 Subject: [PATCH 1/4] Update format.yml --- .github/workflows/format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index a227063c..79774ab4 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -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 From 597fda689d807afe62101bddf2f1451b1d43ef50 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Thu, 6 Nov 2025 02:43:43 +0300 Subject: [PATCH 2/4] Update tests/__data__ --- .../expected/epg_grab/custom_channels.guide.xml | 12 +++++------- .../expected/epg_grab/multiple_channels.guide.xml | 14 ++++++-------- tests/__data__/input/epg_grab/custom.channels.xml | 2 +- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/tests/__data__/expected/epg_grab/custom_channels.guide.xml b/tests/__data__/expected/epg_grab/custom_channels.guide.xml index 353b20e2..94215f48 100644 --- a/tests/__data__/expected/epg_grab/custom_channels.guide.xml +++ b/tests/__data__/expected/epg_grab/custom_channels.guide.xml @@ -3,18 +3,16 @@ Channel 1https://example2.com Channel 4https://example2.com Channel 3https://example2.com -Channel 1https://example.com +Channel 1https://example.com Custom Channel 2https://example.com -Program1 (example2.com) -Program1 (example2.com) +Program1 (example.com) +Program1 (example.com) Programme1 (example2.com) Programme1 (example2.com) Program1 (example2.com) Program1 (example2.com) Program1 (example2.com) Program1 (example2.com) -Programme1 (example2.com) -Programme1 (example2.com) -Program1 (example2.com) -Program1 (example2.com) +Programme1 (example.com) +Programme1 (example.com) \ No newline at end of file diff --git a/tests/__data__/expected/epg_grab/multiple_channels.guide.xml b/tests/__data__/expected/epg_grab/multiple_channels.guide.xml index 5b098615..1a2ececa 100644 --- a/tests/__data__/expected/epg_grab/multiple_channels.guide.xml +++ b/tests/__data__/expected/epg_grab/multiple_channels.guide.xml @@ -6,18 +6,16 @@ Channel 3https://example.com Channel 1https://example.com Channel 2https://example.com36 -Program1 (example2.com) -Program1 (example2.com) +Program1 (example.com) +Program1 (example.com) Programme1 (example2.com) Programme1 (example2.com) Program1 (example2.com) Program1 (example2.com) Program1 (example2.com) Program1 (example2.com) -Program1 (example2.com) -Program1 (example2.com) -Programme1 (example2.com) -Programme1 (example2.com) -Program1 (example2.com) -Program1 (example2.com) +Program1 (example.com) +Program1 (example.com) +Programme1 (example.com) +Programme1 (example.com) \ No newline at end of file diff --git a/tests/__data__/input/epg_grab/custom.channels.xml b/tests/__data__/input/epg_grab/custom.channels.xml index 5643ee72..49821f62 100644 --- a/tests/__data__/input/epg_grab/custom.channels.xml +++ b/tests/__data__/input/epg_grab/custom.channels.xml @@ -2,7 +2,7 @@ Custom Channel 1 Custom Channel 2 - Channel 1 + Channel 1 Channel 3 Channel 4 Channel 1 From a1028fc6a872f10641cd302a4ab3e9c8c83611dd Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Thu, 6 Nov 2025 02:44:00 +0300 Subject: [PATCH 3/4] Update scripts --- scripts/commands/epg/grab.ts | 18 +++++++----------- scripts/core/index.ts | 1 - scripts/core/queue.ts | 18 ------------------ 3 files changed, 7 insertions(+), 30 deletions(-) delete mode 100644 scripts/core/queue.ts diff --git a/scripts/commands/epg/grab.ts b/scripts/commands/epg/grab.ts index cc858ae7..9ef58dc0 100644 --- a/scripts/commands/epg/grab.ts +++ b/scripts/commands/epg/grab.ts @@ -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() + 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() const programs = new Collection() 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 diff --git a/scripts/core/index.ts b/scripts/core/index.ts index fbe32262..687374da 100644 --- a/scripts/core/index.ts +++ b/scripts/core/index.ts @@ -1,3 +1,2 @@ export * from './htmlTable' export * from './utils' -export * from './queue' diff --git a/scripts/core/queue.ts b/scripts/core/queue.ts deleted file mode 100644 index 1237e5d0..00000000 --- a/scripts/core/queue.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Collection, Dictionary } from '@freearhey/core' -import { QueueItem } from '../types/queue' - -export class Queue { - #items: Dictionary = new Dictionary() - - add(key: string, data: QueueItem) { - this.#items.set(key, data) - } - - has(key: string): boolean { - return this.#items.has(key) - } - - getItems(): Collection { - return new Collection(Object.values(this.#items.data())) - } -} From 81e85f2e40313ab365e6ccfacff5145858947bb8 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Thu, 6 Nov 2025 02:44:08 +0300 Subject: [PATCH 4/4] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index cabef157..9abd4fa9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /node_modules/ /temp/ /channels.xml +/custom.xml /guide.xml /guide.xml.gz .secrets