mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 17:10:07 -04:00
Merge pull request #1127 from RevGear/programetv.ro
programetv.ro dual language
This commit is contained in:
commit
347aa21f75
2 changed files with 38 additions and 12 deletions
|
@ -1,4 +1,7 @@
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
|
const utc = require('dayjs/plugin/utc')
|
||||||
|
|
||||||
|
dayjs.extend(utc)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'programetv.ro',
|
site: 'programetv.ro',
|
||||||
|
@ -16,21 +19,26 @@ module.exports = {
|
||||||
|
|
||||||
return `https://www.programetv.ro/post/${channel.site_id}/${daysOfWeek[day]}/`
|
return `https://www.programetv.ro/post/${channel.site_id}/${daysOfWeek[day]}/`
|
||||||
},
|
},
|
||||||
parser: function ({ content }) {
|
parser: function ({ content, channel }) {
|
||||||
let programs = []
|
let programs = []
|
||||||
const data = parseContent(content)
|
const data = parseContent(content)
|
||||||
if (!data || !data.shows) return programs
|
if (!data || !data.shows) return programs
|
||||||
const items = data.shows
|
const items = data.shows
|
||||||
items.forEach(item => {
|
items.forEach(item => {
|
||||||
let title = item.title
|
|
||||||
if (item.season) title += ` Sez.${item.season}`
|
|
||||||
if (item.episode) title += ` Ep.${item.episode}`
|
|
||||||
programs.push({
|
programs.push({
|
||||||
title,
|
title: item.title,
|
||||||
description: item.desc,
|
sub_title: item.titleOriginal,
|
||||||
|
description: item.desc || item.obs,
|
||||||
category: item.categories,
|
category: item.categories,
|
||||||
start: parseStart(item).toString(),
|
season: item.season || null,
|
||||||
stop: parseStop(item).toString(),
|
episode: item.episode || null,
|
||||||
|
start: parseStart(item),
|
||||||
|
stop: parseStop(item),
|
||||||
|
url: item.url || null,
|
||||||
|
date: item.date,
|
||||||
|
rating: parseRating(item),
|
||||||
|
directors: parseDirector(item),
|
||||||
|
actors: parseActor(item),
|
||||||
icon: item.icon
|
icon: item.icon
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -40,11 +48,11 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseStart(item) {
|
function parseStart(item) {
|
||||||
return dayjs(item.start).utc()
|
return dayjs(item.start).toJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseStop(item) {
|
function parseStop(item) {
|
||||||
return dayjs(item.stop).utc()
|
return dayjs(item.stop).toJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseContent(content) {
|
function parseContent(content) {
|
||||||
|
@ -52,3 +60,21 @@ function parseContent(content) {
|
||||||
|
|
||||||
return data ? JSON.parse(data) : {}
|
return data ? JSON.parse(data) : {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function parseDirector(item) {
|
||||||
|
return item.credits && item.credits.director ? item.credits.director : null
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseActor(item) {
|
||||||
|
return item.credits && item.credits.actor ? item.credits.actor : null
|
||||||
|
}
|
||||||
|
|
||||||
|
function parseRating(item) {
|
||||||
|
return item.rating
|
||||||
|
? {
|
||||||
|
system: 'CNC',
|
||||||
|
value: item.rating.toUpperCase()
|
||||||
|
}
|
||||||
|
: null
|
||||||
|
}
|
||||||
|
|
|
@ -35,8 +35,8 @@ it('can parse response', () => {
|
||||||
const result = parser({ date, channel, content })
|
const result = parser({ date, channel, content })
|
||||||
expect(result).toMatchObject([
|
expect(result).toMatchObject([
|
||||||
{
|
{
|
||||||
start: 'Sun, 07 Nov 2021 05:00:00 GMT',
|
start: '2021-11-07T05:00:00.000Z',
|
||||||
stop: 'Sun, 07 Nov 2021 07:59:59 GMT',
|
stop: '2021-11-07T07:59:59.000Z',
|
||||||
title: 'Ştirile Pro Tv',
|
title: 'Ştirile Pro Tv',
|
||||||
description: `În fiecare zi, cele mai importante evenimente, transmisiuni LIVE, analize, anchete şi reportaje sunt la Ştirile ProTV.`,
|
description: `În fiecare zi, cele mai importante evenimente, transmisiuni LIVE, analize, anchete şi reportaje sunt la Ştirile ProTV.`,
|
||||||
category: ['Ştiri'],
|
category: ['Ştiri'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue