mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Update digiturk.com.tr.config.js
This commit is contained in:
parent
1c92a69b60
commit
97b65304ce
1 changed files with 56 additions and 36 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
const dayjs = require('dayjs')
|
||||||
|
const timezone = require('dayjs/plugin/timezone')
|
||||||
|
|
||||||
|
dayjs.extend(timezone)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'digiturk.com.tr',
|
site: 'digiturk.com.tr',
|
||||||
url: function ({ date, channel }) {
|
url: function ({ date, channel }) {
|
||||||
|
@ -5,46 +10,61 @@ module.exports = {
|
||||||
channel.site_id
|
channel.site_id
|
||||||
}/${date.format('YYYY-MM-DD')}/0`
|
}/${date.format('YYYY-MM-DD')}/0`
|
||||||
},
|
},
|
||||||
parser: function ({ content, date, channel }) {
|
parser: function ({ content, channel }) {
|
||||||
const programs = []
|
const programs = []
|
||||||
const data = JSON.parse(content)
|
const items = parseItems(content, channel)
|
||||||
const items = data.listings[channel.site_id]
|
|
||||||
if (!items.length) return programs
|
|
||||||
|
|
||||||
const categories = {
|
|
||||||
'00': 'Diğer',
|
|
||||||
E0: 'Romantik Komedi',
|
|
||||||
E1: 'Aksiyon',
|
|
||||||
E4: 'Macera',
|
|
||||||
E5: 'Dram',
|
|
||||||
E6: 'Fantastik',
|
|
||||||
E7: 'Komedi',
|
|
||||||
E8: 'Korku',
|
|
||||||
EB: 'Polisiye',
|
|
||||||
EF: 'Western',
|
|
||||||
FA: 'Macera',
|
|
||||||
FB: 'Yarışma',
|
|
||||||
FC: 'Eğlence',
|
|
||||||
F0: 'Reality-Show',
|
|
||||||
F2: 'Haberler',
|
|
||||||
F4: 'Belgesel',
|
|
||||||
F6: 'Eğitim',
|
|
||||||
F7: 'Sanat ve Kültür',
|
|
||||||
F9: 'Life Style'
|
|
||||||
}
|
|
||||||
|
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
if (item.ProgramName && item.BroadcastStart && item.BroadcastEnd) {
|
programs.push({
|
||||||
programs.push({
|
title: item.ProgramName,
|
||||||
title: item.ProgramName,
|
description: item.LongDescription,
|
||||||
description: item.LongDescription,
|
category: parseCategory(item),
|
||||||
category: categories[item.Genre],
|
start: parseStart(item),
|
||||||
start: item.BroadcastStart,
|
stop: parseStop(item)
|
||||||
stop: item.BroadcastEnd
|
})
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
return programs
|
return programs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parseStart(item) {
|
||||||
|
return dayjs.tz(item.BroadcastStart, 'Europe/Istanbul')
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseStop(item) {
|
||||||
|
return dayjs.tz(item.BroadcastEnd, 'Europe/Istanbul')
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseCategory(item) {
|
||||||
|
const categories = {
|
||||||
|
'00': 'Diğer',
|
||||||
|
E0: 'Romantik Komedi',
|
||||||
|
E1: 'Aksiyon',
|
||||||
|
E4: 'Macera',
|
||||||
|
E5: 'Dram',
|
||||||
|
E6: 'Fantastik',
|
||||||
|
E7: 'Komedi',
|
||||||
|
E8: 'Korku',
|
||||||
|
EB: 'Polisiye',
|
||||||
|
EF: 'Western',
|
||||||
|
FA: 'Macera',
|
||||||
|
FB: 'Yarışma',
|
||||||
|
FC: 'Eğlence',
|
||||||
|
F0: 'Reality-Show',
|
||||||
|
F2: 'Haberler',
|
||||||
|
F4: 'Belgesel',
|
||||||
|
F6: 'Eğitim',
|
||||||
|
F7: 'Sanat ve Kültür',
|
||||||
|
F9: 'Life Style'
|
||||||
|
}
|
||||||
|
|
||||||
|
return categories[item.Genre]
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseItems(content, channel) {
|
||||||
|
const data = JSON.parse(content)
|
||||||
|
const items = data.listings[channel.site_id]
|
||||||
|
if (!items.length) return []
|
||||||
|
|
||||||
|
return items
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue