mirror of
https://github.com/iptv-org/epg
synced 2026-04-28 05:26:59 -04:00
stod2 -> syn.is
This commit is contained in:
@@ -1,21 +0,0 @@
|
|||||||
# stod2.is
|
|
||||||
|
|
||||||
https://stod2.is/dagskra/
|
|
||||||
|
|
||||||
### Download the guide
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm run grab --- --site=stod2.is
|
|
||||||
```
|
|
||||||
|
|
||||||
### Update channel list
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm run channels:parse --- --config=./sites/stod2.is/stod2.is.config.js --output=./sites/stod2.is/stod2.is.channels.xml
|
|
||||||
```
|
|
||||||
|
|
||||||
### Test
|
|
||||||
|
|
||||||
```sh
|
|
||||||
npm test --- stod2.is
|
|
||||||
```
|
|
||||||
21
sites/syn.is/readme.md
Normal file
21
sites/syn.is/readme.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# syn.is
|
||||||
|
|
||||||
|
https://www.syn.is/sjonvarp/dagskra
|
||||||
|
|
||||||
|
### Download the guide
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run grab --- --site=syn.is
|
||||||
|
```
|
||||||
|
|
||||||
|
### Update channel list
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm run channels:parse --- --config=./sites/syn.is/syn.is.config.js --output=./sites/syn.is/syn.is.channels.xml
|
||||||
|
```
|
||||||
|
|
||||||
|
### Test
|
||||||
|
|
||||||
|
```sh
|
||||||
|
npm test --- syn.is
|
||||||
|
```
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<channels>
|
<channels>
|
||||||
<channel site="syn.is" site_id="beint" lang="is" xmltv_id=""></channel>
|
<channel site="syn.is" site_id="beint" lang="is" xmltv_id=""></channel>
|
||||||
<channel site="syn.is" site_id="bio" lang="is" xmltv_id=""></channel>
|
<channel site="syn.is" site_id="bio" lang="is" xmltv_id=""></channel>
|
||||||
<channel site="syn.is" site_id="syn" lang="is" xmltv_id=""></channel>
|
<channel site="syn.is" site_id="syn" lang="is" xmltv_id=""></channel>
|
||||||
<channel site="syn.is" site_id="synsport" lang="is" xmltv_id="Stod2Sport.is@SD">Stöð 2 Sport</channel>
|
<channel site="syn.is" site_id="synsport" lang="is" xmltv_id="Stod2Sport.is@SD">Stöð 2 Sport</channel>
|
||||||
<channel site="syn.is" site_id="synsport2" lang="is" xmltv_id="Stod2Sport2.is@SD">Stöð 2 Sport 2</channel>
|
<channel site="syn.is" site_id="synsport2" lang="is" xmltv_id="Stod2Sport2.is@SD">Stöð 2 Sport 2</channel>
|
||||||
<channel site="syn.is" site_id="synsport3" lang="is" xmltv_id="Stod2Sport3.is@SD">Stöð 2 Sport 3</channel>
|
<channel site="syn.is" site_id="synsport3" lang="is" xmltv_id="Stod2Sport3.is@SD">Stöð 2 Sport 3</channel>
|
||||||
<channel site="syn.is" site_id="synsport4" lang="is" xmltv_id="Stod2Sport4.is@SD">Stöð 2 Sport 4</channel>
|
<channel site="syn.is" site_id="synsport4" lang="is" xmltv_id="Stod2Sport4.is@SD">Stöð 2 Sport 4</channel>
|
||||||
<channel site="syn.is" site_id="synsport5" lang="is" xmltv_id="Stod2Sport5.is@SD">Stöð 2 Sport 5</channel>
|
<channel site="syn.is" site_id="synsport5" lang="is" xmltv_id="Stod2Sport5.is@SD">Stöð 2 Sport 5</channel>
|
||||||
<channel site="syn.is" site_id="synsport6" lang="is" xmltv_id="Stod2Sport6.is@SD">Stöð 2 Sport 6</channel>
|
<channel site="syn.is" site_id="synsport6" lang="is" xmltv_id="Stod2Sport6.is@SD">Stöð 2 Sport 6</channel>
|
||||||
<channel site="syn.is" site_id="synsportisland" lang="is" xmltv_id=""></channel>
|
<channel site="syn.is" site_id="synsportisland" lang="is" xmltv_id=""></channel>
|
||||||
<channel site="syn.is" site_id="synsportisland2" lang="is" xmltv_id=""></channel>
|
<channel site="syn.is" site_id="synsportisland2" lang="is" xmltv_id=""></channel>
|
||||||
<channel site="syn.is" site_id="synsportisland3" lang="is" xmltv_id=""></channel>
|
<channel site="syn.is" site_id="synsportisland3" lang="is" xmltv_id=""></channel>
|
||||||
<channel site="syn.is" site_id="synsportviaplay" lang="is" xmltv_id=""></channel>
|
<channel site="syn.is" site_id="synsportviaplay" lang="is" xmltv_id=""></channel>
|
||||||
</channels>
|
</channels>
|
||||||
@@ -1,67 +1,67 @@
|
|||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const axios = require('axios')
|
const axios = require('axios')
|
||||||
|
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
site: 'syn.is',
|
site: 'syn.is',
|
||||||
days: 7,
|
days: 7,
|
||||||
request: {
|
request: {
|
||||||
cache: {
|
cache: {
|
||||||
ttl: 60 * 60 * 1000 // 1 hour
|
ttl: 60 * 60 * 1000 // 1 hour
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
url({ channel, date }) {
|
url({ channel, date }) {
|
||||||
return `https://www.syn.is/api/epg/${channel.site_id}/${date.format('YYYY-MM-DD')}`
|
return `https://www.syn.is/api/epg/${channel.site_id}/${date.format('YYYY-MM-DD')}`
|
||||||
},
|
},
|
||||||
parser: function ({ content }) {
|
parser: function ({ content }) {
|
||||||
let data
|
let data
|
||||||
try {
|
try {
|
||||||
data = JSON.parse(content)
|
data = JSON.parse(content)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error parsing JSON:', error)
|
console.error('Error parsing JSON:', error)
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
const programs = []
|
const programs = []
|
||||||
|
|
||||||
if (data && Array.isArray(data)) {
|
if (data && Array.isArray(data)) {
|
||||||
data.forEach(item => {
|
data.forEach(item => {
|
||||||
if (!item) return
|
if (!item) return
|
||||||
const start = dayjs.utc(item.upphaf)
|
const start = dayjs.utc(item.upphaf)
|
||||||
const stop = start.add(item.slott, 'm')
|
const stop = start.add(item.slott, 'm')
|
||||||
|
|
||||||
programs.push({
|
programs.push({
|
||||||
title: item.isltitill,
|
title: item.isltitill,
|
||||||
sub_title: item.undirtitill,
|
sub_title: item.undirtitill,
|
||||||
description: item.lysing,
|
description: item.lysing,
|
||||||
actors: item.adalhlutverk,
|
actors: item.adalhlutverk,
|
||||||
directors: item.leikstjori,
|
directors: item.leikstjori,
|
||||||
start,
|
start,
|
||||||
stop
|
stop
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return programs
|
return programs
|
||||||
},
|
},
|
||||||
async channels() {
|
async channels() {
|
||||||
try {
|
try {
|
||||||
const response = await axios.get('https://www.syn.is/api/epg/')
|
const response = await axios.get('https://www.syn.is/api/epg/')
|
||||||
if (!response.data || !Array.isArray(response.data)) {
|
if (!response.data || !Array.isArray(response.data)) {
|
||||||
console.error('Error: No channels data found')
|
console.error('Error: No channels data found')
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
return response.data.map(item => {
|
return response.data.map(item => {
|
||||||
return {
|
return {
|
||||||
lang: 'is',
|
lang: 'is',
|
||||||
site_id: item
|
site_id: item
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error fetching channels:', error)
|
console.error('Error fetching channels:', error)
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,46 +1,46 @@
|
|||||||
const { parser, url } = require('./stod2.is.config.js')
|
const { parser, url } = require('./stod2.is.config.js')
|
||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
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')
|
||||||
const timezone = require('dayjs/plugin/timezone')
|
const timezone = require('dayjs/plugin/timezone')
|
||||||
|
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
dayjs.extend(customParseFormat)
|
dayjs.extend(customParseFormat)
|
||||||
dayjs.extend(timezone)
|
dayjs.extend(timezone)
|
||||||
|
|
||||||
const date = dayjs.utc('2025-01-03', 'YYYY-MM-DD').startOf('day')
|
const date = dayjs.utc('2025-01-03', 'YYYY-MM-DD').startOf('day')
|
||||||
const channel = { site_id: 'stod2', xmltv_id: 'Stod2.is' }
|
const channel = { site_id: 'stod2', xmltv_id: 'Stod2.is' }
|
||||||
|
|
||||||
it('can generate valid url', () => {
|
it('can generate valid url', () => {
|
||||||
const generatedUrl = url({ date, channel })
|
const generatedUrl = url({ date, channel })
|
||||||
expect(generatedUrl).toBe('https://www.syn.is/api/epg/stod2/2025-01-03')
|
expect(generatedUrl).toBe('https://www.syn.is/api/epg/stod2/2025-01-03')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||||
const result = parser({ content }).map(p => {
|
const result = parser({ content }).map(p => {
|
||||||
p.start = p.start.toISOString()
|
p.start = p.start.toISOString()
|
||||||
p.stop = p.stop.toISOString()
|
p.stop = p.stop.toISOString()
|
||||||
return p
|
return p
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(result).toMatchObject([
|
expect(result).toMatchObject([
|
||||||
{
|
{
|
||||||
title: 'Heimsókn',
|
title: 'Heimsókn',
|
||||||
sub_title: 'Telma Borgþórsdóttir',
|
sub_title: 'Telma Borgþórsdóttir',
|
||||||
description:
|
description:
|
||||||
'Frábærir þættir með Sindra Sindrasyni sem lítur inn hjá íslenskum fagurkerum. Heimilin eru jafn ólík og þau eru mörg en eiga það þó eitt sameiginlegt að vera sett saman af alúð og smekklegheitum. Sindri hefur líka einstakt lag á að ná fram því besta í viðmælendum sínum.',
|
'Frábærir þættir með Sindra Sindrasyni sem lítur inn hjá íslenskum fagurkerum. Heimilin eru jafn ólík og þau eru mörg en eiga það þó eitt sameiginlegt að vera sett saman af alúð og smekklegheitum. Sindri hefur líka einstakt lag á að ná fram því besta í viðmælendum sínum.',
|
||||||
actors: '',
|
actors: '',
|
||||||
directors: '',
|
directors: '',
|
||||||
start: '2025-01-03T08:00:00.000Z',
|
start: '2025-01-03T08:00:00.000Z',
|
||||||
stop: '2025-01-03T08:15:00.000Z'
|
stop: '2025-01-03T08:15:00.000Z'
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can handle empty guide', () => {
|
it('can handle empty guide', () => {
|
||||||
const result = parser({ content: '[]' })
|
const result = parser({ content: '[]' })
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject([])
|
||||||
})
|
})
|
||||||
Reference in New Issue
Block a user