Merge pull request #907 from Arkina1234/patch-18

Patch 18
This commit is contained in:
Aleksandr Statciuk 2022-07-07 12:43:27 +03:00 committed by GitHub
commit 6de98c46fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

@ -54,13 +54,15 @@ module.exports = {
channel = {
site_id: station.id,
name: stationData.name,
xmltv_id: parseChannelId(stationData)
xmltv_id: parseChannelId(stationData),
logo: parseChannelIcon(item)
}
break
default:
channel = {
site_id: station.id,
name: stationData.name
name: stationData.name,
logo: parseChannelIcon(item)
}
break
}
@ -125,3 +127,9 @@ function parseIcon(item) {
? `https://tvtv.us/gn/i/${item.program.preferredImage.uri}`
: null
}
function parseChannelIcon(item) {
return item.station.preferredImage && item.station.preferredImage.uri
? `https://tvtv.us/gn/i/${item.station.preferredImage.uri}`
: null
}

View file

@ -11,7 +11,8 @@ dayjs.extend(utc)
const date = dayjs.utc('2022-01-17', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '62670',
xmltv_id: 'AMITV.ca'
xmltv_id: 'AMITV.ca',
logo: 'https://tvtv.us/gn/i/assets/s62670_ll_h15_ab.png?w=360&h=270'
}
it('can generate valid url', () => {