mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
commit
0a13f70f22
9 changed files with 161373 additions and 18 deletions
161326
sites/i.mjh.nz/__data__/content.xml
Normal file
161326
sites/i.mjh.nz/__data__/content.xml
Normal file
File diff suppressed because it is too large
Load diff
|
@ -13,10 +13,11 @@ module.exports = {
|
||||||
site: 'i.mjh.nz',
|
site: 'i.mjh.nz',
|
||||||
days: 2,
|
days: 2,
|
||||||
request: {
|
request: {
|
||||||
|
timeout: 30000, // 30s
|
||||||
cache: {
|
cache: {
|
||||||
ttl: 3 * 60 * 60 * 1000 // 3h
|
ttl: 3 * 60 * 60 * 1000 // 3h
|
||||||
},
|
},
|
||||||
maxContentLength: 30 * 1024 * 1024 // 30Mb
|
maxContentLength: 100 * 1024 * 1024 // 100Mb
|
||||||
},
|
},
|
||||||
url: function ({ channel }) {
|
url: function ({ channel }) {
|
||||||
const [path] = channel.site_id.split('#')
|
const [path] = channel.site_id.split('#')
|
||||||
|
@ -26,7 +27,7 @@ module.exports = {
|
||||||
parser: function ({ content, channel, date, cached }) {
|
parser: function ({ content, channel, date, cached }) {
|
||||||
const items = parseItems(content, channel, date)
|
const items = parseItems(content, channel, date)
|
||||||
|
|
||||||
return items.map(item => {
|
let programs = items.map(item => {
|
||||||
return {
|
return {
|
||||||
...item,
|
...item,
|
||||||
title: getTitle(item),
|
title: getTitle(item),
|
||||||
|
@ -34,6 +35,10 @@ module.exports = {
|
||||||
categories: getCategories(item)
|
categories: getCategories(item)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
programs = mergeMovieParts(programs)
|
||||||
|
|
||||||
|
return programs
|
||||||
},
|
},
|
||||||
async channels({ path, lang = 'en' }) {
|
async channels({ path, lang = 'en' }) {
|
||||||
let xml = await axios
|
let xml = await axios
|
||||||
|
@ -52,6 +57,27 @@ module.exports = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mergeMovieParts(programs) {
|
||||||
|
let output = []
|
||||||
|
|
||||||
|
programs.forEach(prog => {
|
||||||
|
let prev = output[output.length - 1]
|
||||||
|
let found =
|
||||||
|
prev &&
|
||||||
|
prog.categories.includes('Movie') &&
|
||||||
|
prev.title === prog.title &&
|
||||||
|
prev.description === prog.description
|
||||||
|
|
||||||
|
if (found) {
|
||||||
|
prev.stop = prog.stop
|
||||||
|
} else {
|
||||||
|
output.push(prog)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
return output
|
||||||
|
}
|
||||||
|
|
||||||
function getTitle(item) {
|
function getTitle(item) {
|
||||||
return item.title.length ? item.title[0].value : null
|
return item.title.length ? item.title[0].value : null
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +1,42 @@
|
||||||
// npm run channels:parse -- --config=./sites/i.mjh.nz/i.mjh.nz.config.js --output=./sites/i.mjh.nz/i.mjh.nz_us-pluto.channels.xml --set=path:PlutoTV/us
|
// npm run channels:parse -- --config=./sites/i.mjh.nz/i.mjh.nz.config.js --output=./sites/i.mjh.nz/i.mjh.nz_pluto.channels.xml --set=path:PlutoTV/all
|
||||||
// npx epg-grabber --config=sites/i.mjh.nz/i.mjh.nz.config.js --channels=sites/i.mjh.nz/i.mjh.nz_us-pluto.channels.xml --output=guide.xml --days=2
|
// npx epg-grabber --config=sites/i.mjh.nz/i.mjh.nz.config.js --channels=sites/i.mjh.nz/i.mjh.nz_plex.channels.xml --output=guide.xml
|
||||||
// npx epg-grabber --config=sites/i.mjh.nz/i.mjh.nz.config.js --channels=sites/i.mjh.nz/i.mjh.nz_us-stirr.channels.xml --output=guide.xml --days=2
|
|
||||||
// npx epg-grabber --config=sites/i.mjh.nz/i.mjh.nz.config.js --channels=sites/i.mjh.nz/i.mjh.nz_au-skygo.channels.xml --output=guide.xml --days=2
|
|
||||||
|
|
||||||
const { parser, url } = require('./i.mjh.nz.config.js')
|
const { parser, url } = require('./i.mjh.nz.config.js')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
dayjs.extend(customParseFormat)
|
dayjs.extend(customParseFormat)
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
|
|
||||||
const date = dayjs.utc('2022-05-03', 'YYYY-MM-DD').startOf('d')
|
const date = dayjs.utc('2023-06-23', 'YYYY-MM-DD').startOf('d')
|
||||||
const channel = {
|
const channel = {
|
||||||
site_id: 'PlutoTV/us#51c75f7bb6f26ba1cd00002f',
|
site_id: 'Plex/all#5e20b730f2f8d5003d739db7-5eea605674085f0040ddc7a6',
|
||||||
xmltv_id: 'LittleStarsUniverse.us',
|
xmltv_id: 'DarkMatterTV.us',
|
||||||
lang: 'en'
|
lang: 'en'
|
||||||
}
|
}
|
||||||
|
|
||||||
it('can generate valid url', () => {
|
it('can generate valid url', () => {
|
||||||
expect(url({ channel })).toBe(
|
expect(url({ channel })).toBe(
|
||||||
'https://raw.githubusercontent.com/matthuisman/i.mjh.nz/master/PlutoTV/us.xml'
|
'https://raw.githubusercontent.com/matthuisman/i.mjh.nz/master/Plex/all.xml'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
const content = `<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE tv SYSTEM "xmltv.dtd"><tv generator-info-name="www.matthuisman.nz"> <channel id="51c75f7bb6f26ba1cd00002f"> <display-name>Little Stars Universe</display-name> <icon src="https://images.pluto.tv/channels/51c75f7bb6f26ba1cd00002f/colorLogoPNG.png"/> </channel> <programme channel="51c75f7bb6f26ba1cd00002f" start="20220503104922 +0000" stop="20220503112122 +0000"> <title>Barney and Friends</title> <desc>Baby Bop forgets to say "please" and "thank you". Riff shares his dream of becoming an inventor.</desc> <category>Children & Family</category> </programme><programme channel="51c75f7bb6f26ba1cd00002f" start="20220504104922 +0000" stop="20220504112122 +0000"> <title>Barney and Friends</title> <desc>Baby Bop forgets to say "please" and "thank you". Riff shares his dream of becoming an inventor.</desc> <category>Children & Family</category> </programme></tv>`
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.xml'))
|
||||||
const results = parser({ content, channel, date })
|
const results = parser({ content, channel, date })
|
||||||
|
|
||||||
|
expect(results.length).toBe(11)
|
||||||
expect(results[0]).toMatchObject({
|
expect(results[0]).toMatchObject({
|
||||||
start: '2022-05-03T10:49:22.000Z',
|
start: '2023-06-23T07:14:32.000Z',
|
||||||
stop: '2022-05-03T11:21:22.000Z',
|
stop: '2023-06-23T09:09:36.000Z',
|
||||||
title: 'Barney and Friends',
|
title: 'Killers Within',
|
||||||
|
date: ['20180101'],
|
||||||
description:
|
description:
|
||||||
'Baby Bop forgets to say "please" and "thank you". Riff shares his dream of becoming an inventor.',
|
'With her son being held captive by a criminal gang, police officer Amanda Doyle, together with her ex-husband and three unlikely allies, takes part in a desperate plot to hold a wealthy banker and his family to ransom. But this is no ordinary family.',
|
||||||
categories: ['Children & Family']
|
icon: ['https://provider-static.plex.tv/epg/images/thumbnails/darkmatter-tv-fallback.jpg'],
|
||||||
|
categories: ['Movie']
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
@ -329,4 +329,4 @@
|
||||||
<!-- <channel lang="en" xmltv_id="" site_id="Plex/all#5e20b730f2f8d5003d739db7-635195e9ccee3e1547a8831a">Farscape</channel> -->
|
<!-- <channel lang="en" xmltv_id="" site_id="Plex/all#5e20b730f2f8d5003d739db7-635195e9ccee3e1547a8831a">Farscape</channel> -->
|
||||||
<!-- <channel lang="en" xmltv_id="" site_id="Plex/all#5e20b730f2f8d5003d739db7-6351991cccee3e1547a8831e">Scream Factory TV</channel> -->
|
<!-- <channel lang="en" xmltv_id="" site_id="Plex/all#5e20b730f2f8d5003d739db7-6351991cccee3e1547a8831e">Scream Factory TV</channel> -->
|
||||||
</channels>
|
</channels>
|
||||||
</site>
|
</site>
|
|
@ -75,7 +75,7 @@
|
||||||
<channel lang="en" xmltv_id="ClassicTVFamilies.us" site_id="PlutoTV/us#61325d18f5166c00081b84e0">Classic TV: Families</channel>
|
<channel lang="en" xmltv_id="ClassicTVFamilies.us" site_id="PlutoTV/us#61325d18f5166c00081b84e0">Classic TV: Families</channel>
|
||||||
<channel lang="en" xmltv_id="CMTEqualPlay.us" site_id="PlutoTV/us#5f68f53eb1e5800007390bf8">CMT Equal Play</channel>
|
<channel lang="en" xmltv_id="CMTEqualPlay.us" site_id="PlutoTV/us#5f68f53eb1e5800007390bf8">CMT Equal Play</channel>
|
||||||
<channel lang="en" xmltv_id="CMTPlutoTV.us" site_id="PlutoTV/us#5dcc42446750e200093b15e2">CMT Pluto TV</channel>
|
<channel lang="en" xmltv_id="CMTPlutoTV.us" site_id="PlutoTV/us#5dcc42446750e200093b15e2">CMT Pluto TV</channel>
|
||||||
<channel lang="en" xmltv_id="CNN.us" site_id="PlutoTV/us#5421f71da6af422839419cb3">CNN</channel>
|
<channel lang="en" xmltv_id="CNNRePlay.us" site_id="PlutoTV/us#5421f71da6af422839419cb3">CNN RePlay</channel>
|
||||||
<channel lang="en" xmltv_id="ColdCaseFiles.us" site_id="PlutoTV/us#5c37d6712de254456f7ec340">Cold Case Files</channel>
|
<channel lang="en" xmltv_id="ColdCaseFiles.us" site_id="PlutoTV/us#5c37d6712de254456f7ec340">Cold Case Files</channel>
|
||||||
<channel lang="en" xmltv_id="CombateWorld.us" site_id="PlutoTV/us#5bb1ac3e268cae539bcedb07">Combate World</channel>
|
<channel lang="en" xmltv_id="CombateWorld.us" site_id="PlutoTV/us#5bb1ac3e268cae539bcedb07">Combate World</channel>
|
||||||
<channel lang="en" xmltv_id="ComedyCentralAnimation.us" site_id="PlutoTV/us#5f99e24636d67d0007a94e6d">Comedy Central Animation</channel>
|
<channel lang="en" xmltv_id="ComedyCentralAnimation.us" site_id="PlutoTV/us#5f99e24636d67d0007a94e6d">Comedy Central Animation</channel>
|
Loading…
Add table
Add a link
Reference in a new issue