Merge pull request #1428 from iptv-org/add-toonamiaftermath.com
Add guide from toonamiaftermath.com
This commit is contained in:
6 files changed
+141
No files matched your search
@@ -0,0 +1,17 @@
|
||||
name: toonamiaftermath.com
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 3 * * *'
|
||||
workflow_dispatch:
|
||||
workflow_run:
|
||||
workflows: [_trigger]
|
||||
types:
|
||||
- completed
|
||||
jobs:
|
||||
load:
|
||||
uses: ./.github/workflows/_load.yml
|
||||
with:
|
||||
site: ${{github.workflow}}
|
||||
secrets:
|
||||
APP_ID: ${{ secrets.APP_ID }}
|
||||
APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }}
|
||||
@@ -0,0 +1 @@
|
||||
{"_id":"635fbd8117f6824d953a216e","scheduleName":"Toonami Aftermath EST","startDate":"2022-11-29T17:00:00.000Z","playlist":{"startTime":"12pm","blocks":[{"tagline":"Weekdays 12.0-2.0pm","runtimeHoursTarget":1.9,"mediaList":[{"type":"file","mediaType":"series","filepath":"t:\\toonami\\series\\x-men\\x-men 25.mkv","name":"X-Men","episodeNumber":25,"runtime":1223.8,"playlistIndex":1,"startDate":"2022-11-29T17:00:30.231Z","endDate":"2022-11-29T17:20:54.031Z","info":{"image":"https://i.imgur.com/ZSZ0x1m.gif","year":1992,"episode":"Reunion (Part 1)"}},{"type":"file","mediaType":"series","filepath":"t:\\toonami\\series\\mega man\\mega man 25.mkv","name":"Mega Man","episodeNumber":25,"runtime":1454.528,"playlistIndex":4,"startDate":"2022-11-29T17:21:48.837Z","endDate":"2022-11-29T17:46:03.365Z","info":{"image":"https://i.imgur.com/vhvmTlP.gif","year":1994,"episode":"Bad Day at Peril Park"}},{"type":"file","mediaType":"series","filepath":"t:\\toonami\\series\\men in black\\men in black 10.avi","name":"Men in Black","episodeNumber":10,"runtime":1260.52,"playlistIndex":8,"startDate":"2022-11-29T17:46:51.145Z","endDate":"2022-11-29T18:07:51.665Z","info":{"fullname":"Men in Black: The Series","image":"https://i.imgur.com/M2q5NRC.gif","episode":"The Head Trip Syndrome"}},{"type":"file","mediaType":"series","filepath":"t:\\toonami\\series\\street fighter ii v\\street fighter ii v 19.mkv","name":"Street Fighter II V","episodeNumber":19,"runtime":1423.808,"playlistIndex":11,"startDate":"2022-11-29T18:08:52.572Z","endDate":"2022-11-29T18:32:36.380Z","info":{"fullname":"Street Fighter II: V","image":"https://i.imgur.com/mQiuwRJ.gif","episode":"Special Orders to Iron Men"}},{"type":"file","mediaType":"series","filepath":"t:\\toonami\\series\\spider-man\\spider-man 35.mp4","name":"Spider-Man","episodeNumber":35,"runtime":1220.56,"playlistIndex":15,"startDate":"2022-11-29T18:33:39.440Z","endDate":"2022-11-29T18:54:00.000Z","info":{"image":"https://i.imgur.com/hprZiwl.gif","year":1994,"episode":"The Ultimate Slayer"}}],"type":"block","name":"Marvel vs Capcom","runtime":6840,"runtimeTarget":6840,"startDate":"2022-11-29T17:00:00.000Z","endDate":"2022-11-29T18:54:00.000Z"},{"tagline":"Weekdays 2.0-4.0pm","runtimeHoursTarget":2.1,"mediaList":[{"type":"file","mediaType":"series","filepath":"t:\\toonami\\series\\silverhawks\\silverhawks 50.mp4","name":"Silverhawks","episodeNumber":50,"runtime":1339.963,"playlistIndex":18,"startDate":"2022-11-29T18:55:30.492Z","endDate":"2022-11-29T19:17:50.455Z","info":{"image":"https://i.imgur.com/dpR9jOG.gif","episode":"Gangwar, Part 1"}},{"type":"file","mediaType":"series","filepath":"t:\\toonami\\series\\saint seiya\\saint seiya 23.mkv","name":"Saint Seiya","episodeNumber":23,"runtime":1464.755,"playlistIndex":22,"startDate":"2022-11-29T19:18:20.236Z","endDate":"2022-11-29T19:42:44.991Z","info":{"image":"https://i.imgur.com/6rmD2nL.gif","episode":"Silver Saint! Vain and Boastful Assassin"}},{"type":"file","mediaType":"series","filepath":"t:\\toonami\\series\\zeta gundam\\zeta gundam 11.mkv","name":"Zeta Gundam","episodeNumber":11,"runtime":1457.19,"playlistIndex":26,"startDate":"2022-11-29T19:43:14.903Z","endDate":"2022-11-29T20:07:32.093Z","info":{"fullname":"Mobile Suit Zeta Gundam","image":"https://i.imgur.com/Tqe7v2I.gif","episode":"Entering the Atmosphere"}},{"type":"file","mediaType":"series","filepath":"t:\\toonami\\series\\robotech\\robotech 2.mp4","name":"Robotech","episodeNumber":2,"runtime":1450.716,"playlistIndex":31,"startDate":"2022-11-29T20:08:35.654Z","endDate":"2022-11-29T20:32:46.370Z","info":{"image":"https://i.imgur.com/d2iQJ5T.gif","year":1985,"episode":"Countdown"}},{"type":"file","mediaType":"series","filepath":"t:\\toonami\\series\\reboot\\reboot 6.avi","name":"Reboot","episodeNumber":6,"runtime":1421.256,"playlistIndex":36,"startDate":"2022-11-29T20:33:48.276Z","endDate":"2022-11-29T20:57:29.532Z","info":{"image":"https://i.imgur.com/CFaaZSh.gif","year":1994,"episode":"In the Belly of the Beast"}}],"type":"block","name":"Toonami O.G.","runtime":7559.999999999998,"runtimeTarget":7560,"startDate":"2022-11-29T18:54:00.000Z","endDate":"2022-11-29T21:00:00.000Z"},{"tagline":"Weekdays 4.0-5.0pm","runtimeHoursTarget":1,"defaultCommercialBreak":{"type":"commercialBreak","mediaType":"commercial","filter":{"yearRange":{"start":1997,"end":2002}}},"breakInject":{"enable":true,"breaks":1},"mediaList":[{"type":"file","mediaType":"series","filepath":"t:\\toonami\\series\\pokemon\\pokemon 265.mkv","name":"Pokemon","episodeNumber":248,"runtime":1292.298,"seekEndTime":718.6134999999999,"playlistIndex":42,"startDate":"2022-11-29T21:00:00.000Z","endDate":"2022-11-29T21:25:29.432Z","info":{"image":"https://i.imgur.com/VfdN6pP.gif","year":1997,"episode":"One Trick Phony!"}},{"type":"file","mediaType":"series","filepath":"t:\\toonami\\series\\batman\\batman 73.mp4","name":"Batman","episodeNumber":73,"runtime":1275.883,"seekEndTime":524.6800000000001,"playlistIndex":63,"startDate":"2022-11-29T21:Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
[{"_id":"635e6c0917f6824d95312bf7","scheduleName":"Toonami Aftermath EST","startDate":"2022-11-28T17:00:00.000Z","endDate":"2022-11-29T17:00:00.000Z"},{"_id":"635fbd8117f6824d953a216e","scheduleName":"Toonami Aftermath EST","startDate":"2022-11-29T17:00:00.000Z","endDate":"2022-11-30T17:00:00.000Z"},{"_id":"63610efab2ea42e7a913c18a","scheduleName":"Toonami Aftermath EST","startDate":"2022-11-30T17:00:00.000Z","endDate":"2022-12-01T17:00:00.000Z"},{"_id":"6362607ab2ea42e7a91ba353","scheduleName":"Toonami Aftermath EST","startDate":"2022-12-01T17:00:00.000Z","endDate":"2022-12-02T17:00:00.000Z"},{"_id":"6363b1f9b2ea42e7a9231e25","scheduleName":"Toonami Aftermath EST","startDate":"2022-12-02T17:00:00.000Z","endDate":"2022-12-03T11:00:00.000Z"},{"_id":"6365037ab2ea42e7a92b3415","scheduleName":"Toonami Aftermath EST","startDate":"2022-12-03T11:00:00.000Z","endDate":"2022-12-04T12:48:20.000Z"},{"_id":"636654fab2ea42e7a9339918","scheduleName":"Toonami Aftermath EST","startDate":"2022-12-04T11:00:00.000Z","endDate":"2022-12-05T16:27:37.000Z"}]
|
||||
@@ -0,0 +1,53 @@
|
||||
process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'
|
||||
|
||||
const dayjs = require('dayjs')
|
||||
const axios = require('axios')
|
||||
|
||||
const API_ENDPOINT = `https://api.toonamiaftermath.com`
|
||||
|
||||
module.exports = {
|
||||
site: 'toonamiaftermath.com',
|
||||
async url({ channel, date }) {
|
||||
const playlists = await axios
|
||||
.get(
|
||||
`${API_ENDPOINT}/playlists?scheduleName=${channel.site_id}&startDate=${date
|
||||
.add(1, 'd')
|
||||
.toJSON()}&thisWeek=true&weekStartDay=monday`
|
||||
)
|
||||
.then(r => r.data)
|
||||
.catch(console.error)
|
||||
|
||||
const playlist = playlists.find(p => date.isSame(p.startDate, 'day'))
|
||||
|
||||
return `https://api.toonamiaftermath.com/playlist?id=${playlist._id}&addInfo=true`
|
||||
},
|
||||
parser({ content, date }) {
|
||||
let programs = []
|
||||
const items = parseItems(content, date)
|
||||
items.forEach(item => {
|
||||
programs.push({
|
||||
title: item.name,
|
||||
sub_title: item?.info?.episode,
|
||||
icon: item?.info?.image,
|
||||
start: dayjs(item.startDate),
|
||||
stop: dayjs(item.endDate)
|
||||
})
|
||||
})
|
||||
|
||||
return programs
|
||||
}
|
||||
}
|
||||
|
||||
function parseItems(content, date) {
|
||||
if (!content) return []
|
||||
const data = JSON.parse(content)
|
||||
const blocks = data?.playlist?.blocks || []
|
||||
|
||||
return blocks
|
||||
.reduce((acc, curr) => {
|
||||
acc = acc.concat(curr.mediaList)
|
||||
|
||||
return acc
|
||||
}, [])
|
||||
.filter(i => date.isSame(i.startDate, 'day'))
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// npx epg-grabber --config=sites/toonamiaftermath.com/toonamiaftermath.com.config.js --channels=sites/toonamiaftermath.com/toonamiaftermath.com_us.channels.xml --output=guide.xml --days=2
|
||||
|
||||
const { parser, url, request } = require('./toonamiaftermath.com.config.js')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const axios = require('axios')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
dayjs.extend(customParseFormat)
|
||||
dayjs.extend(utc)
|
||||
|
||||
jest.mock('axios')
|
||||
|
||||
const API_ENDPOINT = `https://api.toonamiaftermath.com`
|
||||
|
||||
const date = dayjs.utc('2022-11-29', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: 'Toonami Aftermath EST',
|
||||
xmltv_id: 'ToonamiAftermathEast.us'
|
||||
}
|
||||
|
||||
it('can generate valid url', async () => {
|
||||
axios.get.mockImplementation(url => {
|
||||
if (
|
||||
url ===
|
||||
`${API_ENDPOINT}/playlists?scheduleName=Toonami Aftermath EST&startDate=2022-11-30T00:00:00.000Z&thisWeek=true&weekStartDay=monday`
|
||||
) {
|
||||
return Promise.resolve({
|
||||
data: JSON.parse(fs.readFileSync(path.resolve(__dirname, '__data__/playlists.json')))
|
||||
})
|
||||
} else {
|
||||
return Promise.resolve({ data: '' })
|
||||
}
|
||||
})
|
||||
|
||||
const result = await url({ channel, date })
|
||||
|
||||
expect(result).toBe(`${API_ENDPOINT}/playlist?id=635fbd8117f6824d953a216e&addInfo=true`)
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||
let results = parser({ content, channel, date }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(17)
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2022-11-29T17:00:30.231Z',
|
||||
stop: '2022-11-29T17:20:54.031Z',
|
||||
title: 'X-Men',
|
||||
sub_title: 'Reunion (Part 1)',
|
||||
icon: 'https://i.imgur.com/ZSZ0x1m.gif'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({ content: '', date })
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<site site="toonamiaftermath.com">
|
||||
<channels>
|
||||
<channel lang="en" xmltv_id="ToonamiAftermathEast.us" site_id="Toonami Aftermath EST">Toonami Aftermath East</channel>
|
||||
</channels>
|
||||
</site>
|
||||
Reference in new issue
Block a user