mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Fix linter issues
This commit is contained in:
parent
8b0952b915
commit
e8f89b216c
4 changed files with 255 additions and 264 deletions
|
@ -1,68 +1,67 @@
|
|||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const axios = require('axios')
|
||||
|
||||
dayjs.extend(utc)
|
||||
|
||||
module.exports = {
|
||||
site: 'stod2.is',
|
||||
channels: 'stod2.is.channels.xml',
|
||||
days: 7,
|
||||
request: {
|
||||
cache: {
|
||||
ttl: 60 * 60 * 1000 // 1 hour
|
||||
}
|
||||
},
|
||||
url({ channel, date }) {
|
||||
return `https://api.stod2.is/dagskra/api/${channel.site_id}/${date.format('YYYY-MM-DD')}`
|
||||
},
|
||||
parser: function ({ content }) {
|
||||
let data
|
||||
try {
|
||||
data = JSON.parse(content)
|
||||
} catch (error) {
|
||||
console.error('Error parsing JSON:', error)
|
||||
return []
|
||||
}
|
||||
|
||||
const programs = []
|
||||
|
||||
if (data && Array.isArray(data)) {
|
||||
data.forEach(item => {
|
||||
if (!item) return
|
||||
const start = dayjs.utc(item.upphaf)
|
||||
const stop = start.add(item.slott, 'm')
|
||||
|
||||
programs.push({
|
||||
title: item.isltitill,
|
||||
sub_title: item.undirtitill,
|
||||
description: item.lysing,
|
||||
actors: item.adalhlutverk,
|
||||
directors: item.leikstjori,
|
||||
start,
|
||||
stop
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
try {
|
||||
const response = await axios.get('https://api.stod2.is/dagskra/api')
|
||||
if (!response.data || !Array.isArray(response.data)) {
|
||||
console.error('Error: No channels data found')
|
||||
return []
|
||||
}
|
||||
return response.data.map(item => {
|
||||
return {
|
||||
lang: 'is',
|
||||
site_id: item
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Error fetching channels:', error)
|
||||
return []
|
||||
}
|
||||
}
|
||||
}
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const axios = require('axios')
|
||||
|
||||
dayjs.extend(utc)
|
||||
|
||||
module.exports = {
|
||||
site: 'stod2.is',
|
||||
days: 7,
|
||||
request: {
|
||||
cache: {
|
||||
ttl: 60 * 60 * 1000 // 1 hour
|
||||
}
|
||||
},
|
||||
url({ channel, date }) {
|
||||
return `https://api.stod2.is/dagskra/api/${channel.site_id}/${date.format('YYYY-MM-DD')}`
|
||||
},
|
||||
parser: function ({ content }) {
|
||||
let data
|
||||
try {
|
||||
data = JSON.parse(content)
|
||||
} catch (error) {
|
||||
console.error('Error parsing JSON:', error)
|
||||
return []
|
||||
}
|
||||
|
||||
const programs = []
|
||||
|
||||
if (data && Array.isArray(data)) {
|
||||
data.forEach(item => {
|
||||
if (!item) return
|
||||
const start = dayjs.utc(item.upphaf)
|
||||
const stop = start.add(item.slott, 'm')
|
||||
|
||||
programs.push({
|
||||
title: item.isltitill,
|
||||
sub_title: item.undirtitill,
|
||||
description: item.lysing,
|
||||
actors: item.adalhlutverk,
|
||||
directors: item.leikstjori,
|
||||
start,
|
||||
stop
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
return programs
|
||||
},
|
||||
async channels() {
|
||||
try {
|
||||
const response = await axios.get('https://api.stod2.is/dagskra/api')
|
||||
if (!response.data || !Array.isArray(response.data)) {
|
||||
console.error('Error: No channels data found')
|
||||
return []
|
||||
}
|
||||
return response.data.map(item => {
|
||||
return {
|
||||
lang: 'is',
|
||||
site_id: item
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Error fetching channels:', error)
|
||||
return []
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue