From af6d9f90f3f3ff8ae0416059c0da4f488244afcc Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Tue, 15 Mar 2022 15:25:51 +0300 Subject: [PATCH 1/9] Update tests/__data__/expected --- .../guides/bh/chaines-tv.orange.fr.epg.xml.gz | Bin 0 -> 2453 bytes .../guides/fr/chaines-tv.orange.fr.epg.xml.gz | Bin 0 -> 2453 bytes .../expected/guides/ge/magticom.ge.epg.xml | 3 +++ .../expected/guides/ge/magticom.ge.epg.xml.gz | Bin 0 -> 184 bytes .../expected/guides/ru/yandex.ru.epg.xml | 2 ++ .../expected/guides/ru/yandex.ru.epg.xml.gz | Bin 0 -> 68 bytes .../expected/guides/us/directv.com.epg.xml | 2 ++ .../expected/guides/us/directv.com.epg.xml.gz | Bin 0 -> 68 bytes .../expected/guides/zw/dstv.com.epg.xml.gz | Bin 0 -> 592 bytes 9 files changed, 7 insertions(+) create mode 100644 tests/__data__/expected/guides/bh/chaines-tv.orange.fr.epg.xml.gz create mode 100644 tests/__data__/expected/guides/fr/chaines-tv.orange.fr.epg.xml.gz create mode 100644 tests/__data__/expected/guides/ge/magticom.ge.epg.xml create mode 100644 tests/__data__/expected/guides/ge/magticom.ge.epg.xml.gz create mode 100644 tests/__data__/expected/guides/ru/yandex.ru.epg.xml create mode 100644 tests/__data__/expected/guides/ru/yandex.ru.epg.xml.gz create mode 100644 tests/__data__/expected/guides/us/directv.com.epg.xml create mode 100644 tests/__data__/expected/guides/us/directv.com.epg.xml.gz create mode 100644 tests/__data__/expected/guides/zw/dstv.com.epg.xml.gz diff --git a/tests/__data__/expected/guides/bh/chaines-tv.orange.fr.epg.xml.gz b/tests/__data__/expected/guides/bh/chaines-tv.orange.fr.epg.xml.gz new file mode 100644 index 0000000000000000000000000000000000000000..ed76f0678670ec8c3c61ab27dc22fc6a34a56f44 GIT binary patch literal 2453 zcmV;G32OEqiwFP!000006YW}EZ`(!|eJ{}eFwjF^YD=bUCr&H7h}|Yl(4@Pu+b;UX z$c)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j0LFFAxGQUH z)l`*x9F$d6){8Q`ZQNBgBMz3xWhn7KK$-tc6zSjqFNr2D%0!T}Ao0Ho??~e*mwf1m zM|aLfiu~Xr!kKu&L;#}l9Py*^luj_kp%CYeIt(svhzhCffDpSuIfFDm7T(px1#=Y@ zlty8Od+n2pG==**JPqSfZnO~UUBE&bJQMGdR?rLbJf+1bka9W6P +CNN Internationalhttps://magticom.ge + \ No newline at end of file diff --git a/tests/__data__/expected/guides/ge/magticom.ge.epg.xml.gz b/tests/__data__/expected/guides/ge/magticom.ge.epg.xml.gz new file mode 100644 index 0000000000000000000000000000000000000000..e2a7b5ab1f0c224b6d7d12f33e46d376f1949aa0 GIT binary patch literal 184 zcmV;p07w5HiwFP!000006IG6}3c@fH0C&NE2-%xdCz00_EDA226kJ0Z(n#`BlC;#n zw*?(K-yIy(vv*|DG1-6>J+P7zjVg2&O+}xNTXCYK7LX^g-+}5SqISe~6>Zw~j#)>P zc}b&+OM3Z5S?uf~)! mdk=!{dHw>|tbJ_X0001?qE0ga literal 0 HcmV?d00001 diff --git a/tests/__data__/expected/guides/ru/yandex.ru.epg.xml b/tests/__data__/expected/guides/ru/yandex.ru.epg.xml new file mode 100644 index 00000000..dcf44bec --- /dev/null +++ b/tests/__data__/expected/guides/ru/yandex.ru.epg.xml @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/tests/__data__/expected/guides/ru/yandex.ru.epg.xml.gz b/tests/__data__/expected/guides/ru/yandex.ru.epg.xml.gz new file mode 100644 index 0000000000000000000000000000000000000000..188a49e099fca507177d6fcf3b3adcee6111eae5 GIT binary patch literal 68 zcmb2|=3oE=;msS@pEw(+;jOE6?#%hkp+;AX1A;uxdY|(@dB%HtC>L+x<*flh8@6xO W)ZF~|>86Y9K@9hG)0P + \ No newline at end of file diff --git a/tests/__data__/expected/guides/us/directv.com.epg.xml.gz b/tests/__data__/expected/guides/us/directv.com.epg.xml.gz new file mode 100644 index 0000000000000000000000000000000000000000..188a49e099fca507177d6fcf3b3adcee6111eae5 GIT binary patch literal 68 zcmb2|=3oE=;msS@pEw(+;jOE6?#%hkp+;AX1A;uxdY|(@dB%HtC>L+x<*flh8@6xO W)ZF~|>86Y9K@9hG)0P%^^B3olmtd+ zF)XaD%~yo9WEqnlGxp$RszTjERvAPv!3fV$;G>hv^u=XL(p#0QbUF#rQsjl*(rlk= z)ku~;l{)uonM0IBjV_Zni8tR7>Q*E48cY{gtyQjRRdHY})i#E$EWtir5FCaWgD<$f zU~5$MnT-TzwpVZO0ID-NK;1WXt2y0|X6fk-Sgzc9 z^(WO-DnUoHTz$|(Gq)aE@}rUrbTzweYc(2acDaAL+X< zghPsY!UL!Uc1qFdL{VeGqp(>4ZW?LFPr|-<{C)EAln literal 0 HcmV?d00001 From fba99ba5e50cced8393d8cebbc1823405a5b5b53 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Tue, 15 Mar 2022 15:26:04 +0300 Subject: [PATCH 2/9] Update package.json --- package.json | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0e8af9ef..f05cc50a 100644 --- a/package.json +++ b/package.json @@ -23,16 +23,20 @@ "author": "Arhey", "license": "MIT", "jest": { - "testRegex": "(sites|tests)/(.*?/)?.*test.js$" + "testRegex": "(sites|tests)/(.*?/)?.*test.js$", + "setupFilesAfterEnv": [ + "@alex_neo/jest-expect-message" + ] }, "dependencies": { + "@alex_neo/jest-expect-message": "^1.0.5", "axios": "^0.21.1", "chalk": "^4.1.2", "cheerio": "^1.0.0-rc.10", "commander": "^8.2.0", "csv-parser": "^3.0.0", "dayjs": "^1.10.8", - "epg-grabber": "^0.23.0", + "epg-grabber": "^0.24.0", "epg-parser": "^0.1.6", "form-data": "^4.0.0", "fs-extra": "^10.0.1", @@ -46,6 +50,7 @@ "mockdate": "^3.0.5", "nedb-promises": "^5.0.3", "node-cleanup": "^2.1.2", + "node-gzip": "^1.1.2", "parse-duration": "^1.0.0", "pdf-parse": "^1.1.1", "signale": "^1.4.0", From 6a8fc409a2186aa2775395c8fa9c21a3f8b07a1a Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Tue, 15 Mar 2022 15:26:07 +0300 Subject: [PATCH 3/9] Update package-lock.json --- package-lock.json | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 5799aadd..946423fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,13 +7,14 @@ "name": "epg", "license": "MIT", "dependencies": { + "@alex_neo/jest-expect-message": "^1.0.5", "axios": "^0.21.1", "chalk": "^4.1.2", "cheerio": "^1.0.0-rc.10", "commander": "^8.2.0", "csv-parser": "^3.0.0", "dayjs": "^1.10.8", - "epg-grabber": "^0.23.0", + "epg-grabber": "^0.24.0", "epg-parser": "^0.1.6", "form-data": "^4.0.0", "fs-extra": "^10.0.1", @@ -27,6 +28,7 @@ "mockdate": "^3.0.5", "nedb-promises": "^5.0.3", "node-cleanup": "^2.1.2", + "node-gzip": "^1.1.2", "parse-duration": "^1.0.0", "pdf-parse": "^1.1.1", "signale": "^1.4.0", @@ -36,6 +38,11 @@ "wildcard-match": "^5.1.2" } }, + "node_modules/@alex_neo/jest-expect-message": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@alex_neo/jest-expect-message/-/jest-expect-message-1.0.5.tgz", + "integrity": "sha512-1eBykZCd0pPGl5qKtV6Z5ARA6yuhXzHsVN2h5GH5/H6svYa37Jr7vMio5OFpiw1LBHtscrZs7amSkZkcwm0cvQ==" + }, "node_modules/@babel/code-frame": { "version": "7.16.0", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", @@ -2206,9 +2213,9 @@ } }, "node_modules/epg-grabber": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.23.0.tgz", - "integrity": "sha512-tjMH8+UxguXNkI30gwISeXRvErlByXHGpvLBLq/eDHAPT9pQ6G96R7UHHJ+vZ4fIaMTZEh3aiTKnzjO+trlGhw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.24.0.tgz", + "integrity": "sha512-TrFKHF3kUjffJDCASBv/gyjlIcahbIJf02TgmgKzFQjSZYCLhqR87U7MXbWkioftdM5BLoQKbuaI/OQGbIJsBQ==", "dependencies": { "axios": "^0.21.1", "axios-cookiejar-support": "^1.0.1", @@ -2218,6 +2225,7 @@ "dayjs": "^1.10.4", "glob": "^7.1.6", "lodash": "^4.17.21", + "node-gzip": "^1.1.2", "tough-cookie": "^4.0.0", "winston": "^3.3.3", "xml-js": "^1.6.11" @@ -4232,6 +4240,11 @@ "resolved": "https://registry.npmjs.org/node-ensure/-/node-ensure-0.0.0.tgz", "integrity": "sha1-7K52QVDemYYexcgQ/V0Jaxg5Mqc=" }, + "node_modules/node-gzip": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/node-gzip/-/node-gzip-1.1.2.tgz", + "integrity": "sha512-ZB6zWpfZHGtxZnPMrJSKHVPrRjURoUzaDbLFj3VO70mpLTW5np96vXyHwft4Id0o+PYIzgDkBUjIzaNHhQ8srw==" + }, "node_modules/node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", @@ -5890,6 +5903,11 @@ } }, "dependencies": { + "@alex_neo/jest-expect-message": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@alex_neo/jest-expect-message/-/jest-expect-message-1.0.5.tgz", + "integrity": "sha512-1eBykZCd0pPGl5qKtV6Z5ARA6yuhXzHsVN2h5GH5/H6svYa37Jr7vMio5OFpiw1LBHtscrZs7amSkZkcwm0cvQ==" + }, "@babel/code-frame": { "version": "7.16.0", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", @@ -7573,9 +7591,9 @@ "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==" }, "epg-grabber": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.23.0.tgz", - "integrity": "sha512-tjMH8+UxguXNkI30gwISeXRvErlByXHGpvLBLq/eDHAPT9pQ6G96R7UHHJ+vZ4fIaMTZEh3aiTKnzjO+trlGhw==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.24.0.tgz", + "integrity": "sha512-TrFKHF3kUjffJDCASBv/gyjlIcahbIJf02TgmgKzFQjSZYCLhqR87U7MXbWkioftdM5BLoQKbuaI/OQGbIJsBQ==", "requires": { "axios": "^0.21.1", "axios-cookiejar-support": "^1.0.1", @@ -7585,6 +7603,7 @@ "dayjs": "^1.10.4", "glob": "^7.1.6", "lodash": "^4.17.21", + "node-gzip": "^1.1.2", "tough-cookie": "^4.0.0", "winston": "^3.3.3", "xml-js": "^1.6.11" @@ -9102,6 +9121,11 @@ "resolved": "https://registry.npmjs.org/node-ensure/-/node-ensure-0.0.0.tgz", "integrity": "sha1-7K52QVDemYYexcgQ/V0Jaxg5Mqc=" }, + "node-gzip": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/node-gzip/-/node-gzip-1.1.2.tgz", + "integrity": "sha512-ZB6zWpfZHGtxZnPMrJSKHVPrRjURoUzaDbLFj3VO70mpLTW5np96vXyHwft4Id0o+PYIzgDkBUjIzaNHhQ8srw==" + }, "node-int64": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", From bd5e45a1446956177e4ce86105ae96276292c853 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Tue, 15 Mar 2022 15:26:11 +0300 Subject: [PATCH 4/9] Update .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index ebf1164e..e31b99df 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ /node_modules/ /logs/ /guide.xml +/guide.xml.gz /.artifacts/ \ No newline at end of file From 47e272ccc00152955e363a10eddd4cf757774c5c Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Tue, 15 Mar 2022 15:26:15 +0300 Subject: [PATCH 5/9] Create zip.js --- scripts/core/zip.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 scripts/core/zip.js diff --git a/scripts/core/zip.js b/scripts/core/zip.js new file mode 100644 index 00000000..7099f15a --- /dev/null +++ b/scripts/core/zip.js @@ -0,0 +1,13 @@ +const { gzip, ungzip } = require('node-gzip') + +const zip = {} + +zip.compress = async function (string) { + return gzip(string) +} + +zip.decompress = async function (string) { + return ungzip(string) +} + +module.exports = zip From ff6b08430dc6865d1fbfca85b313b3f97ddeacb7 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Tue, 15 Mar 2022 15:26:19 +0300 Subject: [PATCH 6/9] Update index.js --- scripts/core/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/core/index.js b/scripts/core/index.js index 807edaad..c6c607a5 100644 --- a/scripts/core/index.js +++ b/scripts/core/index.js @@ -8,3 +8,4 @@ exports.api = require('./api') exports.date = require('./date') exports.table = require('./table') exports.xml = require('./xml') +exports.zip = require('./zip') From 3c1ac2e326522beed82cfbfa2f04548060bc9d60 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Tue, 15 Mar 2022 15:26:24 +0300 Subject: [PATCH 7/9] Update update.test.js --- tests/commands/guides/update.test.js | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/tests/commands/guides/update.test.js b/tests/commands/guides/update.test.js index 665bbf5b..b19102fe 100644 --- a/tests/commands/guides/update.test.js +++ b/tests/commands/guides/update.test.js @@ -1,6 +1,7 @@ const { execSync } = require('child_process') const fs = require('fs-extra') const path = require('path') +const glob = require('glob') beforeEach(() => { fs.emptyDirSync('tests/__data__/output') @@ -14,13 +15,21 @@ it('can generate /guides', () => { { encoding: 'utf8' } ) - expect(content('tests/__data__/output/guides/fr/chaines-tv.orange.fr.epg.xml')).toBe( - content('tests/__data__/expected/guides/fr/chaines-tv.orange.fr.epg.xml') - ) + const guides = glob + .sync('tests/__data__/expected/guides/**/*.xml') + .map(f => f.replace('tests/__data__/expected/', '')) - expect(content('tests/__data__/output/guides/zw/dstv.com.epg.xml')).toBe( - content('tests/__data__/expected/guides/zw/dstv.com.epg.xml') - ) + guides.forEach(filepath => { + expect(content(`output/${filepath}`), filepath).toBe(content(`expected/${filepath}`)) + }) + + const compressed = glob + .sync('tests/__data__/expected/guides/**/*.xml.gz') + .map(f => f.replace('tests/__data__/expected/', '')) + + compressed.forEach(filepath => { + expect(content(`output/${filepath}`), filepath).toBe(content(`expected/${filepath}`)) + }) }) it('will terminate process if programs not found', () => { @@ -57,9 +66,7 @@ Error: No programs found }) function content(filepath) { - const data = fs.readFileSync(path.resolve(filepath), { + return fs.readFileSync(`tests/__data__/${filepath}`, { encoding: 'utf8' }) - - return JSON.stringify(data) } From 43c76cd04d273f705305a66efec87c6870445748 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Tue, 15 Mar 2022 15:26:26 +0300 Subject: [PATCH 8/9] Update update.js --- scripts/commands/guides/update.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/commands/guides/update.js b/scripts/commands/guides/update.js index f7de932e..4c0727c8 100644 --- a/scripts/commands/guides/update.js +++ b/scripts/commands/guides/update.js @@ -1,4 +1,4 @@ -const { db, logger, file, api } = require('../../core') +const { db, logger, file, api, zip } = require('../../core') const grabber = require('epg-grabber') const _ = require('lodash') @@ -42,6 +42,8 @@ async function main() { logger.info(`Creating "${filepath}"...`) const output = grabber.convertToXMLTV({ channels, programs }) await file.create(filepath, output) + const compressed = await zip.compress(output) + await file.create(filepath + '.gz', compressed) } if (!total) { From fc29f62eccc055bd85b050ce3da4973c04888a49 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Tue, 15 Mar 2022 15:50:11 +0300 Subject: [PATCH 9/9] Update template.md --- .readme/template.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.readme/template.md b/.readme/template.md index 9dc85d98..6ad25984 100644 --- a/.readme/template.md +++ b/.readme/template.md @@ -9,6 +9,8 @@ To load a program guide, all you need to do is copy the link to one or more of t #include "./.readme/_countries.md" +To use a compressed version of the files, add `.gz` to the end of the filename. + ## API The API documentation can be found in the [iptv-org/api](https://github.com/iptv-org/api) repository.