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] 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