Add files via upload

This commit is contained in:
RevGear 2022-12-22 12:04:34 +00:00 committed by GitHub
parent 0a38a990b3
commit 8830e4f5b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 106 additions and 0 deletions

View file

@ -0,0 +1,69 @@
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const timezone = require('dayjs/plugin/timezone')
const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(utc)
dayjs.extend(timezone)
dayjs.extend(customParseFormat)
module.exports = {
site: 'abc.net.au',
request: {
cache: {
ttl: 60 * 60 * 1000 // 1 hour
}
},
url({ date }) {
return `https://epg.abctv.net.au/processed/Sydney_${date.format('YYYY-MM-DD')}.json`
},
parser({ content, channel }) {
let programs = []
const items = parseItems(content, channel)
items.forEach(item => {
programs.push({
title: item.title,
sub_title: item.episode_title,
category: item.genres,
description: item.description,
season: parseSeason(item),
episode: parseEpisode(item),
rating: parseRating(item),
start: dayjs.utc(item.start_time),
stop: dayjs.utc(item.end_time)
})
})
return programs
}
}
function parseItems(content, channel) {
const data = JSON.parse(content)
if (!data) return []
if (!Array.isArray(data.schedule)) return []
const channelData = data.schedule.filter(i => i.channel == channel.site_id)
return channelData.listing && Array.isArray(channelData.listing) ? channelData.listing : []
}
function parseSeason(item) {
return item.series_num || null
}
function parseEpisode(item) {
return item.episode_num || null
}
function parseTime(time) {
return dayjs.tz(time, 'YYYY-MM-DD HH:mm', 'Australia/Sydney')
}
function parseIcon(tem) {
return item.image_file ? `https://www.abc.net.au/tv/common/images/publicity/${item.image_file}` : null
}
function parseRating(item) {
return item.rating
? {
system: 'ACB',
value: item.rating
}
: null
}

View file

View file

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<site site="abc.net.au">
<channels>
<channel lang="en" xmltv_id="???" site_id="ABC1">???</channel>
<channel lang="en" xmltv_id="???" site_id="ABC2">???</channel>
<channel lang="en" xmltv_id="???" site_id="ABC3">???</channel>
<channel lang="en" xmltv_id="???" site_id="ABC4KIDS">???</channel>
<channel lang="en" xmltv_id="???" site_id="ABCHD">???</channel>
<channel lang="en" xmltv_id="???" site_id="ABCN">???</channel>
<channel lang="en" xmltv_id="???" site_id="10">???</channel>
<channel lang="en" xmltv_id="???" site_id="11">???</channel>
<channel lang="en" xmltv_id="???" site_id="7">???</channel>
<channel lang="en" xmltv_id="???" site_id="7HD">???</channel>
<channel lang="en" xmltv_id="???" site_id="7MATE">???</channel>
<channel lang="en" xmltv_id="???" site_id="7TWO">???</channel>
<channel lang="en" xmltv_id="???" site_id="7flix">???</channel>
<channel lang="en" xmltv_id="???" site_id="9">???</channel>
<channel lang="en" xmltv_id="???" site_id="9HD">???</channel>
<channel lang="en" xmltv_id="???" site_id="9Life">???</channel>
<channel lang="en" xmltv_id="???" site_id="9Rush">???</channel>
<channel lang="en" xmltv_id="???" site_id="GEM">???</channel>
<channel lang="en" xmltv_id="???" site_id="GO">???</channel>
<channel lang="en" xmltv_id="???" site_id="NITV">???</channel>
<channel lang="en" xmltv_id="???" site_id="ONE">???</channel>
<channel lang="en" xmltv_id="???" site_id="RTV">???</channel>
<channel lang="en" xmltv_id="???" site_id="SBS">???</channel>
<channel lang="en" xmltv_id="???" site_id="SBS2">???</channel>
<channel lang="en" xmltv_id="???" site_id="SBS3">???</channel>
<channel lang="en" xmltv_id="???" site_id="SBSHD">???</channel>
<channel lang="en" xmltv_id="???" site_id="SBSWW">???</channel>
<channel lang="en" xmltv_id="???" site_id="SHAKE">???</channel>
<channel lang="en" xmltv_id="???" site_id="SPREE">???</channel>
<channel lang="en" xmltv_id="???" site_id="TENHD">???</channel>
<channel lang="en" xmltv_id="???" site_id="TVSN">???</channel>
<channel lang="en" xmltv_id="???" site_id="VICHD">???</channel>
</channels>
</site>