update plex 2

fix parser context
This commit is contained in:
StrangeDrVN
2026-01-15 17:53:47 +05:30
parent 1be21bcf90
commit 85f829b2db
3 changed files with 2220 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

@@ -20,10 +20,13 @@ module.exports = {
const items = parseItems(content) const items = parseItems(content)
for (let item of items) { for (let item of items) {
programs.push({ programs.push({
title: item.title, title: item.grandparentTitle || item.title,
subTitle: (item.grandparentTitle && item.title !== item.grandparentTitle) ? item.title : null,
description: item.summary, description: item.summary,
categories: parseCategories(item), categories: parseCategories(item),
image: item.art, season: item.parentIndex || null,
episode: item.index || null,
image: item.thumb || item.grandparentThumb || null,
start: parseStart(item), start: parseStart(item),
stop: parseStop(item) stop: parseStop(item)
}) })

View File

@@ -31,20 +31,25 @@ it('can parse response', () => {
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json')) const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
let results = parser({ content }) let results = parser({ content })
results = results.map(p => { results = results.map(p => {
p.start = p.start.toJSON() if (p.start) p.start = p.start.toJSON()
p.stop = p.stop.toJSON() if (p.stop) p.stop = p.stop.toJSON()
return p return p
}) })
// expect(results.length).toBe(15)
expect(results[0]).toMatchObject({ expect(results[0]).toMatchObject({
start: '2023-02-04T23:31:14.000Z', title: 'The Nanny',
stop: '2023-02-05T01:10:45.000Z', subTitle: "Yetta's Lettas",
title: 'Violet & Daisy', description: expect.stringContaining('Maxwell battles an old rival'),
description: image: expect.stringContaining('http')
'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'] 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')
}) })
}) })