mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -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 = {
|
||||
site: 'digiturk.com.tr',
|
||||
url: function ({ date, channel }) {
|
||||
|
@ -5,46 +10,61 @@ module.exports = {
|
|||
channel.site_id
|
||||
}/${date.format('YYYY-MM-DD')}/0`
|
||||
},
|
||||
parser: function ({ content, date, channel }) {
|
||||
parser: function ({ content, channel }) {
|
||||
const programs = []
|
||||
const data = JSON.parse(content)
|
||||
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'
|
||||
}
|
||||
|
||||
const items = parseItems(content, channel)
|
||||
items.forEach(item => {
|
||||
if (item.ProgramName && item.BroadcastStart && item.BroadcastEnd) {
|
||||
programs.push({
|
||||
title: item.ProgramName,
|
||||
description: item.LongDescription,
|
||||
category: categories[item.Genre],
|
||||
start: item.BroadcastStart,
|
||||
stop: item.BroadcastEnd
|
||||
})
|
||||
}
|
||||
programs.push({
|
||||
title: item.ProgramName,
|
||||
description: item.LongDescription,
|
||||
category: parseCategory(item),
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item)
|
||||
})
|
||||
})
|
||||
|
||||
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