From d3768e1f9857b4369a8958d9c4ae229dfcad4420 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 17:35:01 +0300 Subject: [PATCH 01/13] Update update.js --- scripts/commands/guides/update.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/commands/guides/update.js b/scripts/commands/guides/update.js index f9b28385..e0e09b17 100644 --- a/scripts/commands/guides/update.js +++ b/scripts/commands/guides/update.js @@ -100,7 +100,7 @@ async function main() { channels = _.sortBy(channels, 'id') channels = _.uniqBy(channels, 'id') - programs = programs = _.sortBy(programs, ['channel', 'start']) + programs = _.sortBy(programs, ['channel', 'start']) programs = programs.map(p => new Program(p, new Channel(channels_dic[p.channel]))) programs = _.uniqBy(programs, p => p.channel + p.start) From bff27408b6241590c699a6b2261c036f0004f98b Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 17:35:08 +0300 Subject: [PATCH 02/13] Update package.json --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 43a990bb..cff1578d 100644 --- a/package.json +++ b/package.json @@ -43,8 +43,8 @@ "commander": "^8.2.0", "csv-parser": "^3.0.0", "dayjs": "^1.10.8", - "epg-grabber": "^0.29.2", - "epg-parser": "^0.1.6", + "epg-grabber": "^0.29.4", + "epg-parser": "^0.2.0", "form-data": "^4.0.0", "fs-extra": "^10.0.1", "glob": "^7.2.0", From baa86668b9b5265ce62a73215d2587e58cbd1444 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 17:35:13 +0300 Subject: [PATCH 03/13] Update package-lock.json --- package-lock.json | 54 +++++++++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/package-lock.json b/package-lock.json index f51a637c..278df2aa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,8 +15,8 @@ "commander": "^8.2.0", "csv-parser": "^3.0.0", "dayjs": "^1.10.8", - "epg-grabber": "^0.29.2", - "epg-parser": "^0.1.6", + "epg-grabber": "^0.29.4", + "epg-parser": "^0.2.0", "form-data": "^4.0.0", "fs-extra": "^10.0.1", "glob": "^7.2.0", @@ -2146,9 +2146,9 @@ } }, "node_modules/dayjs": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.2.tgz", - "integrity": "sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw==" + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.6.tgz", + "integrity": "sha512-zZbY5giJAinCG+7AGaw0wIhNZ6J8AhWuSXKvuc1KAyMiRsvGQWqh4L+MomvhdAYjN+lqvVCMq1I41e3YHvXkyQ==" }, "node_modules/debug": { "version": "4.3.4", @@ -2402,9 +2402,9 @@ } }, "node_modules/epg-grabber": { - "version": "0.29.2", - "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.29.2.tgz", - "integrity": "sha512-8DyPh6e1NQvOQaoE3UV0DKvCqUWS6+rxIy61Po04r/S5FP/RpsqKXdVL38f47nmI9V3xharwjBuL9zAV7e6kCQ==", + "version": "0.29.4", + "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.29.4.tgz", + "integrity": "sha512-GNKP8Q01HV3DXq3MEFQvFUlr3ejNsw8QSgGWvQ/lQTdgBXNJMEblz241wac9BNnte/fb+u9ExIyiskpds/dFug==", "dependencies": { "axios": "^0.21.1", "axios-cache-interceptor": "^0.10.3", @@ -2436,7 +2436,7 @@ "node": ">= 10" } }, - "node_modules/epg-parser": { + "node_modules/epg-grabber/node_modules/epg-parser": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/epg-parser/-/epg-parser-0.1.6.tgz", "integrity": "sha512-g6AxKOvs0E4bTGPdIUh8/FDKdrVjbf4DVK0jIFuChDt7wBRJmMVyqbLeS8NApf6M2wpCRLBpIenXOCS88w0Rqw==", @@ -2444,6 +2444,15 @@ "xml-js": "^1.6.11" } }, + "node_modules/epg-parser": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/epg-parser/-/epg-parser-0.2.0.tgz", + "integrity": "sha512-+wmWylP9RPK1tzZKRZ291H8+vDd4LB1ZY0UP16bACyqpwmMu/xkE92jUaXm6wBMn6lpfSepYmT2mgLLi+NCsHQ==", + "dependencies": { + "dayjs": "^1.11.6", + "xml-js": "^1.6.11" + } + }, "node_modules/error-ex": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", @@ -7909,9 +7918,9 @@ } }, "dayjs": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.2.tgz", - "integrity": "sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw==" + "version": "1.11.6", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.6.tgz", + "integrity": "sha512-zZbY5giJAinCG+7AGaw0wIhNZ6J8AhWuSXKvuc1KAyMiRsvGQWqh4L+MomvhdAYjN+lqvVCMq1I41e3YHvXkyQ==" }, "debug": { "version": "4.3.4", @@ -8097,9 +8106,9 @@ "integrity": "sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==" }, "epg-grabber": { - "version": "0.29.2", - "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.29.2.tgz", - "integrity": "sha512-8DyPh6e1NQvOQaoE3UV0DKvCqUWS6+rxIy61Po04r/S5FP/RpsqKXdVL38f47nmI9V3xharwjBuL9zAV7e6kCQ==", + "version": "0.29.4", + "resolved": "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.29.4.tgz", + "integrity": "sha512-GNKP8Q01HV3DXq3MEFQvFUlr3ejNsw8QSgGWvQ/lQTdgBXNJMEblz241wac9BNnte/fb+u9ExIyiskpds/dFug==", "requires": { "axios": "^0.21.1", "axios-cache-interceptor": "^0.10.3", @@ -8121,14 +8130,23 @@ "version": "7.2.0", "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==" + }, + "epg-parser": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/epg-parser/-/epg-parser-0.1.6.tgz", + "integrity": "sha512-g6AxKOvs0E4bTGPdIUh8/FDKdrVjbf4DVK0jIFuChDt7wBRJmMVyqbLeS8NApf6M2wpCRLBpIenXOCS88w0Rqw==", + "requires": { + "xml-js": "^1.6.11" + } } } }, "epg-parser": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/epg-parser/-/epg-parser-0.1.6.tgz", - "integrity": "sha512-g6AxKOvs0E4bTGPdIUh8/FDKdrVjbf4DVK0jIFuChDt7wBRJmMVyqbLeS8NApf6M2wpCRLBpIenXOCS88w0Rqw==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/epg-parser/-/epg-parser-0.2.0.tgz", + "integrity": "sha512-+wmWylP9RPK1tzZKRZ291H8+vDd4LB1ZY0UP16bACyqpwmMu/xkE92jUaXm6wBMn6lpfSepYmT2mgLLi+NCsHQ==", "requires": { + "dayjs": "^1.11.6", "xml-js": "^1.6.11" } }, From 5f0bdaff16ea4e7e4c3a5919e988d1f27ecbbf41 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 17:35:17 +0300 Subject: [PATCH 04/13] Update yarn.lock --- yarn.lock | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8c776370..ef8916ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1454,10 +1454,10 @@ "whatwg-mimetype" "^2.3.0" "whatwg-url" "^8.0.0" -"dayjs@^1.10.4", "dayjs@^1.10.8": - "integrity" "sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw==" - "resolved" "https://registry.npmjs.org/dayjs/-/dayjs-1.11.2.tgz" - "version" "1.11.2" +"dayjs@^1.10.4", "dayjs@^1.10.8", "dayjs@^1.11.6": + "integrity" "sha512-zZbY5giJAinCG+7AGaw0wIhNZ6J8AhWuSXKvuc1KAyMiRsvGQWqh4L+MomvhdAYjN+lqvVCMq1I41e3YHvXkyQ==" + "resolved" "https://registry.npmjs.org/dayjs/-/dayjs-1.11.6.tgz" + "version" "1.11.6" "debug@^3.1.0": "integrity" "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==" @@ -1618,10 +1618,10 @@ "resolved" "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz" "version" "2.2.0" -"epg-grabber@^0.29.2": - "integrity" "sha512-8DyPh6e1NQvOQaoE3UV0DKvCqUWS6+rxIy61Po04r/S5FP/RpsqKXdVL38f47nmI9V3xharwjBuL9zAV7e6kCQ==" - "resolved" "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.29.2.tgz" - "version" "0.29.2" +"epg-grabber@^0.29.4": + "integrity" "sha512-GNKP8Q01HV3DXq3MEFQvFUlr3ejNsw8QSgGWvQ/lQTdgBXNJMEblz241wac9BNnte/fb+u9ExIyiskpds/dFug==" + "resolved" "https://registry.npmjs.org/epg-grabber/-/epg-grabber-0.29.4.tgz" + "version" "0.29.4" dependencies: "axios" "^0.21.1" "axios-cache-interceptor" "^0.10.3" @@ -1645,6 +1645,14 @@ dependencies: "xml-js" "^1.6.11" +"epg-parser@^0.2.0": + "integrity" "sha512-+wmWylP9RPK1tzZKRZ291H8+vDd4LB1ZY0UP16bACyqpwmMu/xkE92jUaXm6wBMn6lpfSepYmT2mgLLi+NCsHQ==" + "resolved" "https://registry.npmjs.org/epg-parser/-/epg-parser-0.2.0.tgz" + "version" "0.2.0" + dependencies: + "dayjs" "^1.11.6" + "xml-js" "^1.6.11" + "error-ex@^1.3.1": "integrity" "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==" "resolved" "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz" From 72f0ab12e6fdc3f7fe8669bdeb781e519262ed70 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 17:36:55 +0300 Subject: [PATCH 05/13] Update i.mjh.nz.test.js --- sites/i.mjh.nz/i.mjh.nz.test.js | 1 + 1 file changed, 1 insertion(+) diff --git a/sites/i.mjh.nz/i.mjh.nz.test.js b/sites/i.mjh.nz/i.mjh.nz.test.js index dafb5b1c..7938511f 100644 --- a/sites/i.mjh.nz/i.mjh.nz.test.js +++ b/sites/i.mjh.nz/i.mjh.nz.test.js @@ -1,6 +1,7 @@ // npm run channels:parse -- --config=./sites/i.mjh.nz/i.mjh.nz.config.js --output=./sites/i.mjh.nz/i.mjh.nz_us-pluto.channels.xml --set=path:PlutoTV/us // npx epg-grabber --config=sites/i.mjh.nz/i.mjh.nz.config.js --channels=sites/i.mjh.nz/i.mjh.nz_us-pluto.channels.xml --output=guide.xml --days=2 // npx epg-grabber --config=sites/i.mjh.nz/i.mjh.nz.config.js --channels=sites/i.mjh.nz/i.mjh.nz_us-stirr.channels.xml --output=guide.xml --days=2 +// npx epg-grabber --config=sites/i.mjh.nz/i.mjh.nz.config.js --channels=sites/i.mjh.nz/i.mjh.nz_us-skygo.channels.xml --output=guide.xml --days=2 const { parser, url } = require('./i.mjh.nz.config.js') const dayjs = require('dayjs') From 4b95ac16f858644ec3da94b9d7ac1883439cb300 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 17:37:29 +0300 Subject: [PATCH 06/13] Update i.mjh.nz.config.js --- sites/i.mjh.nz/i.mjh.nz.config.js | 69 +++++++------------------------ 1 file changed, 16 insertions(+), 53 deletions(-) diff --git a/sites/i.mjh.nz/i.mjh.nz.config.js b/sites/i.mjh.nz/i.mjh.nz.config.js index fff66b18..5a696e54 100644 --- a/sites/i.mjh.nz/i.mjh.nz.config.js +++ b/sites/i.mjh.nz/i.mjh.nz.config.js @@ -7,78 +7,41 @@ const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(isBetween) dayjs.extend(customParseFormat) +const API_ENDPOINT = 'https://raw.githubusercontent.com/matthuisman/i.mjh.nz/master' + module.exports = { site: 'i.mjh.nz', request: { cache: { - ttl: 6 * 60 * 60 * 1000 // 6h + ttl: 3 * 60 * 60 * 1000 // 3h }, - maxContentLength: 20 * 1024 * 1024 // 20Mb + maxContentLength: 30 * 1024 * 1024 // 30Mb }, url: function ({ channel }) { - const [source] = channel.site_id.split('#') + const [path] = channel.site_id.split('#') - return `https://raw.githubusercontent.com/matthuisman/i.mjh.nz/master/${source}.xml` + return `${API_ENDPOINT}/${path}.xml` }, parser: function ({ content, channel, date, cached }) { - let programs = [] - const items = parseItems(content, channel, date) - items.forEach(item => { - programs.push({ - title: parseTitle(item, channel), - description: parseDescription(item, channel), - category: parseCategory(item, channel), - start: parseStart(item), - stop: parseStop(item) - }) - }) - - return programs + return parseItems(content, channel, date) }, async channels({ path, lang = 'en' }) { - const [service] = path.split('/') - let data = await axios - .get(`https://i.mjh.nz/${service}/app.json`) + let xml = await axios + .get(`${API_ENDPOINT}/${path}.xml`) .then(r => r.data) .catch(console.log) + let data = parser.parse(xml) - const channels = [] - const items = data.channels || data - for (let id in items) { - const channel = items[id] - channels.push({ + return data.channels.map(channel => { + return { lang, - site_id: `${path}#${id}`, - name: channel.name - }) - } - - return channels + site_id: `${path}#${channel.id}`, + name: channel.name[0].value + } + }) } } -function parseTitle(item, channel) { - return item.title.length ? item.title[0].value : null -} - -function parseDescription(item, channel) { - return item.desc.length ? item.desc[0].value : null -} - -function parseCategory(item, channel) { - const category = item.category.length ? item.category[0].value : '' - - return category.split(/\s\&\;\s/g).filter(c => c) -} - -function parseStart(item) { - return dayjs(item.start, 'YYYYMMDDHHmmss ZZ') -} - -function parseStop(item) { - return dayjs(item.stop, 'YYYYMMDDHHmmss ZZ') -} - function parseItems(content, channel, date) { try { const curr_day = date From 20be5bc168038cb7f738e6a8f9c1259c26b75afe Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 17:37:37 +0300 Subject: [PATCH 07/13] Create i.mjh.nz_us-skygo.channels.xml --- sites/i.mjh.nz/i.mjh.nz_us-skygo.channels.xml | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sites/i.mjh.nz/i.mjh.nz_us-skygo.channels.xml diff --git a/sites/i.mjh.nz/i.mjh.nz_us-skygo.channels.xml b/sites/i.mjh.nz/i.mjh.nz_us-skygo.channels.xml new file mode 100644 index 00000000..2338b68f --- /dev/null +++ b/sites/i.mjh.nz/i.mjh.nz_us-skygo.channels.xml @@ -0,0 +1,104 @@ + + + + Al Jazeera + Animal Planet + BBC Earth + BBC UKTV + BBC World News + Bravo + Bravo PLUS 1 + Breeze TV + Cartoon Network + Cbeebies + CGTN + CGTN Documentary + CNBC + CNN + Colors + Country TV + Discovery + Discovery Turbo + E! + FACE TV + Firstlight + HGTV + HISTORY + Hope Channel + JONES! + JONES! too + Living + MTV 80s + MTV Hits + MTV + Nickelodeon + Nick Jr. + Nick Music + Parliament TV + Prime + Prime PLUS 1 + Rialto + RT + Shine TV + SKY Arena + Sky Arts + SKY Box Office 041 + SKY Box Office 042 + SKY Box Office 043 + Sky Box Sets + Sky Movies Action + Sky Movies Classics + Sky Movies Family + Sky Movies Greats + Sky Movies Premiere + Sky News + Sky Sport 1 + Sky Sport 2 + Sky Sport 3 + Sky Sport 4 + Sky Sport 5 + Sky Sport 6 + Sky Sport 7 beIN SPORTS + Sky Sport 9 + SoHo + Star Gold + TAB Trackside 1 + TAB Trackside 2 + Te Reo + The Edge TV + Three + ThreePlusOne + TLC + TVNZ 1 + TVNZ 1+1 + TVNZ 2 + TVNZ 2+1 + TVNZ DUKE + DukePlus1 + Universal TV + Vibe + + + + + + + + + + + + + + + + + + + + + + + + + From 8cc92c8b0b4a530ab6bf2761c091257dbbeb0988 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 17:44:22 +0300 Subject: [PATCH 08/13] Update i.mjh.nz.test.js --- sites/i.mjh.nz/i.mjh.nz.test.js | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/sites/i.mjh.nz/i.mjh.nz.test.js b/sites/i.mjh.nz/i.mjh.nz.test.js index 7938511f..09051478 100644 --- a/sites/i.mjh.nz/i.mjh.nz.test.js +++ b/sites/i.mjh.nz/i.mjh.nz.test.js @@ -25,22 +25,20 @@ it('can generate valid url', () => { it('can parse response', () => { const content = ` Little Stars Universe Barney and Friends Baby Bop forgets to say "please" and "thank you". Riff shares his dream of becoming an inventor. Children & Family Barney and Friends Baby Bop forgets to say "please" and "thank you". Riff shares his dream of becoming an inventor. Children & Family ` - const result = parser({ content, channel, date }).map(p => { - p.start = p.start.toJSON() - p.stop = p.stop.toJSON() - return p - }) + const results = parser({ content, channel, date }) - expect(result).toMatchObject([ - { - start: '2022-05-03T10:49:22.000Z', - stop: '2022-05-03T11:21:22.000Z', - title: 'Barney and Friends', - description: - 'Baby Bop forgets to say "please" and "thank you". Riff shares his dream of becoming an inventor.', - category: ['Children', 'Family'] - } - ]) + expect(results[0]).toMatchObject({ + start: '2022-05-03T10:49:22.000Z', + stop: '2022-05-03T11:21:22.000Z', + title: [{ value: 'Barney and Friends' }], + desc: [ + { + value: + 'Baby Bop forgets to say "please" and "thank you". Riff shares his dream of becoming an inventor.' + } + ], + category: [{ value: 'Children & Family' }] + }) }) it('can handle empty guide', () => { From 7b468425839317d203ddc89ce83fe095257134e8 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 17:56:20 +0300 Subject: [PATCH 09/13] Update programs.db --- tests/__data__/expected/database/programs.db | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/__data__/expected/database/programs.db b/tests/__data__/expected/database/programs.db index 48c6128c..7570f0f8 100644 --- a/tests/__data__/expected/database/programs.db +++ b/tests/__data__/expected/database/programs.db @@ -1 +1 @@ -{"titles":[{"lang":"en","value":"InfoNeu "}],"actors":[],"adapters":[],"commentators":[],"composers":[],"date":null,"directors":[],"editors":[],"guests":[],"presenters":[],"producers":[],"sub_titles":[],"urls":[],"writers":[],"descriptions":[],"categories":[],"episodeNumbers":[],"icon":{"src":""},"ratings":[],"channel":"AndorraTV.ad","start":1641711600000,"stop":1641715200000,"site": "chaines-tv.orange.fr","_qid":"0Wefq0oMR3feCcuY","_id":"6AzYe7lqcSN05ZUq"} +{"titles":[{"lang":"en","value":"InfoNeu "}],"actors":[],"adapters":[],"commentators":[],"composers":[],"date":null,"directors":[],"editors":[],"guests":[],"presenters":[],"producers":[],"sub_titles":[],"urls":[],"writers":[],"descriptions":[],"categories":[],"episodeNumbers":[],"icon":{"src":""},"ratings":[],"channel":"CNNInternationalEurope.us","start":1641711600000,"stop":1641715200000,"site": "chaines-tv.orange.fr","_qid":"0Wefq0oMR3feCcuY","_id":"6AzYe7lqcSN05ZUq"} From 0beb51c5cd8f2c81d4f675858a6a799a74092a5e Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 17:56:23 +0300 Subject: [PATCH 10/13] Update cluster_1.log --- tests/__data__/input/logs/cluster/load/cluster_1.log | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/__data__/input/logs/cluster/load/cluster_1.log b/tests/__data__/input/logs/cluster/load/cluster_1.log index 103f79dc..ac86999c 100644 --- a/tests/__data__/input/logs/cluster/load/cluster_1.log +++ b/tests/__data__/input/logs/cluster/load/cluster_1.log @@ -1,2 +1,2 @@ -{"_qid":"0Wefq0oMR3feCcuY","programs":[{"titles":[{"lang":"en","value":"InfoNeu "}],"descriptions":[],"categories":[],"icon":null,"channel":"AndorraTV.ad","site": "chaines-tv.orange.fr","start":1641711600000,"stop":1641715200000}],"error":null} +{"_qid":"0Wefq0oMR3feCcuY","programs":[{"titles":[{"lang":"en","value":"InfoNeu "}],"descriptions":[],"categories":[],"icon":null,"channel":"CNNInternationalEurope.us","site": "chaines-tv.orange.fr","start":1641711600000,"stop":1641715200000}],"error":null} {"_qid":"1XzrxNkSF2AQNBrT","programs":[],"error":"Invalid header value char"} From 73bb824188b59870928982cffbee29ad3b21dd53 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 18:14:45 +0300 Subject: [PATCH 11/13] Update tvgids.nl.config.js --- sites/tvgids.nl/tvgids.nl.config.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sites/tvgids.nl/tvgids.nl.config.js b/sites/tvgids.nl/tvgids.nl.config.js index 91f95c9e..ef1d18bf 100644 --- a/sites/tvgids.nl/tvgids.nl.config.js +++ b/sites/tvgids.nl/tvgids.nl.config.js @@ -3,16 +3,14 @@ const axios = require('axios') const dayjs = require('dayjs') const utc = require('dayjs/plugin/utc') const timezone = require('dayjs/plugin/timezone') -const isToday = require('dayjs/plugin/isToday') dayjs.extend(utc) -dayjs.extend(isToday) dayjs.extend(timezone) module.exports = { site: 'tvgids.nl', url: function ({ date, channel }) { - const path = date.isToday() ? '' : `${date.format('DD-MM-YYYY')}/` + const path = dayjs.utc().isSame(date, 'd') ? '' : `${date.format('DD-MM-YYYY')}/` return `https://www.tvgids.nl/gids/${path}${channel.site_id}` }, From 130bd5283f8a37ac02b1d94e2576a8632c4c55f4 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 18:22:24 +0300 Subject: [PATCH 12/13] Update musor.tv.config.js --- sites/musor.tv/musor.tv.config.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/sites/musor.tv/musor.tv.config.js b/sites/musor.tv/musor.tv.config.js index 28cdf115..594e8602 100644 --- a/sites/musor.tv/musor.tv.config.js +++ b/sites/musor.tv/musor.tv.config.js @@ -10,9 +10,7 @@ dayjs.extend(customParseFormat) module.exports = { site: 'musor.tv', url({ channel, date }) { - const diff = date.diff(dayjs.utc().startOf('d'), 'd') - - return diff === 0 + return dayjs.utc().isSame(date, 'd') ? `https://musor.tv/mai/tvmusor/${channel.site_id}` : `https://musor.tv/napi/tvmusor/${channel.site_id}/${date.format('YYYY.MM.DD')}` }, From 492ae4a11868f8788a725021d80338897a073767 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sun, 20 Nov 2022 18:22:26 +0300 Subject: [PATCH 13/13] Update musor.tv.test.js --- sites/musor.tv/musor.tv.test.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sites/musor.tv/musor.tv.test.js b/sites/musor.tv/musor.tv.test.js index dd94b41d..578351a2 100644 --- a/sites/musor.tv/musor.tv.test.js +++ b/sites/musor.tv/musor.tv.test.js @@ -10,14 +10,20 @@ const customParseFormat = require('dayjs/plugin/customParseFormat') dayjs.extend(customParseFormat) dayjs.extend(utc) -const date = dayjs.utc('2022-11-20', 'YYYY-MM-DD').startOf('d') +const date = dayjs.utc('2022-11-19', 'YYYY-MM-DD').startOf('d') const channel = { site_id: 'HATOS_CSATORNA', xmltv_id: 'Hatoscsatorna.hu' } it('can generate valid url', () => { - expect(url({ channel, date })).toBe('https://musor.tv/napi/tvmusor/HATOS_CSATORNA/2022.11.20') + expect(url({ channel, date })).toBe('https://musor.tv/napi/tvmusor/HATOS_CSATORNA/2022.11.19') +}) + +it('can generate valid url for today', () => { + const today = dayjs.utc().startOf('d') + + expect(url({ channel, date: today })).toBe('https://musor.tv/mai/tvmusor/HATOS_CSATORNA') }) it('can parse response', () => {