Read the statement by Michael Teeuw here.
MMM-News
-
@mrdenmark
usebbc-news
as source. -
Hey, I’m getting this error message:
[NEWS] Error : https://newsapi.org/v2/top-headlines?pageSize=20&apiKey=XXX result.code:Required parameters are missing. Please set any of the following parameters and try again: sources, q, language, country, category.
although I think have that configured correctly:
{ module: "MMM-News", position: "bottom_right", config: { apiKey : "XXX", type: "vertical", query : [ { language: "de" } ], items: 20, timeFormat: "relative", endpoint : "https://newsapi.org/v2/top-headlines", scanInterval: 1000*60*10, // This will be automatically recalculated by number of queries to avoid query quota limit. This could be minimum interval. templateFile: "template.html" } },
Any help is greatly appreciated :)
-
@dankerthrone
change language to country -
Hi. Is it possible to have two different queries of news, each displayed in a separate horizontal position?
-
@uros76 sure it is… see picture below…
Just using the stock newsfeed in MM…[I DETEST CNN but needed a quick example]
You can then use them in the same region or put one each in different regions.
The example is both using bottom_bar but I did try and put one in bottom_bar the other in middle_center and still works… ;)[Just remember IF you copy the below code and put it in your config.js it will give you an error… you have to change the quotes “” or ‘’ because they do NOT copy correctly].
{ module: 'newsfeed', position: 'bottom_bar', config: { feeds: [ { title: "CNN", url: "http://rss.cnn.com/rss/cnn_latest.rss" } ], showSourceTitle: true, showPublishDate: true } }, { module: 'newsfeed', position: 'bottom_bar', config: { feeds: [ { title: "New York Times", url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml" } ], showSourceTitle: true, showPublishDate: true } },
-
Thanks @cowboysdude for the tips. I was more thinking of having two instances of MMM-News module because I like its ability to show a small pic. But multiple uses of MMM-News doesn’t seem to work :/.
Instead, I combined two modules and now have two different feeds working, the second one just without a picture.
-
MMM-News
Oh I see. I don’t have an api key for that so I can’t really test that one ;) I know you’re setup is not what you wanted but not really sure why running 2 of them is not working without being able to test it.
Here’s an idea… setup up 2 of them again and when you run your mirror run it in ‘npm start dev’ mode and see if you get any errors in the console.
-
not so easy.
MM legacy structure doesn’t consider multiple instances of node_helper. One module should have just one node_helper and vice versa. So, the cloning instance of the module needs some manual fixing. Some simple modules could be clonable easily(like the original
newsfeed
module), but not this module’s case.Another point is, to get news individually through cloned modules(If you’ve done somehow), it will consume system resources twice. and API quota also will be consumed doubly. Hmmm. it is not so beautiful.
A reasonable approach would be, Making a serving-slave process(which access the news API) by spawn/fork from one node_helper of the module. then other cloned modules would connect to the slave to get their own needs.
Or make another front-end module, which would just pull data from the original module.
Anyway, I didn’t make this module for that purpose. And under the current MM structure, to do so is not so easy.
Finally, I’m not supporting this module anymore. So, sorry. not possible by me.
-
Ok @Sean understand the drawbacks of MM structure and thanks for all the work on this module.
It was just a thought if its possible. I will live with use of two modules :) -
@Sean I added support in my MyCovid19 module for multiple instances… it was different, but not hard
on all modlename.js sendSocketNotificatons, add the module identifier
on all node_helper sendSocketNotifications, send it backin modulename.js , CHECK all receiveSocketNotifcation messages to see if its intended for this instance, as the sendSocketNotification from the node_helper goes to ALL modulename.js instances at once.
then in node_helper I cached the data (as u proposed with the server instance), and for every request fordata from the modulename.js, I check to see if the data has arrived,
if not, the 1st instance to arrive calls the api to get the data, all others block in Promise
once the data arrives, all get resolved() with the data
if the data is already here, then I resolve() with the datain my production system I have 11 charts drawn, and have 2 extra browser windows open to the MM server, so 33 charts in all, served by one node_helper all sharing one data source, and only making 1 api call for the data