This commit is contained in:
freearhey 2019-11-03 16:03:35 +03:00
parent 6cbce4f201
commit 11f7e4cf45
2 changed files with 120 additions and 171 deletions

View file

@ -51,8 +51,8 @@ helper.parsePlaylist = function(filename) {
return new Playlist(result)
}
helper.loadEPG = async function(url) {
const content = await getEPGFile(url)
helper.parseEPG = async function(url) {
const content = await this.getEPG(url)
const result = epgParser.parse(content)
const channels = {}
for(let channel of result.channels) {
@ -65,7 +65,7 @@ helper.loadEPG = async function(url) {
})
}
helper.getEPGFile = function(url) {
helper.getEPG = function(url) {
return new Promise((resolve, reject) => {
var buffer = []
axios({
@ -111,22 +111,6 @@ helper.getBasename = function(filename) {
return path.basename(filename, path.extname(filename))
}
helper.addToCache = function(url) {
let id = this.getUrlPath(url)
cache[id] = true
}
helper.checkCache = function(url) {
let id = this.getUrlPath(url)
return cache.hasOwnProperty(id)
}
helper.clearCache = function() {
cache = {}
}
helper.getUrlPath = function(u) {
let parsed = urlParser.parse(u)
let searchQuery = parsed.search || ''
@ -220,6 +204,7 @@ class Playlist {
constructor(data) {
this.header = data.header
this.items = data.items
this.changed = false
}
getHeader() {