From 14c60680d4befe71462f7a3fc7d4455e313df466 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 24 Sep 2021 12:04:16 +0300 Subject: [PATCH 1/6] Create tv.mail.ru.config.js --- sites/tv.mail.ru.config.js | 93 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 sites/tv.mail.ru.config.js diff --git a/sites/tv.mail.ru.config.js b/sites/tv.mail.ru.config.js new file mode 100644 index 00000000..64c5b8ea --- /dev/null +++ b/sites/tv.mail.ru.config.js @@ -0,0 +1,93 @@ +const dayjs = require('dayjs') +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 = { + lang: 'ru', + days: 3, + site: 'tv.mail.ru', + channels: 'tv.mail.ru.channels.xml', + output: '.gh-pages/guides/tv.mail.ru.guide.xml', + url({ channel, date }) { + return `https://tv.mail.ru/ajax/channel/?region_id=70&channel_id=${ + channel.site_id + }&date=${date.format('YYYY-MM-DD')}` + }, + logo({ content }) { + const json = JSON.parse(content) + if (json.status !== 'OK') return null + + return json.schedule[0].channel.pic_url_64 + }, + parser({ content, date }) { + let PM = false + const programs = [] + const items = parseItems(content) + items.forEach(item => { + const title = parseTitle(item) + const category = parseCategory(item) + let start = parseStart(item, date) + if (start.hour() > 11) PM = true + if (start.hour() < 12 && PM) start = start.add(1, 'd') + const stop = parseStop(item, date) + if (programs.length) { + programs[programs.length - 1].stop = start + } + + programs.push({ + title, + category, + start, + stop + }) + }) + + return programs + } +} + +function parseStop(item, date) { + return date.tz('Europe/Moscow').endOf('d').add(6, 'h') +} + +function parseStart(item, date) { + const time = `${date.format('MM/DD/YYYY')} ${item.start}` + + return dayjs.tz(time, 'MM/DD/YYYY HH:mm', 'Europe/Moscow') +} + +function parseTitle(item) { + return item.name +} + +function parseCategory(item) { + const categories = { + 1: 'Фильм', + 2: 'Сериал', + 6: 'Документальное', + 8: 'Позновательное', + 10: 'Другое', + 14: 'ТВ-шоу', + 16: 'Досуг,Хобби', + 17: 'Ток-шоу', + 18: 'Юмористическое', + 24: 'Развлекательное', + 25: 'Игровое', + 26: 'Новости' + } + + return categories[item.category_id] || null +} + +function parseItems(content) { + const json = JSON.parse(content) + if (json.status !== 'OK') return [] + const event = json.schedule[0].event + + return [...event.past, ...event.current] +} From 8869d609e4e830e1d846a26c53e655c70fe5d29e Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 24 Sep 2021 12:04:19 +0300 Subject: [PATCH 2/6] Create tv.mail.ru.channels.xml --- sites/tv.mail.ru.channels.xml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 sites/tv.mail.ru.channels.xml diff --git a/sites/tv.mail.ru.channels.xml b/sites/tv.mail.ru.channels.xml new file mode 100755 index 00000000..672aa8e6 --- /dev/null +++ b/sites/tv.mail.ru.channels.xml @@ -0,0 +1,23 @@ + + + + Armenia TV + ArmNews + Shant Music + 21TV + Yerkir Media TV + Kentron TV + Shoghakat TV + 5TV + Nor Hayastan TV + MuzZone TV + ATV + ATV Hay TV + ATV Filmzone + ATV Khaghaliq TV + ATV Kinoman + TBN Rossiya + H1 + ATV Bazmoc TV + + \ No newline at end of file From 4589d96187022e663f2503b7fc09c35f0da52703 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 24 Sep 2021 12:06:13 +0300 Subject: [PATCH 3/6] Update auto-update.yml --- .github/workflows/auto-update.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/auto-update.yml b/.github/workflows/auto-update.yml index ef1756e9..d121ad9a 100644 --- a/.github/workflows/auto-update.yml +++ b/.github/workflows/auto-update.yml @@ -35,6 +35,7 @@ jobs: telkussa.fi, tv.cctv.com, tv.lv, + tv.mail.ru, tv.yandex.ru, tvgid.ua, tvguide.com, From 6e9937e897ad182bde17978843d0d2ce0f386d34 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 24 Sep 2021 12:06:15 +0300 Subject: [PATCH 4/6] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index f3c51a24..8635624c 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ To load a program guide, all you need to do is copy the link to one of the guide 🇦🇱 Albaniahttps://iptv-org.github.io/epg/guides/tvprofil.com.guide.xml 🇦🇩 Andorrahttps://iptv-org.github.io/epg/guides/andorradifusio.ad.guide.xml 🇦🇷 Argentinahttps://iptv-org.github.io/epg/guides/mi.tv.guide.xml + 🇦🇲 Armeniahttps://iptv-org.github.io/epg/guides/tv.mail.ru.guide.xml 🇦🇺 Australiahttps://iptv-org.github.io/epg/guides/ontvtonight.com.guide.xml 🇧🇾 Belarushttps://iptv-org.github.io/epg/guides/tv.yandex.ru.guide.xml 🇧🇴 Boliviahttps://iptv-org.github.io/epg/guides/comteco.com.bo.guide.xml From 8cb0f90e232cbf20df70ab76e0839444d31e0bb2 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 24 Sep 2021 15:28:44 +0300 Subject: [PATCH 5/6] Update tv.mail.ru.config.js --- sites/tv.mail.ru.config.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sites/tv.mail.ru.config.js b/sites/tv.mail.ru.config.js index 64c5b8ea..ed77ca6e 100644 --- a/sites/tv.mail.ru.config.js +++ b/sites/tv.mail.ru.config.js @@ -34,7 +34,7 @@ module.exports = { let start = parseStart(item, date) if (start.hour() > 11) PM = true if (start.hour() < 12 && PM) start = start.add(1, 'd') - const stop = parseStop(item, date) + const stop = start.add(1, 'h') if (programs.length) { programs[programs.length - 1].stop = start } @@ -51,10 +51,6 @@ module.exports = { } } -function parseStop(item, date) { - return date.tz('Europe/Moscow').endOf('d').add(6, 'h') -} - function parseStart(item, date) { const time = `${date.format('MM/DD/YYYY')} ${item.start}` From ba42003b507cab564291ef88a510e5c82405cf55 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Sat, 25 Sep 2021 16:09:08 +0300 Subject: [PATCH 6/6] Update tv.mail.ru.channels.xml --- sites/tv.mail.ru.channels.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sites/tv.mail.ru.channels.xml b/sites/tv.mail.ru.channels.xml index 672aa8e6..cd3f2290 100755 --- a/sites/tv.mail.ru.channels.xml +++ b/sites/tv.mail.ru.channels.xml @@ -1,9 +1,11 @@ + Shant TV Armenia TV ArmNews Shant Music + Shant Serial 21TV Yerkir Media TV Kentron TV @@ -14,9 +16,10 @@ ATV ATV Hay TV ATV Filmzone + ATV Tava TV ATV Khaghaliq TV ATV Kinoman - TBN Rossiya + TBN Armenia H1 ATV Bazmoc TV