Merge pull request #2082 from iptv-org/fix-tv.dir.bg

Fix tv.dir.bg
This commit is contained in:
PopeyeTheSai10r 2023-06-11 02:24:46 -07:00 committed by GitHub
commit 863d5b0135
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 14 deletions

View file

@ -101,6 +101,5 @@
<channel lang="en" xmltv_id="MezzoLiveHD.fr" site_id="381">Mezzo Live HD</channel> <channel lang="en" xmltv_id="MezzoLiveHD.fr" site_id="381">Mezzo Live HD</channel>
<channel lang="en" xmltv_id="MTVHitsUK.uk" site_id="251">MTV Hits</channel> <channel lang="en" xmltv_id="MTVHitsUK.uk" site_id="251">MTV Hits</channel>
<channel lang="en" xmltv_id="TraceSportStars.fr" site_id="300">Trace Sport Stars</channel> <channel lang="en" xmltv_id="TraceSportStars.fr" site_id="300">Trace Sport Stars</channel>
<!-- <channel lang="bg" xmltv_id="" site_id="354">FilmBox</channel> -->
</channels> </channels>
</site> </site>

View file

@ -1,13 +1,6 @@
const axios = require('axios') const axios = require('axios')
const cheerio = require('cheerio') const cheerio = require('cheerio')
const dayjs = require('dayjs') const { DateTime } = require('luxon')
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 = { module.exports = {
site: 'tv.dir.bg', site: 'tv.dir.bg',
@ -24,13 +17,13 @@ module.exports = {
let start = parseStart($item, date) let start = parseStart($item, date)
if (!start) return if (!start) return
if (prev) { if (prev) {
if (start.isBefore(prev.start)) { if (start < prev.start) {
start = start.add(1, 'd') start = start.plus({ days: 1 })
date = date.add(1, 'd') date = date.add(1, 'd')
} }
prev.stop = start prev.stop = start
} }
const stop = start.add(30, 'm') const stop = start.plus({ minutes: 30 })
programs.push({ programs.push({
title: parseTitle($item), title: parseTitle($item),
start, start,
@ -78,7 +71,7 @@ function parseStart($item, date) {
if (!time) return null if (!time) return null
const dateString = `${date.format('MM/DD/YYYY')} ${time}` const dateString = `${date.format('MM/DD/YYYY')} ${time}`
return dayjs.tz(dateString, 'MM/DD/YYYY HH.mm', 'Europe/Sofia') return DateTime.fromFormat(dateString, 'MM/dd/yyyy HH.mm', { zone: 'Europe/Sofia' }).toUTC()
} }
function parseTitle($item) { function parseTitle($item) {

View file

@ -1,5 +1,5 @@
// node ./scripts/commands/parse-channels.js --config=./sites/tv.dir.bg/tv.dir.bg.config.js --output=./sites/tv.dir.bg/tv.dir.bg.channels.xml // node ./scripts/commands/parse-channels.js --config=./sites/tv.dir.bg/tv.dir.bg.config.js --output=./sites/tv.dir.bg/tv.dir.bg.channels.xml
// npx epg-grabber --config=sites/tv.dir.bg/tv.dir.bg.config.js --channels=sites/tv.dir.bg/tv.dir.bg.channels.xml --output=guide.xml --days=2 // npx epg-grabber --config=sites/tv.dir.bg/tv.dir.bg.config.js --channels=sites/tv.dir.bg/tv.dir.bg.channels.xml --output=guide.xml
const { parser, url } = require('./tv.dir.bg.config.js') const { parser, url } = require('./tv.dir.bg.config.js')
const dayjs = require('dayjs') const dayjs = require('dayjs')