diff --git a/scripts/commands/create-queue.js b/scripts/commands/create-queue.js index 2d7cdd5b..1930ded0 100644 --- a/scripts/commands/create-queue.js +++ b/scripts/commands/create-queue.js @@ -54,9 +54,9 @@ async function createQueue() { channel: { lang: item.lang, xmltv_id: item.xmltv_id, - site_id: item.site_id + site_id: item.site_id, + site: item.site }, - site: item.site, date: dString, configPath, groups: [], diff --git a/scripts/commands/load-cluster.js b/scripts/commands/load-cluster.js index 4002dbf8..a22811c0 100644 --- a/scripts/commands/load-cluster.js +++ b/scripts/commands/load-cluster.js @@ -45,7 +45,7 @@ async function main() { await grabber.grab(item.channel, item.date, config, async (data, err) => { logger.info( - `[${i}/${total}] ${item.site} - ${item.channel.xmltv_id} - ${data.date.format( + `[${i}/${total}] ${item.channel.site} - ${item.channel.xmltv_id} - ${data.date.format( 'MMM D, YYYY' )} (${data.programs.length} programs)` ) diff --git a/scripts/commands/save-results.js b/scripts/commands/save-results.js index 59766d8f..26a4bb55 100644 --- a/scripts/commands/save-results.js +++ b/scripts/commands/save-results.js @@ -28,7 +28,7 @@ async function main() { start: program.start, stop: program.stop, stop: program.stop, - site: item.site, + site: item.channel.site, _qid: result._qid } }) diff --git a/scripts/commands/update-api.js b/scripts/commands/update-api.js index c1c59f9c..489e5457 100644 --- a/scripts/commands/update-api.js +++ b/scripts/commands/update-api.js @@ -36,7 +36,7 @@ async function loadGuides(programs = []) { if (!item.error && channelPrograms) { output.push({ channel: item.channel.xmltv_id, - site: item.site, + site: item.channel.site, lang: item.channel.lang, url: `https://iptv-org.github.io/epg/guides/${group}.epg.xml` }) diff --git a/scripts/commands/update-guides.js b/scripts/commands/update-guides.js index c74a4204..ca77c78e 100644 --- a/scripts/commands/update-guides.js +++ b/scripts/commands/update-guides.js @@ -32,7 +32,7 @@ async function generateGuides() { if (item.error) { const error = { xmltv_id: item.channel.xmltv_id, - site: item.site, + site: item.channel.site, site_id: item.channel.site_id, lang: item.channel.lang, date: item.date, @@ -54,7 +54,7 @@ async function generateGuides() { return { id: channel.id, display_name: channel.name, - url: item.site, + url: item.channel.site, icon: channel.logo } }) diff --git a/tests/__data__/expected/database/queue-with-errors.db b/tests/__data__/expected/database/queue-with-errors.db index 96e685c1..d54025d8 100644 --- a/tests/__data__/expected/database/queue-with-errors.db +++ b/tests/__data__/expected/database/queue-with-errors.db @@ -1,5 +1,5 @@ -{"channel":{"lang":"en","xmltv_id":"BravoEast.us","site_id":"237"},"site":"directv.com","configPath":"sites/directv.com/directv.com.config.js","groups":["us/directv.com"],"cluster_id":84,"date": "2022-01-21T00:00:00Z","error":"Invalid header value char","_id":"00AluKCrCnfgrl8W"} -{"channel":{"lang":"fr","xmltv_id":"CNNInternationalEurope.us","site_id":"53"},"site":"chaines-tv.orange.fr","configPath":"tests/__data__/input/sites/example.com.config.js","groups":["fr/chaines-tv.orange.fr","bh/chaines-tv.orange.fr"],"cluster_id":1,"date": "2022-01-21T00:00:00Z","error":null,"_id":"0Wefq0oMR3feCcuY"} -{"channel":{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140"},"site":"magticom.ge","configPath":"tests/__data__/input/sites/example.com.config.js","groups":["ge/magticom.ge"],"cluster_id":1,"date": "2022-01-21T00:00:00Z","error":"Invalid header value char","_id":"1XzrxNkSF2AQNBrT"} -{"channel":{"lang":"ru","xmltv_id":"Perviykanal.ru","site_id":"1"},"site":"yandex.ru","configPath":"sites/yandex.ru/yandex.ru.config.js","groups":["ru/yandex.ru"],"error":"Some error","cluster_id":4,"date":"2022-01-21T00:00:00Z","_id":"1lnhXpN7g0ER5Xw5"} -{"channel":{"lang":"en","xmltv_id":"MNetMovies2.za","site_id":"404a052b-3dea-4cac-a19c-de9a7d6f191d#MAP"},"site":"dstv.com","configPath":"sites/dstv.com/dstv.com.config.js","groups":["zw/dstv.com"],"cluster_id":120,"date": "2022-01-21T00:00:00Z","error":null,"_id":"1lnhXpN7g0ER5XwN"} +{"channel":{"lang":"en","xmltv_id":"BravoEast.us","site_id":"237","site":"directv.com"},"configPath":"sites/directv.com/directv.com.config.js","groups":["us/directv.com"],"cluster_id":84,"date": "2022-01-21T00:00:00Z","error":"Invalid header value char","_id":"00AluKCrCnfgrl8W"} +{"channel":{"lang":"fr","xmltv_id":"CNNInternationalEurope.us","site_id":"53","site":"chaines-tv.orange.fr"},"configPath":"tests/__data__/input/sites/example.com.config.js","groups":["fr/chaines-tv.orange.fr","bh/chaines-tv.orange.fr"],"cluster_id":1,"date": "2022-01-21T00:00:00Z","error":null,"_id":"0Wefq0oMR3feCcuY"} +{"channel":{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140","site":"magticom.ge"},"configPath":"tests/__data__/input/sites/example.com.config.js","groups":["ge/magticom.ge"],"cluster_id":1,"date": "2022-01-21T00:00:00Z","error":"Invalid header value char","_id":"1XzrxNkSF2AQNBrT"} +{"channel":{"lang":"ru","xmltv_id":"Perviykanal.ru","site_id":"1","site":"yandex.ru"},"configPath":"sites/yandex.ru/yandex.ru.config.js","groups":["ru/yandex.ru"],"error":"Some error","cluster_id":4,"date":"2022-01-21T00:00:00Z","_id":"1lnhXpN7g0ER5Xw5"} +{"channel":{"lang":"en","xmltv_id":"MNetMovies2.za","site_id":"404a052b-3dea-4cac-a19c-de9a7d6f191d#MAP","site":"dstv.com"},"configPath":"sites/dstv.com/dstv.com.config.js","groups":["zw/dstv.com"],"cluster_id":120,"date": "2022-01-21T00:00:00Z","error":null,"_id":"1lnhXpN7g0ER5XwN"} diff --git a/tests/__data__/expected/database/queue.db b/tests/__data__/expected/database/queue.db index 5285dde6..93a387bd 100644 --- a/tests/__data__/expected/database/queue.db +++ b/tests/__data__/expected/database/queue.db @@ -1,4 +1,4 @@ -{"channel":{"lang":"en","xmltv_id":"CNNInternationalEurope2.us","site_id":"141"},"configPath":"tests/__data__/input/sites/example.com.config.js","site":"example.com","date":"2022-01-30T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"c4pT2p7Q4aBVh13M"} -{"channel":{"lang":"en","xmltv_id":"CNNInternationalEurope2.us","site_id":"141"},"configPath":"tests/__data__/input/sites/example.com.config.js","site":"example.com","date":"2022-01-31T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"POYAcMssTAgZu4Yk"} -{"channel":{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140"},"configPath":"tests/__data__/input/sites/example.com.config.js","site":"example.com","date":"2022-01-30T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"TYDwYLsrkmPtTLT2"} -{"channel":{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140"},"configPath":"tests/__data__/input/sites/example.com.config.js","site":"example.com","date":"2022-01-31T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"98cKRthEhMmKEnwx"} +{"channel":{"lang":"en","xmltv_id":"CNNInternationalEurope2.us","site_id":"141","site":"example.com"},"configPath":"tests/__data__/input/sites/example.com.config.js","date":"2022-01-30T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"c4pT2p7Q4aBVh13M"} +{"channel":{"lang":"en","xmltv_id":"CNNInternationalEurope2.us","site_id":"141","site":"example.com"},"configPath":"tests/__data__/input/sites/example.com.config.js","date":"2022-01-31T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"POYAcMssTAgZu4Yk"} +{"channel":{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140","site":"example.com"},"configPath":"tests/__data__/input/sites/example.com.config.js","date":"2022-01-30T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"TYDwYLsrkmPtTLT2"} +{"channel":{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140","site":"example.com"},"configPath":"tests/__data__/input/sites/example.com.config.js","date":"2022-01-31T00:00:00.000Z","groups":["ca-nl/example.com"],"error":null,"cluster_id":1,"_id":"98cKRthEhMmKEnwx"} diff --git a/tests/__data__/input/database/queue.db b/tests/__data__/input/database/queue.db index f331e44e..11d8a256 100644 --- a/tests/__data__/input/database/queue.db +++ b/tests/__data__/input/database/queue.db @@ -1,5 +1,5 @@ -{"channel":{"lang":"en","xmltv_id":"BravoEast.us","site_id":"237"},"site":"directv.com","configPath":"sites/directv.com/directv.com.config.js","groups":["us/directv.com"],"error":"Invalid header value char","cluster_id":84,"date":"2022-01-21T00:00:00Z","_id":"00AluKCrCnfgrl8W"} -{"channel":{"lang":"fr","xmltv_id":"CNNInternationalEurope.us","site_id":"53"},"site":"chaines-tv.orange.fr","configPath":"tests/__data__/input/sites/example.com.config.js","groups":["fr/chaines-tv.orange.fr", "bh/chaines-tv.orange.fr"],"error":null,"cluster_id":1,"date":"2022-01-21T00:00:00Z","_id":"0Wefq0oMR3feCcuY"} -{"channel":{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140"},"site":"magticom.ge","configPath":"tests/__data__/input/sites/example.com.config.js","groups":["ge/magticom.ge"],"error":null,"cluster_id":1,"date":"2022-01-21T00:00:00Z","_id":"1XzrxNkSF2AQNBrT"} -{"channel":{"lang":"en","xmltv_id":"MNetMovies2.za","site_id":"404a052b-3dea-4cac-a19c-de9a7d6f191d#MAP"},"site":"dstv.com","configPath":"sites/dstv.com/dstv.com.config.js","groups":["zw/dstv.com"],"error":null,"cluster_id":120,"date":"2022-01-21T00:00:00Z","_id":"1lnhXpN7g0ER5XwN"} -{"channel":{"lang":"ru","xmltv_id":"Perviykanal.ru","site_id":"1"},"site":"yandex.ru","configPath":"sites/yandex.ru/yandex.ru.config.js","groups":["ru/yandex.ru"],"error":"Some error","cluster_id":4,"date":"2022-01-21T00:00:00Z","_id":"1lnhXpN7g0ER5Xw5"} +{"channel":{"lang":"en","xmltv_id":"BravoEast.us","site_id":"237","site":"directv.com"},"configPath":"sites/directv.com/directv.com.config.js","groups":["us/directv.com"],"error":"Invalid header value char","cluster_id":84,"date":"2022-01-21T00:00:00Z","_id":"00AluKCrCnfgrl8W"} +{"channel":{"lang":"fr","xmltv_id":"CNNInternationalEurope.us","site_id":"53","site":"chaines-tv.orange.fr"},"configPath":"tests/__data__/input/sites/example.com.config.js","groups":["fr/chaines-tv.orange.fr", "bh/chaines-tv.orange.fr"],"error":null,"cluster_id":1,"date":"2022-01-21T00:00:00Z","_id":"0Wefq0oMR3feCcuY"} +{"channel":{"lang":"ru","xmltv_id":"CNNInternationalEurope.us","site_id":"140","site":"magticom.ge"},"configPath":"tests/__data__/input/sites/example.com.config.js","groups":["ge/magticom.ge"],"error":null,"cluster_id":1,"date":"2022-01-21T00:00:00Z","_id":"1XzrxNkSF2AQNBrT"} +{"channel":{"lang":"en","xmltv_id":"MNetMovies2.za","site_id":"404a052b-3dea-4cac-a19c-de9a7d6f191d#MAP","site":"dstv.com"},"configPath":"sites/dstv.com/dstv.com.config.js","groups":["zw/dstv.com"],"error":null,"cluster_id":120,"date":"2022-01-21T00:00:00Z","_id":"1lnhXpN7g0ER5XwN"} +{"channel":{"lang":"ru","xmltv_id":"Perviykanal.ru","site_id":"1","site":"yandex.ru"},"configPath":"sites/yandex.ru/yandex.ru.config.js","groups":["ru/yandex.ru"],"error":"Some error","cluster_id":4,"date":"2022-01-21T00:00:00Z","_id":"1lnhXpN7g0ER5Xw5"}