From 382d4a310eace0c194638f7aaa828e220abf72fb Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Fri, 3 Jan 2025 12:00:46 +0300 Subject: [PATCH] Fix pluto.tv linter issues --- sites/pluto.tv/pluto.tv.config.js | 99 ++++++++++++------------- sites/pluto.tv/pluto.tv.test.js | 13 ++-- sites/pluto.tv/pluto.tv_ca.channels.xml | 1 - sites/pluto.tv/pluto.tv_uk.channels.xml | 1 - 4 files changed, 57 insertions(+), 57 deletions(-) diff --git a/sites/pluto.tv/pluto.tv.config.js b/sites/pluto.tv/pluto.tv.config.js index ade3ea2c..294e130e 100644 --- a/sites/pluto.tv/pluto.tv.config.js +++ b/sites/pluto.tv/pluto.tv.config.js @@ -1,50 +1,49 @@ -const dayjs = require('dayjs') -const utc = require('dayjs/plugin/utc') -const timezone = require('dayjs/plugin/timezone') -const axios = require('axios') - -dayjs.extend(utc) -dayjs.extend(timezone) - -module.exports = { - site: 'pluto.tv', - days: 3, - - url: function ({ date, channel }) { - const channelId = channel.site_id - - const localTimezone = dayjs.tz.guess() - - const startTime = dayjs(date).tz(localTimezone).startOf('day').toISOString() - const endTime = dayjs(date).tz(localTimezone).add(this.days, 'day').endOf('day').toISOString() - - const generatedUrl = `https://api.pluto.tv/v2/channels/${channelId}?start=${startTime}&stop=${endTime}` - return generatedUrl - }, - - parser: function ({ content }) { - const data = JSON.parse(content) - const programs = [] - - if (data.timelines) { - data.timelines.forEach(item => { - programs.push({ - title: item.title, - subTitle: item.episode?.name || '', - description: item.episode?.description || '', - episode: item.episode?.number || '', - season: item.episode?.season || '', - actors: item.episode?.clip?.actors || [], - categories: [item.episode?.genre, item.episode?.subGenre].filter(Boolean), - rating: item.episode?.rating || '', - date: item.episode?.clip?.originalReleaseDate || '', - icon: item.episode?.series?.tile?.path || '', - start: item.start, - stop: item.stop - }) - }) - } - - return programs - } -} +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const timezone = require('dayjs/plugin/timezone') + +dayjs.extend(utc) +dayjs.extend(timezone) + +module.exports = { + site: 'pluto.tv', + days: 3, + + url: function ({ date, channel }) { + const channelId = channel.site_id + + const localTimezone = dayjs.tz.guess() + + const startTime = dayjs(date).tz(localTimezone).startOf('day').toISOString() + const endTime = dayjs(date).tz(localTimezone).add(this.days, 'day').endOf('day').toISOString() + + const generatedUrl = `https://api.pluto.tv/v2/channels/${channelId}?start=${startTime}&stop=${endTime}` + return generatedUrl + }, + + parser: function ({ content }) { + const data = JSON.parse(content) + const programs = [] + + if (data.timelines) { + data.timelines.forEach(item => { + programs.push({ + title: item.title, + subTitle: item.episode?.name || '', + description: item.episode?.description || '', + episode: item.episode?.number || '', + season: item.episode?.season || '', + actors: item.episode?.clip?.actors || [], + categories: [item.episode?.genre, item.episode?.subGenre].filter(Boolean), + rating: item.episode?.rating || '', + date: item.episode?.clip?.originalReleaseDate || '', + icon: item.episode?.series?.tile?.path || '', + start: item.start, + stop: item.stop + }) + }) + } + + return programs + } +} diff --git a/sites/pluto.tv/pluto.tv.test.js b/sites/pluto.tv/pluto.tv.test.js index eed3fbd5..37ec1a81 100644 --- a/sites/pluto.tv/pluto.tv.test.js +++ b/sites/pluto.tv/pluto.tv.test.js @@ -33,14 +33,17 @@ it('can parse response', () => { start: '2024-12-28T00:21:00.000Z', stop: '2024-12-28T00:48:00.000Z', title: 'Naruto: El Tercer Hokage, Eternamente', - description: 'Gaara y Naruto continĂșan combatiendo con todas sus fuerzas. Decidido a proteger a Sakura, Naruto ataca a Gaara una y otra vez.', + description: + 'Gaara y Naruto continĂșan combatiendo con todas sus fuerzas. Decidido a proteger a Sakura, Naruto ataca a Gaara una y otra vez.', subTitle: 'El Tercer Hokage, Eternamente', episode: 80, season: 2, - actors: ["Isabel Martion (Naruto Uzumaki)", - "Christine Byrd (Sakura Haruno)", - "Victor Ugarte (Sasuke Uchiha)", - "Alfonso Obreg (Kakashi Hatake)"], + actors: [ + 'Isabel Martion (Naruto Uzumaki)', + 'Christine Byrd (Sakura Haruno)', + 'Victor Ugarte (Sasuke Uchiha)', + 'Alfonso Obreg (Kakashi Hatake)' + ], categories: ['Anime', 'Anime Action & Adventure'], rating: 'TV-14', date: '2004-04-21T00:00:00.000Z', diff --git a/sites/pluto.tv/pluto.tv_ca.channels.xml b/sites/pluto.tv/pluto.tv_ca.channels.xml index 980c61ad..1d714c33 100644 --- a/sites/pluto.tv/pluto.tv_ca.channels.xml +++ b/sites/pluto.tv/pluto.tv_ca.channels.xml @@ -1,4 +1,3 @@ - Pluto TV Advent Calendar diff --git a/sites/pluto.tv/pluto.tv_uk.channels.xml b/sites/pluto.tv/pluto.tv_uk.channels.xml index ae052b92..23c413b5 100644 --- a/sites/pluto.tv/pluto.tv_uk.channels.xml +++ b/sites/pluto.tv/pluto.tv_uk.channels.xml @@ -1,4 +1,3 @@ - Diane, femme flic