How to Change News Feed on Magic Mirror
# News Feed
The newsfeed
module is one of the default modules of the MagicMirror. This module displays news headlines based on an RSS feed. Scrolling through news headlines happens time-based (updateInterval
), but can also be controlled by sending news feed specific notifications to the module.
# Screenshot
- News Feed Screenshot using the NYT
# Using the module
# Configuration
To use this module, add it to the modules array in the config/config.js
file:
# Notifications
# Interacting with the module
MagicMirror's notification mechanism allows to send notifications to the newsfeed
module. The following notifications are supported:
Notification Identifier | Description |
---|---|
ARTICLE_NEXT | Shows the next news title (hiding the summary or previously fully displayed article) |
ARTICLE_PREVIOUS | Shows the previous news title (hiding the summary or previously fully displayed article) |
ARTICLE_MORE_DETAILS | When received the first time, shows the corresponding description of the currently displayed news title. The module expects that the module's configuration option showDescription is set to false (default value). When received a second consecutive time, shows the full news article in an IFRAME. DENY .When received the next consecutive times, reloads the page and scrolls down by |
ARTICLE_LESS_DETAILS | Hides the summary or full news article and only displays the news title of the currently viewed news item. |
ARTICLE_TOGGLE_FULL | Toggles article in fullscreen. |
ARTICLE_INFO_REQUEST | Causes newsfeed to respond with the notification ARTICLE_INFO_RESPONSE , the payload of which provides the title , source , date , desc and url of the current news title. |
# Notifications sent by the module
MagicMirror's notification mechanism can also be used to send notifications from the current module to all other modules. The following notifications are broadcasted from this module:
Notification Identifier | Description |
---|---|
NEWS_FEED | Broadcast the current list of news items. |
NEWS_FEED_UPDATE | Broadcasts the list of updates news items. |
Note the payload of the sent notification event is ignored.
# Example
The following example shows how the next news article title can be displayed on the MagicMirror.
# newsfeed
specific notification emitting modules
The third party MMM-Gestures module supports above notifications when moving your hand up, down, left or right in front of a gesture sensor attached to the MagicMirror. See module's readme for more details.
# Configuration options
The following properties can be configured:
Option | Description |
---|---|
feeds | An array of feed urls that will be used as source. More info about this object can be found below. Default value: [{ title: "New York Times", url: "https://www.nytimes.com/services/xml/rss/nyt/HomePage.xml", encoding: "UTF-8" }] You can add reloadInterval option to set particular reloadInterval to a feed. |
showAsList | Display the news as a list. Possible values: |
showSourceTitle | Display the title of the source. Possible values: |
showPublishDate | Display the publish date of an headline. Possible values: |
broadcastNewsFeeds | Gives the ability to broadcast news feeds to all modules, by using sendNotification() when set to true , rather than sendSocketNotification() when false Possible values: |
broadcastNewsUpdates | Gives the ability to broadcast news feed updates to all modules Possible values: |
showDescription | Display the description of an item. Possible values: |
showTitleAsUrl | If set, the displayed title is a link to the article which is useful when running in a browser and you want to read this article. Possible values: |
wrapTitle | Wrap the title of the item to multiple lines. Possible values: |
wrapDescription | Wrap the description of the item to multiple lines. Possible values: |
truncDescription | Truncate description? Possible values: |
lengthDescription | How many characters to be displayed for a truncated description? Possible values: |
hideLoading | Hide module instead of showing LOADING status. Possible values: |
reloadInterval | How often does the content needs to be fetched? (Milliseconds) Possible values: |
updateInterval | How often do you want to display a new headline? (Milliseconds) Possible values: |
animationSpeed | Speed of the update animation. (Milliseconds) Possible values: |
maxNewsItems | Total amount of news items to cycle through. (0 for unlimited) Possible values: |
ignoreOldItems | Ignore news items that are outdated. Possible values: |
ignoreOlderThan | How old should news items be before they are considered outdated? (Milliseconds) Possible values: |
removeStartTags | Some news feeds feature tags at the beginning of their titles or descriptions, such as [VIDEO]. This setting allows for the removal of specified tags from the beginning of an item's description and/or title. Possible values: |
startTags | List the tags you would like to have removed at the beginning of the feed item Possible values: |
removeEndTags | Remove specified tags from the end of an item's description and/or title. Possible values: |
endTags | List the tags you would like to have removed at the end of the feed item Possible values: |
prohibitedWords | Remove news feed item if one of these words is found anywhere in the title (case insensitive and greedy matching) Possible values: |
scrollLength | Scrolls the full news article page by a given number of pixels when a ARTICLE_MORE_DETAILS notification is received and the full news article is already displayed. Possible values: |
logFeedWarnings | Log warnings when there is an error parsing a news article. Possible values: |
The feeds
property contains an array with multiple objects. These objects have the following properties:
Option | Description |
---|---|
title | The name of the feed source to be displayed above the news items. This property is optional. |
url | The url of the feed used for the headlines. Example: |
encoding | The encoding of the news feed. This property is optional. |
christiannoing1976.blogspot.com
Source: https://docs.magicmirror.builders/modules/newsfeed.html
0 Response to "How to Change News Feed on Magic Mirror"
Post a Comment