From 57385b4359e6ebb101b3df4b2e49981d99683c98 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Wed, 10 Nov 2021 13:49:52 +0300 Subject: [PATCH 1/3] Create digiturk.com.tr.test.js --- sites/digiturk.com.tr/digiturk.com.tr.test.js | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 sites/digiturk.com.tr/digiturk.com.tr.test.js diff --git a/sites/digiturk.com.tr/digiturk.com.tr.test.js b/sites/digiturk.com.tr/digiturk.com.tr.test.js new file mode 100644 index 00000000..63913ce9 --- /dev/null +++ b/sites/digiturk.com.tr/digiturk.com.tr.test.js @@ -0,0 +1,45 @@ +// npx epg-grabber --config=sites/digiturk.com.tr/digiturk.com.tr.config.js --channels=sites/digiturk.com.tr/digiturk.com.tr_tr.channels.xml --output=.gh-pages/guides/tr/digiturk.com.tr.epg.xml --days=2 + +const { parser, url, logo } = require('./digiturk.com.tr.config.js') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const customParseFormat = require('dayjs/plugin/customParseFormat') +dayjs.extend(customParseFormat) +dayjs.extend(utc) + +const date = dayjs.utc('2021-11-10', 'YYYY-MM-DD').startOf('d') +const channel = { + site_id: '483', + xmltv_id: 'BeInTurkiye.qa', + logo: 'http://contentlibrary.digiturk.com.tr/Channel/483/Image/72x44_beinhd.png' +} +const content = `{"listings":{"483":[{"ProgramId":null,"ChannelId":483,"ProgramName":"MAÇA KIZI","OrginalName":"QUEEN OF SPADES (2021)","BroadcastStart":"2021-11-10T23:25:00","BroadcastEnd":"2021-11-11T00:53:00","BroadcastDuration":5245,"PartNo":null,"HasSubtitle":false,"ProgramLanguage":null,"ScreenRatio":"4:3","IsLive":false,"Synopsis":"[QUEEN OF SPADES] DÖRT GENÇ, EFSANEYE GÖRE MAÇA KIZI OLARAK BİLİNEN BİR RUHU ÇAĞIRMAK İÇİN RİTÜEL GERÇEKLEŞTİRİRLER.BU RİTÜELİN SONUNDA KORKU DOLU ANLAR YAŞANACAKTIR.","CreatedBy":"EPG Import Service","CreatedDate":"2021-11-10T10:47:00","UpdatedBy":"EPG Import Service","LastModifyDate":"2021-11-10T10:47:00","LastIP":null,"Genre":"E8","Rating":"D6","Year":"2021","Actors":"AVA PRESTON , KAELEN OHM , JAMIE BLOCH ,","SeriesId":null,"SeasonId":null,"LongDescription":"PATRICK WHITE'IN İLK YÖNETMENLİK DENEYİMİ OLAN BU KORKU FİLMİNİN BAŞROLLERİNDE AVA PRESTON VE KAELEN OHM YER ALIYOR.","ServiceRef":"7808","ContentRef":"PV0000340386","EventId":"8432","ScreenSize":null,"AudioType":null,"BroadcastTimeStamp":1636586700,"Directors":"PATRICK WHITE ,","ProductionCountries":"CAN","MasterProductionID":"PT0000324047","EPGBroadcastID":"LYS188925910","Id":1404880537}]}}` + +it('can generate valid url', () => { + const result = url({ date, channel }) + expect(result).toBe('https://www.digiturk.com.tr/yayin-akisi/api/program/kanal/483/2021-11-10/0') +}) + +it('can get logo url', () => { + expect(logo({ channel })).toBe( + 'http://contentlibrary.digiturk.com.tr/Channel/483/Image/72x44_beinhd.png' + ) +}) + +it('can parse response', () => { + const result = parser({ date, channel, content }) + expect(result).toMatchObject([ + { + start: '2021-11-10T20:25:00.000Z', + stop: '2021-11-10T21:53:00.000Z', + title: 'MAÇA KIZI', + description: `PATRICK WHITE'IN İLK YÖNETMENLİK DENEYİMİ OLAN BU KORKU FİLMİNİN BAŞROLLERİNDE AVA PRESTON VE KAELEN OHM YER ALIYOR.`, + category: 'Korku' + } + ]) +}) + +it('can handle empty guide', () => { + const result = parser({ date, channel, content: `{"listings":{"1483":[]}}` }) + expect(result).toMatchObject([]) +}) From 7ba13812bbff8c33617f9d6ea9d15b6ecd7ca345 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Wed, 10 Nov 2021 13:49:59 +0300 Subject: [PATCH 2/3] Update digiturk.com.tr.config.js --- sites/digiturk.com.tr/digiturk.com.tr.config.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/sites/digiturk.com.tr/digiturk.com.tr.config.js b/sites/digiturk.com.tr/digiturk.com.tr.config.js index 2e91dc14..192553cf 100644 --- a/sites/digiturk.com.tr/digiturk.com.tr.config.js +++ b/sites/digiturk.com.tr/digiturk.com.tr.config.js @@ -10,6 +10,9 @@ module.exports = { channel.site_id }/${date.format('YYYY-MM-DD')}/0` }, + logo({ channel }) { + return channel.logo + }, parser: function ({ content, channel }) { const programs = [] const items = parseItems(content, channel) @@ -18,8 +21,8 @@ module.exports = { title: item.ProgramName, description: item.LongDescription, category: parseCategory(item), - start: parseStart(item), - stop: parseStop(item) + start: parseStart(item).toJSON(), + stop: parseStop(item).toJSON() }) }) @@ -64,7 +67,7 @@ function parseCategory(item) { function parseItems(content, channel) { const data = JSON.parse(content) const items = data.listings[channel.site_id] - if (!items.length) return [] + if (!Array.isArray(items)) return [] return items } From 3bb036b44ecbc431387c18889e5ae7679a17edc6 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Wed, 10 Nov 2021 13:50:26 +0300 Subject: [PATCH 3/3] Update digiturk.com.tr_tr.channels.xml --- .../digiturk.com.tr_tr.channels.xml | 178 ++++++++++++------ 1 file changed, 118 insertions(+), 60 deletions(-) diff --git a/sites/digiturk.com.tr/digiturk.com.tr_tr.channels.xml b/sites/digiturk.com.tr/digiturk.com.tr_tr.channels.xml index 95ab411e..fc3f6889 100644 --- a/sites/digiturk.com.tr/digiturk.com.tr_tr.channels.xml +++ b/sites/digiturk.com.tr/digiturk.com.tr_tr.channels.xml @@ -1,65 +1,123 @@ - 360 - A Haber - Aljazeera English - ATV Türkiye - BBC Entertainment Europe - BBC First Türkiye - BBC World News Europe - BeIn Box Office 1 Türkiye - BeIn Box Office 2 Türkiye - BeIn Box Office 3 Türkiye - BeIn Gurme - BeIn H&E - BeIn Iz - BeIn Movies Action - BeIn Movies Action 2 - BeIn Movies Family - BeIn Movies Premiere - BeIn Movies Premiere 2 - BeIn Movies Stars - BeIn Movies Turk - BeIn Series Comedy - BeIn Series Drama - BeIn Series Sci-Fi - BeIn Series Vice - BeIn Sports 1 Türkiye - Bloomberg HT - Bloomberg TV Europe - Cartoon Network Türkiye - CNN International Europe - CNN Türk - Discovery Channel Türkiye - Discovery Science Türkiye - Disney Channel Türkiye - Disney Junior Türkiye & Polska - DMAX Türkiye - EuroNews English - Eurosport 1 - Eurosport 2 - FashionTV HD Europe - Fox Türkiye - France 24 English - Habertürk - Kanal 7 - MCM Top - Mezzo - MTV Hits Europe - MTV Live HD - National Geographic Türkiye - Nickelodeon Türkiye - Nick Jr Türkiye - NTV - Rai 1 - Show TV - Star TV - Teve 2 - TRT Arabi - TRT World - TV5Monde Europe - TV 8 - VH1 Europe + 24 TV + 360 + A2 + A Haber + Aljazeera English + A Para + A Spor + ATV Türkiye + Baby TV Europe + BBC Earth Türkiye + BBC Entertainment Europe + BBC First Türkiye + BBC World News Europe + BeIn Box Office 1 Türkiye + BeIn Box Office 2 Türkiye + BeIn Box Office 3 Türkiye + BeIn Gurme + BeIn H&E + BeIn Iz + BeIn Movies Action + BeIn Movies Action 2 + BeIn Movies Family + BeIn Movies Premiere + BeIn Movies Premiere 2 + BeIn Movies Stars + BeIn Movies Turk + BeIn Series Comedy + BeIn Series Drama + BeIn Series Sci-Fi + BeIn Series Vice + BeIn Sports 1 Türkiye + BeIn Sports 2 Türkiye + BeIn Sports 3 Türkiye + BeIn Sports 4 Türkiye + BeIn Sports Haber + BeIn Sports Max 1 Türkiye + BeIn Sports Max 2 Türkiye + BeIn Türkiye + Beyaz TV + Bloomberg HT + Bloomberg TV Europe + Boomerang Türkiye + Cartoon Network Türkiye + CBeebies Türkiye + CGTN + CGTN Documentary + CNN International Europe + CNN Türk + Da Vinci + Digiturk 4K + Discovery Channel Türkiye + Discovery Science Türkiye + Disney Channel Türkiye + Disney Junior Türkiye & Polska + Diyanet TV + DMAX Türkiye + EBA TV Ilkokul + EBA TV Lise + EBA TV Ortaokul + Ekotürk + EuroNews English + Eurosport 1 + Eurosport 2 + FashionTV HD Europe + FB TV + Fox Türkiye + France 24 English + GS TV + Haber Global + Habertürk + Halk TV + Kanal 7 + Kanal D + KRT + MCM Top + Mezzo + Minika Go + MTV 00s + MTV Hits Europe + MTV Live + National Geographic Türkiye + National Geographic Wild Türkiye + Nickelodeon HD + Nickelodeon Türkiye + Nick Jr Türkiye + NTV + Quran TV + Rai 1 + RTR Planeta + Show TV + Star TV + Sunna TV + Tele 1 + Teve 2 + TGRT Haber + TJK TV + TLC Türkiye + TRT 1 + TRT 2 + TRT Arabi + TRT Avaz + TRT Belgesel + TRT Çocuk + TRT Haber + TRT Kurdî + TRT Müzik + TRT Spor + TRT Spor Yildiz + TRT Türk + TRT World + TV5Monde Europe + TV 8 + TV 100 + TV Net + Ülke TV + Ulusal Kanal + Vav TV + Yaban \ No newline at end of file