Merge branch 'master' into pr/787

This commit is contained in:
Aleksandr Statciuk 2022-05-10 16:07:20 +03:00
commit 9652561382
3 changed files with 15 additions and 15 deletions

View file

@ -14,7 +14,7 @@
"readme:update": "node scripts/commands/readme/update.js", "readme:update": "node scripts/commands/readme/update.js",
"test": "npx jest --runInBand", "test": "npx jest --runInBand",
"test:commands": "npx jest --runInBand -- commands", "test:commands": "npx jest --runInBand -- commands",
"test:sites": "npx jest --runInBand -- sites", "test:sites": "TZ=UTC npx jest --runInBand -- sites",
"act:test": "act workflow_dispatch -W .github/workflows/_test.yml", "act:test": "act workflow_dispatch -W .github/workflows/_test.yml",
"act:check": "act workflow_dispatch -W .github/workflows/_check.yml", "act:check": "act workflow_dispatch -W .github/workflows/_check.yml",
"act:update-readme": "act workflow_dispatch -W .github/workflows/_update-readme.yml", "act:update-readme": "act workflow_dispatch -W .github/workflows/_update-readme.yml",

View file

@ -17,7 +17,7 @@ module.exports = {
headers: { headers: {
'content-type': 'application/x-www-form-urlencoded' 'content-type': 'application/x-www-form-urlencoded'
}, },
data: function({ date }) { data: function ({ date }) {
const diff = date.diff(dayjs.utc().startOf('d'), 'd') const diff = date.diff(dayjs.utc().startOf('d'), 'd')
const params = new URLSearchParams() const params = new URLSearchParams()
params.append('objId', diff) params.append('objId', diff)
@ -27,7 +27,7 @@ module.exports = {
}, },
parser: function ({ content }) { parser: function ({ content }) {
const programs = [] const programs = []
if(!content) return programs if (!content) return programs
const items = JSON.parse(content) const items = JSON.parse(content)
items.forEach(item => { items.forEach(item => {
const icon = parseIcon(item) const icon = parseIcon(item)
@ -51,12 +51,12 @@ function parseStart(item) {
const [_, M, D, YYYY] = item.adddate.match(/(\d+)\/(\d+)\/(\d+) /) const [_, M, D, YYYY] = item.adddate.match(/(\d+)\/(\d+)\/(\d+) /)
const [HH, mm] = item.start_Time.split(':') const [HH, mm] = item.start_Time.split(':')
return dayjs(`${YYYY}-${M}-${D}T${HH}:${mm}:00`, 'YYYY-M-DTHH:mm:ss', 'Asia/Riyadh') return dayjs.tz(`${YYYY}-${M}-${D}T${HH}:${mm}:00`, 'YYYY-M-DTHH:mm:ss', 'Asia/Riyadh')
} }
function parseDuration(item) { function parseDuration(item) {
const [__, HH, mm, ss] = item.duration.match(/(\d+):(\d+):(\d+)/) const [__, HH, mm, ss] = item.duration.match(/(\d+):(\d+):(\d+)/)
return parseInt(HH) * 3600 + parseInt(mm) * 60 + parseInt(ss) return parseInt(HH) * 3600 + parseInt(mm) * 60 + parseInt(ss)
} }

View file

@ -29,34 +29,34 @@ it('can parse response', () => {
expect(result).toMatchObject([ expect(result).toMatchObject([
{ {
start: '2021-11-12T20:00:00.000Z', start: '2021-11-12T23:00:00.000Z',
stop: '2021-11-12T21:30:00.000Z', stop: '2021-11-13T00:30:00.000Z',
title: 'Bienvenidos a bordo' title: 'Bienvenidos a bordo'
}, },
{ {
start: '2021-11-12T21:30:00.000Z', start: '2021-11-13T00:30:00.000Z',
stop: '2021-11-12T22:45:00.000Z', stop: '2021-11-13T01:45:00.000Z',
title: 'Ciudad de sombras' title: 'Ciudad de sombras'
}, },
{ {
start: '2021-11-12T22:45:00.000Z', start: '2021-11-13T01:45:00.000Z',
stop: '2021-11-13T00:30:00.000Z', stop: '2021-11-13T03:30:00.000Z',
title: 'Rascacielos: Rescate en las Alturas', title: 'Rascacielos: Rescate en las Alturas',
icon: 'https://imagenes.gatotv.com/categorias/peliculas/miniatura/rascacielos.jpg', icon: 'https://imagenes.gatotv.com/categorias/peliculas/miniatura/rascacielos.jpg',
description: description:
'Cuando un ex rescatista de rehenes del FBI evalúa la seguridad de un rascacielos en China, un incendio repentino hace que sea acusado injustamente.' 'Cuando un ex rescatista de rehenes del FBI evalúa la seguridad de un rascacielos en China, un incendio repentino hace que sea acusado injustamente.'
}, },
{ {
start: '2021-11-13T10:30:00.000Z', start: '2021-11-13T13:30:00.000Z',
stop: '2021-11-13T10:41:00.000Z', stop: '2021-11-13T13:41:00.000Z',
title: 'Los Jóvenes Titanes En Acción', title: 'Los Jóvenes Titanes En Acción',
icon: 'https://imagenes.gatotv.com/categorias/caricaturas/miniatura/los_jovenes_titanes_en_accion.jpg', icon: 'https://imagenes.gatotv.com/categorias/caricaturas/miniatura/los_jovenes_titanes_en_accion.jpg',
description: description:
'Robin, Starfire, Raven, Chico Bestia y Cyborg se preparan para nuevas aventuras cómicas después de hacer un sándwich, jugar algún videojuego o lavar la ropa.' 'Robin, Starfire, Raven, Chico Bestia y Cyborg se preparan para nuevas aventuras cómicas después de hacer un sándwich, jugar algún videojuego o lavar la ropa.'
}, },
{ {
start: '2021-11-13T20:55:00.000Z', start: '2021-11-13T23:55:00.000Z',
stop: '2021-11-14T01:00:00.000Z', stop: '2021-11-14T04:00:00.000Z',
title: 'Decisión 2021' title: 'Decisión 2021'
} }
]) ])