Merge pull request #2703 from Aandree5/nostv-icon-image

feat: added icon tag to xml export for nostv
This commit is contained in:
PopeyeTheSai10r 2025-03-05 18:25:50 -08:00 committed by GitHub
commit 0044f19615
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 17 additions and 10 deletions

View file

@ -19,11 +19,10 @@ module.exports = {
site: 'nostv.pt', site: 'nostv.pt',
days: 2, days: 2,
url({ channel, date }) { url({ channel, date }) {
return `https://api.clg.nos.pt/nostv/ott/schedule/range/contents/guest?channels=${ return `https://api.clg.nos.pt/nostv/ott/schedule/range/contents/guest?channels=${channel.site_id
channel.site_id }&minDate=${date.format('YYYY-MM-DD')}T00:00:00Z&maxDate=${date.format(
}&minDate=${date.format('YYYY-MM-DD')}T00:00:00Z&maxDate=${date.format( 'YYYY-MM-DD'
'YYYY-MM-DD' )}T23:59:59Z&isDateInclusive=true&client_id=${headers['X-Apikey']}`
)}T23:59:59Z&isDateInclusive=true&client_id=${headers['X-Apikey']}`
}, },
request: { headers }, request: { headers },
parser({ content }) { parser({ content }) {
@ -31,15 +30,19 @@ module.exports = {
if (content) { if (content) {
const items = Array.isArray(content) ? content : JSON.parse(content) const items = Array.isArray(content) ? content : JSON.parse(content)
items.forEach(item => { items.forEach(item => {
const image = item.Images
? `https://mage.stream.nos.pt/mage/v1/Images?sourceUri=${item.Images[0].Url}&profile=ott_1_452x340&client_id=${headers['X-Apikey']}`
: null
programs.push({ programs.push({
title: item.Metadata?.Title, title: item.Metadata?.Title,
sub_title: item.Metadata?.SubTitle ? item.Metadata?.SubTitle : null, sub_title: item.Metadata?.SubTitle ? item.Metadata?.SubTitle : null,
description: item.Metadata?.Description, description: item.Metadata?.Description,
season: item.Metadata?.Season, season: item.Metadata?.Season,
episode: item.Metadata?.Episode, episode: item.Metadata?.Episode,
image: item.Images icon: {
? `https://mage.stream.nos.pt/v1/nostv_mage/Images?sourceUri=${item.Images[0].Url}&profile=ott_1_452x340&client_id=${headers['X-Apikey']}` src: image
: null, },
image,
start: dayjs.utc(item.UtcDateTimeStart), start: dayjs.utc(item.UtcDateTimeStart),
stop: dayjs.utc(item.UtcDateTimeEnd) stop: dayjs.utc(item.UtcDateTimeEnd)
}) })

View file

@ -28,6 +28,8 @@ it('can parse response', () => {
return p return p
}) })
const image = 'https://mage.stream.nos.pt/mage/v1/Images?sourceUri=http://vip.pam.local.internal/PAM.Images/Store/8329ed1aec5d4c0faa2056972256ff9f&profile=ott_1_452x340&client_id=xe1dgrShwdR1DVOKGmsj8Ut4QLlGyOFI'
expect(results[0]).toMatchObject({ expect(results[0]).toMatchObject({
start: '2023-12-11T16:30:00.000Z', start: '2023-12-11T16:30:00.000Z',
stop: '2023-12-11T17:00:00.000Z', stop: '2023-12-11T17:00:00.000Z',
@ -36,8 +38,10 @@ it('can parse response', () => {
'A história de dois melhores amigos veterinários e o seu extraordinário trabalho na Austrália.', 'A história de dois melhores amigos veterinários e o seu extraordinário trabalho na Austrália.',
season: 1, season: 1,
episode: 12, episode: 12,
image: icon: {
'https://mage.stream.nos.pt/v1/nostv_mage/Images?sourceUri=http://vip.pam.local.internal/PAM.Images/Store/8329ed1aec5d4c0faa2056972256ff9f&profile=ott_1_452x340&client_id=xe1dgrShwdR1DVOKGmsj8Ut4QLlGyOFI' src: image
},
image
}) })
}) })