diff --git a/scripts/commands/update-api.js b/scripts/commands/update-api.js index 7772c361..78a4d11b 100644 --- a/scripts/commands/update-api.js +++ b/scripts/commands/update-api.js @@ -26,16 +26,20 @@ async function loadChannels() { if (!output[item.xmltv_id]) { output[item.xmltv_id] = { id: item.xmltv_id, - name: [item.name], + name: [], logo: item.logo || null, - country: item.country + country: item.country, + guides: [] } } else { output[item.xmltv_id].logo = output[item.xmltv_id].logo || item.logo - output[item.xmltv_id].name.push(item.name) } + output[item.xmltv_id].name.push(item.name) output[item.xmltv_id].name = _.uniq(output[item.xmltv_id].name) + output[item.xmltv_id].guides.push( + `https://iptv-org.github.io/epg/guides/${item.gid}/${item.site}.epg.xml` + ) }) return Object.values(output) diff --git a/tests/__data__/expected/api/channels.json b/tests/__data__/expected/api/channels.json index 4d674b87..fffca454 100644 --- a/tests/__data__/expected/api/channels.json +++ b/tests/__data__/expected/api/channels.json @@ -1 +1 @@ -[{"id":"BravoEast.us","name":["Bravo East"],"logo":"https://www.directv.com/images/logos/channels/dark/large/579.png","country":"US"},{"id":"CNNInternationalEurope.us","name":["CNN International Europe","CNN Int"],"logo":"https://proxymedia.woopic.com/api/v1/images/553%2Flogos%2Fv2%2Flogos%2Flivetv_cnn%2F20151026_092415%2FwebTVLogo%2Flogo_180x96.png","country":"US"},{"id":"MNetMovies2.za","name":["M-Net Movies 2"],"logo":"https://rndcdn.dstv.com/dstvcms/2020/08/31/M-Net_Movies_2_Logo_4-3_lightbackground_xlrg.png","country":"ZA"}] \ No newline at end of file +[{"id":"BravoEast.us","name":["Bravo East"],"logo":"https://www.directv.com/images/logos/channels/dark/large/579.png","country":"US","guides":["https://iptv-org.github.io/epg/guides/us/directv.com.epg.xml"]},{"id":"CNNInternationalEurope.us","name":["CNN International Europe","CNN Int"],"logo":"https://proxymedia.woopic.com/api/v1/images/553%2Flogos%2Fv2%2Flogos%2Flivetv_cnn%2F20151026_092415%2FwebTVLogo%2Flogo_180x96.png","country":"US","guides":["https://iptv-org.github.io/epg/guides/fr/chaines-tv.orange.fr.epg.xml","https://iptv-org.github.io/epg/guides/ge/magticom.ge.epg.xml"]},{"id":"MNetMovies2.za","name":["M-Net Movies 2"],"logo":"https://rndcdn.dstv.com/dstvcms/2020/08/31/M-Net_Movies_2_Logo_4-3_lightbackground_xlrg.png","country":"ZA","guides":["https://iptv-org.github.io/epg/guides/zw/dstv.com.epg.xml"]}] \ No newline at end of file