From 72a42b6c02692b9ec194c2c888c4d9cd7d26d7b5 Mon Sep 17 00:00:00 2001
From: RevGear <95308545+RevGear@users.noreply.github.com>
Date: Wed, 21 Sep 2022 21:57:09 +0100
Subject: [PATCH 1/3] programetv.ro dual language
programetv.ro data has a fields for title and titleOriginal. Typically titleOriginal will be the original English language title for films and other programs that are broadcast in English. It's not always English but is more often than not.
Duplicated the channels xml. The 'English' version uses the original title where available. Description will still be Romanian.
Moved season/episode into separate fields rather than being appended to the title. Also added date, rating, director/actors and URL.
---
sites/programetv.ro/programetv.ro.config.js | 46 +++-
.../programetv.ro_ro-en.channels.xml | 238 ++++++++++++++++++
...s.xml => programetv.ro_ro-ro.channels.xml} | 0
3 files changed, 274 insertions(+), 10 deletions(-)
create mode 100644 sites/programetv.ro/programetv.ro_ro-en.channels.xml
rename sites/programetv.ro/{programetv.ro_ro.channels.xml => programetv.ro_ro-ro.channels.xml} (100%)
diff --git a/sites/programetv.ro/programetv.ro.config.js b/sites/programetv.ro/programetv.ro.config.js
index 0b5f8a4e..b106fba5 100644
--- a/sites/programetv.ro/programetv.ro.config.js
+++ b/sites/programetv.ro/programetv.ro.config.js
@@ -16,21 +16,26 @@ module.exports = {
return `https://www.programetv.ro/post/${channel.site_id}/${daysOfWeek[day]}/`
},
- parser: function ({ content }) {
+ parser: function ({ content, channel }) {
let programs = []
const data = parseContent(content)
if (!data || !data.shows) return programs
const items = data.shows
items.forEach(item => {
- let title = item.title
- if (item.season) title += ` Sez.${item.season}`
- if (item.episode) title += ` Ep.${item.episode}`
programs.push({
- title,
- description: item.desc,
+ title: parseTitle(item, channel),
+ sub_title: item.subTitle || null,
+ description: item.desc || item.obs,
category: item.categories,
- start: parseStart(item).toString(),
- stop: parseStop(item).toString(),
+ season: item.season || null,
+ episode: item.episode || null,
+ start: parseStart(item),
+ stop: parseStop(item),
+ url: item.url || null,
+ date: item.date,
+ rating: parseRating(item),
+ directors: parseDirector(item),
+ actors: parseActor(item),
icon: item.icon
})
})
@@ -40,11 +45,11 @@ module.exports = {
}
function parseStart(item) {
- return dayjs(item.start).utc()
+ return dayjs.utc(item.start)
}
function parseStop(item) {
- return dayjs(item.stop).utc()
+ return dayjs.utc(item.stop)
}
function parseContent(content) {
@@ -52,3 +57,24 @@ function parseContent(content) {
return data ? JSON.parse(data) : {}
}
+
+function parseTitle(item, channel) {
+ return (channel.lang === 'ro' || !item.titleOriginal) ? item.title : item.titleOriginal
+}
+
+function parseDirector(item) {
+ return item.credits && item.credits.director ? item.credits.director : null
+}
+
+function parseActor(item) {
+ return item.credits && item.credits.actor ? item.credits.actor : null
+}
+
+function parseRating(item) {
+ return item.rating
+ ? {
+ system: 'CNC',
+ value: item.rating.toUpperCase()
+ }
+ : null
+ }
diff --git a/sites/programetv.ro/programetv.ro_ro-en.channels.xml b/sites/programetv.ro/programetv.ro_ro-en.channels.xml
new file mode 100644
index 00000000..9d69be1a
--- /dev/null
+++ b/sites/programetv.ro/programetv.ro_ro-en.channels.xml
@@ -0,0 +1,238 @@
+
+
+
+ 3sat
+ Acasa
+ Acasa Gold
+ Agro TV
+ Aleph News
+ Alfa Omega TV
+ Aljazeera
+ AMC
+ Animal Planet
+ Antena 1
+ Antena 3
+ Antena International
+ Antena Stars
+ Auto Motor und Sport
+ Arcadia TV
+ AXN Black
+ AXN
+ AXN Spin
+ AXN White
+ B1
+ Baby TV
+ Balkanika Music TV
+ BBC Earth
+ BBC World News
+ Bloomberg TV
+ Blue Hustler
+ Bollywood HD
+ Bollywood TV
+ Boomerang
+ Brazzers TV Europe
+ Cartoon Network
+ CBS Reality
+ CGTN
+ Cinemax 2
+ Cinemax
+ Club MTV
+ CNN
+ Comedy Central
+ Cool TV
+ Credo TV
+ Crime + Investigation
+ Das Erste
+ Da Vinci
+ Digi 24
+ Digi Animal World
+ Digi Life
+ Digi Sport 1
+ Digi Sport 2
+ Digi Sport 3
+ Digi Sport 4
+ Digi World
+ Discovery Channel
+ Discovery Science
+ Disney Channel
+ Diva Romania
+ Dizi
+ DocuBox HD
+ Dorcel TV
+ DTX
+ Duck TV
+ Duna TV
+ Duna World
+ DW
+ E!
+ Epic Drama
+ Erdély TV
+ Erox HD
+ Eroxxx HD
+ Etno TV
+ EuroNews
+ Eurosport 1
+ Eurosport 2
+ Eurosport 4K
+ Extreme Sports Channel
+ FashionBox HD
+ FashionTV
+ FashionTV HD
+ Favorit TV
+ FightBox HD
+ Film 4 UK
+ FilmBox Arthouse Worldwide
+
+ FilmBox Family
+ FilmBox Premium
+ Film Café
+ Film Now
+ Food Network
+ France 2
+ France 24 English
+ France 24
+ France 3
+ France 5
+ Fuel TV
+ FunBox UHD
+ Galaxy 4
+ Ginx eSports TV
+ Happy Channel
+ HBO 2
+ HBO 3
+ HBO Romania
+ History România
+ H!t Music Channel
+ Hustler HD
+ Hustler TV
+ Inedit TV
+ Investigation Discovery
+ JimJam
+ Kabel Eins
+ Kanal D
+ KIKA
+ Kiss TV
+ Love Nature
+ Luxe TV
+ M1
+ M2
+ M4 Sport
+ M5
+ Magic TV
+ Mediaset Italia
+ Mezzo
+ Mezzo Live HD
+ Minimax
+ Mooz Dance
+ Mooz Hits
+ Mooz Ro!
+ Motorvision HD
+ MTV 80s
+ MTV 90s
+ MTV Hits
+ MTV Live HD
+ Museum HD
+ Music Channel
+ Muzsika TV
+ MyZen HD
+ Nasul TV
+ National 24 Plus
+ National Geographic
+ National Geographic Wild
+ National TV
+ Nautical Channel
+ Nickelodeon
+ Nick Jr
+ Nicktoons
+ Nitro
+ N-TV
+ Orange Sport 1
+ Orange Sport 1 HD
+ Orange Sport 2
+ Orange Sport 3
+ Orange Sport 4
+ Phoenix
+ Playboy TV
+ Prima 4K
+ Prima Sport 1
+ Prima Sport 1 HD
+ Prima Sport 2
+ Prima Sport 2 HD
+ Prima Sport 3
+ Prima Sport 3 HD
+ Prima Sport 4
+ Prima Sport 4 HD
+ Prima TV
+ Prima TV HD
+ Private TV
+ Pro Arena
+ Pro Cinema
+ Profit TV
+ ProSieben
+ Pro TV
+ Pro TV International
+ Publika TV
+ Rai 1
+ Rai 2
+ Rai 3
+ Realitatea Plus
+ Redlight HD
+ Rock TV
+ România TV
+ RTL
+ RTL Gold
+ RTL II Hungary
+ RTL Klub
+ RTL +
+ RTL Zwei
+ RT HD
+ Sat. 1
+ Sixx
+ Sorozat +
+ Speranta TV
+ Sport Extra
+ Stingray Classica
+ Stingray Djazz
+ Stingray IConcerts HD
+ Story 4
+ Super RTL
+ Taraf TV
+ TeenNick
+ The Fishing & Hunting Channel
+ TLC
+ Trace Caribbean
+ Trace Sport Stars
+ Trace Urban HD
+ Travel Channel
+ Travel Mix
+ Trinitas TV
+ TV 1000
+ TV 1000 Russkoe Kino
+ TV 4
+ TV5Monde Europe
+ TVE
+ TV Paprika
+ TVR 1
+ TVR 2
+ TVR 3
+ TVR Cluj
+ TVR Craiova
+ TVR Iasi
+ TVR International
+ TVR Moldova
+ TVR Targu-Mures
+ TVR Timisoara
+ U TV
+ Viasat Explore
+ Viasat History
+ Viasat Nature
+ Vox
+ VTV
+ Warner TV
+ Welt
+ ZDF
+ ZDF Info
+ ZDF Neo
+ Zu TV
+
+
diff --git a/sites/programetv.ro/programetv.ro_ro.channels.xml b/sites/programetv.ro/programetv.ro_ro-ro.channels.xml
similarity index 100%
rename from sites/programetv.ro/programetv.ro_ro.channels.xml
rename to sites/programetv.ro/programetv.ro_ro-ro.channels.xml
From c42b643623412aba09871a3ed3bb1831f13658f3 Mon Sep 17 00:00:00 2001
From: RevGear <95308545+RevGear@users.noreply.github.com>
Date: Wed, 21 Sep 2022 22:23:45 +0100
Subject: [PATCH 2/3] test and timezone
---
sites/programetv.ro/programetv.ro.config.js | 7 +++++--
sites/programetv.ro/programetv.ro.test.js | 4 ++--
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/sites/programetv.ro/programetv.ro.config.js b/sites/programetv.ro/programetv.ro.config.js
index b106fba5..47415f0e 100644
--- a/sites/programetv.ro/programetv.ro.config.js
+++ b/sites/programetv.ro/programetv.ro.config.js
@@ -1,4 +1,7 @@
const dayjs = require('dayjs')
+const utc = require('dayjs/plugin/utc')
+
+dayjs.extend(utc)
module.exports = {
site: 'programetv.ro',
@@ -45,11 +48,11 @@ module.exports = {
}
function parseStart(item) {
- return dayjs.utc(item.start)
+ return dayjs(item.start).toJSON()
}
function parseStop(item) {
- return dayjs.utc(item.stop)
+ return dayjs(item.stop).toJSON()
}
function parseContent(content) {
diff --git a/sites/programetv.ro/programetv.ro.test.js b/sites/programetv.ro/programetv.ro.test.js
index fcac56de..25eac803 100644
--- a/sites/programetv.ro/programetv.ro.test.js
+++ b/sites/programetv.ro/programetv.ro.test.js
@@ -35,8 +35,8 @@ it('can parse response', () => {
const result = parser({ date, channel, content })
expect(result).toMatchObject([
{
- start: 'Sun, 07 Nov 2021 05:00:00 GMT',
- stop: 'Sun, 07 Nov 2021 07:59:59 GMT',
+ start: '2021-11-07T05:00:00.000Z',
+ stop: '2021-11-07T07:59:59.000Z',
title: 'Ştirile Pro Tv',
description: `În fiecare zi, cele mai importante evenimente, transmisiuni LIVE, analize, anchete şi reportaje sunt la Ştirile ProTV.`,
category: ['Ştiri'],
From fa936a76e1dbc097b102aabc98fedaadab22d8c4 Mon Sep 17 00:00:00 2001
From: RevGear <95308545+RevGear@users.noreply.github.com>
Date: Thu, 22 Sep 2022 17:14:10 +0100
Subject: [PATCH 3/3] remove dual language
---
sites/programetv.ro/programetv.ro.config.js | 7 +-
.../programetv.ro_ro-en.channels.xml | 238 ------------------
...nels.xml => programetv.ro_ro.channels.xml} | 0
3 files changed, 2 insertions(+), 243 deletions(-)
delete mode 100644 sites/programetv.ro/programetv.ro_ro-en.channels.xml
rename sites/programetv.ro/{programetv.ro_ro-ro.channels.xml => programetv.ro_ro.channels.xml} (100%)
diff --git a/sites/programetv.ro/programetv.ro.config.js b/sites/programetv.ro/programetv.ro.config.js
index 47415f0e..b6df7e74 100644
--- a/sites/programetv.ro/programetv.ro.config.js
+++ b/sites/programetv.ro/programetv.ro.config.js
@@ -26,8 +26,8 @@ module.exports = {
const items = data.shows
items.forEach(item => {
programs.push({
- title: parseTitle(item, channel),
- sub_title: item.subTitle || null,
+ title: item.title,
+ sub_title: item.titleOriginal,
description: item.desc || item.obs,
category: item.categories,
season: item.season || null,
@@ -61,9 +61,6 @@ function parseContent(content) {
return data ? JSON.parse(data) : {}
}
-function parseTitle(item, channel) {
- return (channel.lang === 'ro' || !item.titleOriginal) ? item.title : item.titleOriginal
-}
function parseDirector(item) {
return item.credits && item.credits.director ? item.credits.director : null
diff --git a/sites/programetv.ro/programetv.ro_ro-en.channels.xml b/sites/programetv.ro/programetv.ro_ro-en.channels.xml
deleted file mode 100644
index 9d69be1a..00000000
--- a/sites/programetv.ro/programetv.ro_ro-en.channels.xml
+++ /dev/null
@@ -1,238 +0,0 @@
-
-
-
- 3sat
- Acasa
- Acasa Gold
- Agro TV
- Aleph News
- Alfa Omega TV
- Aljazeera
- AMC
- Animal Planet
- Antena 1
- Antena 3
- Antena International
- Antena Stars
- Auto Motor und Sport
- Arcadia TV
- AXN Black
- AXN
- AXN Spin
- AXN White
- B1
- Baby TV
- Balkanika Music TV
- BBC Earth
- BBC World News
- Bloomberg TV
- Blue Hustler
- Bollywood HD
- Bollywood TV
- Boomerang
- Brazzers TV Europe
- Cartoon Network
- CBS Reality
- CGTN
- Cinemax 2
- Cinemax
- Club MTV
- CNN
- Comedy Central
- Cool TV
- Credo TV
- Crime + Investigation
- Das Erste
- Da Vinci
- Digi 24
- Digi Animal World
- Digi Life
- Digi Sport 1
- Digi Sport 2
- Digi Sport 3
- Digi Sport 4
- Digi World
- Discovery Channel
- Discovery Science
- Disney Channel
- Diva Romania
- Dizi
- DocuBox HD
- Dorcel TV
- DTX
- Duck TV
- Duna TV
- Duna World
- DW
- E!
- Epic Drama
- Erdély TV
- Erox HD
- Eroxxx HD
- Etno TV
- EuroNews
- Eurosport 1
- Eurosport 2
- Eurosport 4K
- Extreme Sports Channel
- FashionBox HD
- FashionTV
- FashionTV HD
- Favorit TV
- FightBox HD
- Film 4 UK
- FilmBox Arthouse Worldwide
-
- FilmBox Family
- FilmBox Premium
- Film Café
- Film Now
- Food Network
- France 2
- France 24 English
- France 24
- France 3
- France 5
- Fuel TV
- FunBox UHD
- Galaxy 4
- Ginx eSports TV
- Happy Channel
- HBO 2
- HBO 3
- HBO Romania
- History România
- H!t Music Channel
- Hustler HD
- Hustler TV
- Inedit TV
- Investigation Discovery
- JimJam
- Kabel Eins
- Kanal D
- KIKA
- Kiss TV
- Love Nature
- Luxe TV
- M1
- M2
- M4 Sport
- M5
- Magic TV
- Mediaset Italia
- Mezzo
- Mezzo Live HD
- Minimax
- Mooz Dance
- Mooz Hits
- Mooz Ro!
- Motorvision HD
- MTV 80s
- MTV 90s
- MTV Hits
- MTV Live HD
- Museum HD
- Music Channel
- Muzsika TV
- MyZen HD
- Nasul TV
- National 24 Plus
- National Geographic
- National Geographic Wild
- National TV
- Nautical Channel
- Nickelodeon
- Nick Jr
- Nicktoons
- Nitro
- N-TV
- Orange Sport 1
- Orange Sport 1 HD
- Orange Sport 2
- Orange Sport 3
- Orange Sport 4
- Phoenix
- Playboy TV
- Prima 4K
- Prima Sport 1
- Prima Sport 1 HD
- Prima Sport 2
- Prima Sport 2 HD
- Prima Sport 3
- Prima Sport 3 HD
- Prima Sport 4
- Prima Sport 4 HD
- Prima TV
- Prima TV HD
- Private TV
- Pro Arena
- Pro Cinema
- Profit TV
- ProSieben
- Pro TV
- Pro TV International
- Publika TV
- Rai 1
- Rai 2
- Rai 3
- Realitatea Plus
- Redlight HD
- Rock TV
- România TV
- RTL
- RTL Gold
- RTL II Hungary
- RTL Klub
- RTL +
- RTL Zwei
- RT HD
- Sat. 1
- Sixx
- Sorozat +
- Speranta TV
- Sport Extra
- Stingray Classica
- Stingray Djazz
- Stingray IConcerts HD
- Story 4
- Super RTL
- Taraf TV
- TeenNick
- The Fishing & Hunting Channel
- TLC
- Trace Caribbean
- Trace Sport Stars
- Trace Urban HD
- Travel Channel
- Travel Mix
- Trinitas TV
- TV 1000
- TV 1000 Russkoe Kino
- TV 4
- TV5Monde Europe
- TVE
- TV Paprika
- TVR 1
- TVR 2
- TVR 3
- TVR Cluj
- TVR Craiova
- TVR Iasi
- TVR International
- TVR Moldova
- TVR Targu-Mures
- TVR Timisoara
- U TV
- Viasat Explore
- Viasat History
- Viasat Nature
- Vox
- VTV
- Warner TV
- Welt
- ZDF
- ZDF Info
- ZDF Neo
- Zu TV
-
-
diff --git a/sites/programetv.ro/programetv.ro_ro-ro.channels.xml b/sites/programetv.ro/programetv.ro_ro.channels.xml
similarity index 100%
rename from sites/programetv.ro/programetv.ro_ro-ro.channels.xml
rename to sites/programetv.ro/programetv.ro_ro.channels.xml