mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-11 01:20:08 -04:00
commit
7a88d5553b
3 changed files with 28 additions and 8 deletions
1
sites/tvtv.us/.gitignore
vendored
1
sites/tvtv.us/.gitignore
vendored
|
@ -1 +0,0 @@
|
|||
*.crawler.js
|
|
@ -24,6 +24,8 @@ module.exports = {
|
|||
title: parseTitle(item),
|
||||
description: parseDescription(item),
|
||||
category: parseCategory(item),
|
||||
season: parseSeason(item),
|
||||
episode: parseEpisode(item),
|
||||
start: parseStart(item),
|
||||
stop: parseStop(item),
|
||||
icon: parseIcon(item)
|
||||
|
@ -76,6 +78,14 @@ function parseCategory(item) {
|
|||
return item.program.genres || []
|
||||
}
|
||||
|
||||
function parseSeason(item) {
|
||||
return item.program.seasonNum || null
|
||||
}
|
||||
|
||||
function parseEpisode(item) {
|
||||
return item.program.episodeNum || null
|
||||
}
|
||||
|
||||
function parseIcon(item) {
|
||||
return item.program.preferredImage && item.program.preferredImage.uri
|
||||
? `http://tvtv.tmsimg.com/${item.program.preferredImage.uri}`
|
||||
|
|
|
@ -26,7 +26,8 @@ it('can get logo url', () => {
|
|||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = `[{"startTime":"2022-01-17T00:00Z","endTime":"2022-01-17T01:00Z","duration":60,"qualifiers":["CC","DVS","Stereo"],"program":{"tmsId":"SH010146820000","rootId":"811777","seriesId":"811777","subType":"Series","title":"Murdoch Mysteries","releaseYear":2008,"releaseDate":"2008-01-24","origAirDate":"2008-01-24","titleLang":"en","descriptionLang":"en","entityType":"Show","genres":["Drama","Mystery"],"longDescription":"Based on novels by Maureen Jennings, \\"Murdoch Mysteries\\" follows young detective William Murdoch. In a series of stories taking place in Toronto during the 1890s and early 1900s, several challenging murder cases arise. Murdoch uses up-and-coming forensics techniques and an unconventional approach, which often elicit skepticism from his fellow officers and his boss. Coroner Julia Ogden becomes Murdoch's number one ally, and they make a top-notch team, but he must struggle against tradition and prejudice to solve some of the city's most-gruesome murders.","shortDescription":"Detective William Murdoch uses radical techniques to solve murders.","topCast":["Yannick Bisson","Helene Joy","Jonny Harris"],"ratings":[{"body":"Mediakasvatus- ja kuvaohjelmayksikkö","code":"K16"},{"body":"Canadian Parental Rating","code":"PG"},{"body":"USA Parental Rating","code":"TVPG"},{"body":"Film & Publication Board","code":"13"},{"body":"Departamento de Justiça, Classificação, Títulos e Qualificação","code":"16","subRating":"Violência|Atos Criminosos"},{"body":"Australian Classification Board","code":"MA 15+"}],"preferredImage":{"width":"240","height":"360","uri":"assets/p20615554_b_v8_ab.jpg?w=240&h=360","category":"Banner-L1","text":"yes","primary":"true","tier":"Season"}},"station":{"stationId":"62670","callSign":"AMITV","videoQuality":{"signalType":"Digital","videoType":"SDTV"},"preferredImage":{"width":"360","height":"270","uri":"assets/s62670_ll_h15_ab.png?w=360&h=270","category":"Logo","primary":"true"}}}]`
|
||||
const content = `[{"startTime":"2022-01-20T00:00Z","endTime":"2022-01-20T00:30Z","duration":30,"qualifiers":["CC","DVS"],"program":{"tmsId":"EP031727440006","rootId":"16777148","seriesId":"16640522","subType":"Series","title":"Reflect and Renew With Kevin Naidoo","episodeTitle":"Empowerment","releaseYear":2019,"releaseDate":"2019-04-20","origAirDate":"2019-04-20","titleLang":"en","descriptionLang":"en","entityType":"Episode","genres":["Health"],"longDescription":"Kevin demonstrates a meditation and yoga practice to reclaim his courage and confidence.","shortDescription":"Kevin demonstrates a meditation and yoga practice to reclaim his courage and confidence.","episodeNum":6,"seasonNum":1,"ratings":[{"body":"Régie du cinéma","code":"G"},{"body":"USA Parental Rating","code":"TVG"},{"body":"Canadian Parental Rating","code":"G"}],"preferredImage":{"width":"240","height":"360","uri":"assets/p16640522_b_v9_aa.jpg?w=240&h=360","category":"Banner-L2","text":"yes","primary":"true","tier":"Series"}},"station":{"stationId":"62670","callSign":"AMITV","videoQuality":{"signalType":"Digital","videoType":"SDTV"},"preferredImage":{"width":"360","height":"270","uri":"assets/s62670_ll_h15_ab.png?w=360&h=270","category":"Logo","primary":"true"}}},{"startTime":"2022-01-20T00:30Z","endTime":"2022-01-20T01:00Z","duration":30,"qualifiers":["CC","DVS"],"program":{"tmsId":"EP018574900040","rootId":"12448902","seriesId":"10464580","subType":"Series","title":"Four Senses","episodeTitle":"Sizzled & Seared","releaseYear":2016,"releaseDate":"2016-01-14","origAirDate":"2016-01-14","titleLang":"en","descriptionLang":"en","entityType":"Episode","genres":["House/garden"],"longDescription":"Everything is sizzled and seared as chef Corbin Tomaszeski joins Christine and Carl in the kitchen.","shortDescription":"Everything is sizzled and seared as chef Corbin Tomaszeski joins Christine and Carl in the kitchen.","topCast":["Carl Heinrich","Christine Ha"],"ratings":[{"body":"Canadian Parental Rating","code":"G"},{"body":"USA Parental Rating","code":"TVG"},{"body":"Régie du cinéma","code":"G"}],"preferredImage":{"width":"240","height":"360","uri":"assets/p10464580_b_v7_aa.jpg?w=240&h=360","category":"Banner-L1","text":"yes","primary":"true","tier":"Series"}},"station":{"stationId":"62670","callSign":"AMITV","videoQuality":{"signalType":"Digital","videoType":"SDTV"},"preferredImage":{"width":"360","height":"270","uri":"assets/s62670_ll_h15_ab.png?w=360&h=270","category":"Logo","primary":"true"}}}]`
|
||||
|
||||
const result = parser({ content }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
|
@ -35,12 +36,22 @@ it('can parse response', () => {
|
|||
|
||||
expect(result).toMatchObject([
|
||||
{
|
||||
start: '2022-01-17T00:00:00.000Z',
|
||||
stop: '2022-01-17T01:00:00.000Z',
|
||||
title: 'Murdoch Mysteries',
|
||||
description: `Based on novels by Maureen Jennings, \"Murdoch Mysteries\" follows young detective William Murdoch. In a series of stories taking place in Toronto during the 1890s and early 1900s, several challenging murder cases arise. Murdoch uses up-and-coming forensics techniques and an unconventional approach, which often elicit skepticism from his fellow officers and his boss. Coroner Julia Ogden becomes Murdoch's number one ally, and they make a top-notch team, but he must struggle against tradition and prejudice to solve some of the city's most-gruesome murders.`,
|
||||
category: ['Drama', 'Mystery'],
|
||||
icon: 'http://tvtv.tmsimg.com/assets/p20615554_b_v8_ab.jpg?w=240&h=360'
|
||||
start: '2022-01-20T00:00:00.000Z',
|
||||
stop: '2022-01-20T00:30:00.000Z',
|
||||
title: 'Reflect and Renew With Kevin Naidoo',
|
||||
description: `Kevin demonstrates a meditation and yoga practice to reclaim his courage and confidence.`,
|
||||
category: ['Health'],
|
||||
season: 1,
|
||||
episode: 6,
|
||||
icon: 'http://tvtv.tmsimg.com/assets/p16640522_b_v9_aa.jpg?w=240&h=360'
|
||||
},
|
||||
{
|
||||
start: '2022-01-20T00:30:00.000Z',
|
||||
stop: '2022-01-20T01:00:00.000Z',
|
||||
title: 'Four Senses',
|
||||
description: `Everything is sizzled and seared as chef Corbin Tomaszeski joins Christine and Carl in the kitchen.`,
|
||||
category: ['House/garden'],
|
||||
icon: 'http://tvtv.tmsimg.com/assets/p10464580_b_v7_aa.jpg?w=240&h=360'
|
||||
}
|
||||
])
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue