mirror of
https://github.com/iptv-org/epg
synced 2026-03-21 19:30:52 -04:00
update plex 2
fix parser context
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -20,10 +20,13 @@ module.exports = {
|
||||
const items = parseItems(content)
|
||||
for (let item of items) {
|
||||
programs.push({
|
||||
title: item.title,
|
||||
title: item.grandparentTitle || item.title,
|
||||
subTitle: (item.grandparentTitle && item.title !== item.grandparentTitle) ? item.title : null,
|
||||
description: item.summary,
|
||||
categories: parseCategories(item),
|
||||
image: item.art,
|
||||
season: item.parentIndex || null,
|
||||
episode: item.index || null,
|
||||
image: item.thumb || item.grandparentThumb || null,
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item)
|
||||
})
|
||||
|
||||
@@ -31,20 +31,25 @@ it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||
let results = parser({ content })
|
||||
results = results.map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
if (p.start) p.start = p.start.toJSON()
|
||||
if (p.stop) p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
// expect(results.length).toBe(15)
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2023-02-04T23:31:14.000Z',
|
||||
stop: '2023-02-05T01:10:45.000Z',
|
||||
title: 'Violet & Daisy',
|
||||
description:
|
||||
'Two teenage assassins accept what they think will be a quick-and-easy job, until an unexpected target throws them off their plan.',
|
||||
image: 'https://provider-static.plex.tv/epg/images/ott_channels/arts/darkmatter-tv-about.jpg',
|
||||
categories: ['Movies']
|
||||
title: 'The Nanny',
|
||||
subTitle: "Yetta's Lettas",
|
||||
description: expect.stringContaining('Maxwell battles an old rival'),
|
||||
image: expect.stringContaining('http')
|
||||
})
|
||||
|
||||
expect(results[1]).toMatchObject({
|
||||
title: 'The Nanny',
|
||||
subTitle: 'The Baby Shower',
|
||||
description: expect.stringContaining('A psychic predicts that Maxwell'),
|
||||
season: 6,
|
||||
episode: 20,
|
||||
image: expect.stringContaining('17nyw13tvyrd61fd9cimazndar.png')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user