Merge branch 'develop' into currentweather-module-updates

This commit is contained in:
Michael Teeuw
2018-03-25 14:51:47 +02:00
committed by GitHub
7 changed files with 77 additions and 19 deletions

View File

@@ -14,6 +14,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Changed 'compliments.js' - update DOM if remote compliments are loaded instead of waiting one updateInterval to show custom compliments - Changed 'compliments.js' - update DOM if remote compliments are loaded instead of waiting one updateInterval to show custom compliments
- Automated unit tests utils, deprecated, translator, cloneObject(lockstrings) - Automated unit tests utils, deprecated, translator, cloneObject(lockstrings)
- Automated integration tests translations - Automated integration tests translations
- Add advanced filtering to the excludedEvents configuration of the default calendar module
- New currentweather module config option: `showFeelsLike`: Shows how it actually feels like. (wind chill or heat index) - New currentweather module config option: `showFeelsLike`: Shows how it actually feels like. (wind chill or heat index)
- New currentweather module config option: `useKMPHwind`: adds an option to see wind speed in Kmph instead of just m/s or Beaufort. - New currentweather module config option: `useKMPHwind`: adds an option to see wind speed in Kmph instead of just m/s or Beaufort.
@@ -21,9 +22,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Add link to GitHub repository which contains the respective Dockerfile. - Add link to GitHub repository which contains the respective Dockerfile.
- Optimized automated unit tests cloneObject, cmpVersions - Optimized automated unit tests cloneObject, cmpVersions
- Update notifications use now translation templates instead of normal strings. - Update notifications use now translation templates instead of normal strings.
- Yarn can be used now as an installation tool
### Fixed ### Fixed
- News article in fullscreen (iframe) is now shown in front of modules. - News article in fullscreen (iframe) is now shown in front of modules.
- Add dc:date to parsing in newsfeed module, which allows parsing of more rss feeds.
*This release is scheduled to be released on 2018-04-01.* *This release is scheduled to be released on 2018-04-01.*

View File

@@ -50,7 +50,7 @@ bash -c "$(curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/maste
1. Download and install the latest *Node.js* version. 1. Download and install the latest *Node.js* version.
2. Clone the repository and check out the master branch: `git clone https://github.com/MichMich/MagicMirror` 2. Clone the repository and check out the master branch: `git clone https://github.com/MichMich/MagicMirror`
3. Enter the repository: `cd ~/MagicMirror` 3. Enter the repository: `cd MagicMirror/`
4. Install and run the app with: `npm install && npm start` \ 4. Install and run the app with: `npm install && npm start` \
For **Server Only** use: `npm install && node serveronly` . For **Server Only** use: `npm install && node serveronly` .
@@ -179,10 +179,6 @@ git pull && npm install
If you changed nothing more than the config or the modules, this should work without any problems. If you changed nothing more than the config or the modules, this should work without any problems.
Type `git status` to see your changes, if there are any, you can reset them with `git reset --hard`. After that, git pull should be possible. Type `git status` to see your changes, if there are any, you can reset them with `git reset --hard`. After that, git pull should be possible.
## Known issues
- Electron seems to have some issues on certain Raspberry Pi 2's. See [#145](https://github.com/MichMich/MagicMirror/issues/145).
- MagicMirror² (Electron) sometimes quits without an error after an extended period of use. See [#150](https://github.com/MichMich/MagicMirror/issues/150).
## Community ## Community

View File

@@ -42,7 +42,7 @@ sudo apt-get update || echo -e "\e[91mUpdate failed, carrying on installation ..
# Installing helper tools # Installing helper tools
echo -e "\e[96mInstalling helper tools ...\e[90m" echo -e "\e[96mInstalling helper tools ...\e[90m"
sudo apt-get install curl wget git build-essential unzip || exit sudo apt-get --assume-yes install curl wget git build-essential unzip || exit
# Check if we need to install or upgrade Node.js. # Check if we need to install or upgrade Node.js.
echo -e "\e[96mCheck current Node installation ...\e[0m" echo -e "\e[96mCheck current Node installation ...\e[0m"
@@ -82,7 +82,7 @@ if $NODE_INSTALL; then
# The NODE_STABLE_BRANCH variable will need to be manually adjusted when a new branch is released. (e.g. 7.x) # The NODE_STABLE_BRANCH variable will need to be manually adjusted when a new branch is released. (e.g. 7.x)
# Only tested (stable) versions are recommended as newer versions could break MagicMirror. # Only tested (stable) versions are recommended as newer versions could break MagicMirror.
NODE_STABLE_BRANCH="6.x" NODE_STABLE_BRANCH="9.x"
curl -sL https://deb.nodesource.com/setup_$NODE_STABLE_BRANCH | sudo -E bash - curl -sL https://deb.nodesource.com/setup_$NODE_STABLE_BRANCH | sudo -E bash -
sudo apt-get install -y nodejs sudo apt-get install -y nodejs
echo -e "\e[92mNode.js installation Done!\e[0m" echo -e "\e[92mNode.js installation Done!\e[0m"
@@ -101,7 +101,7 @@ if [ -d "$HOME/MagicMirror" ] ; then
fi fi
echo -e "\e[96mCloning MagicMirror ...\e[90m" echo -e "\e[96mCloning MagicMirror ...\e[90m"
if git clone https://github.com/MichMich/MagicMirror.git; then if git clone --depth=1 https://github.com/MichMich/MagicMirror.git; then
echo -e "\e[92mCloning MagicMirror Done!\e[0m" echo -e "\e[92mCloning MagicMirror Done!\e[0m"
else else
echo -e "\e[91mUnable to clone MagicMirror." echo -e "\e[91mUnable to clone MagicMirror."
@@ -149,7 +149,7 @@ else
fi fi
# Use pm2 control like a service MagicMirror # Use pm2 control like a service MagicMirror
read -p "Do you want use pm2 for auto starting of your MagicMirror (y/n)?" choice read -p "Do you want use pm2 for auto starting of your MagicMirror (y/N)?" choice
if [[ $choice =~ ^[Yy]$ ]]; then if [[ $choice =~ ^[Yy]$ ]]; then
sudo npm install -g pm2 sudo npm install -g pm2
sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi" sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi"

View File

@@ -46,7 +46,7 @@ The following properties can be configured:
| `urgency` | When using a timeFormat of `absolute`, the `urgency` setting allows you to display events within a specific time frame as `relative`. This allows events within a certain time frame to be displayed as relative (in xx days) while others are displayed as absolute dates <br><br> **Possible values:** a positive integer representing the number of days for which you want a relative date, for example `7` (for 7 days) <br><br> **Default value:** `7` | `urgency` | When using a timeFormat of `absolute`, the `urgency` setting allows you to display events within a specific time frame as `relative`. This allows events within a certain time frame to be displayed as relative (in xx days) while others are displayed as absolute dates <br><br> **Possible values:** a positive integer representing the number of days for which you want a relative date, for example `7` (for 7 days) <br><br> **Default value:** `7`
| `broadcastEvents` | If this property is set to true, the calendar will broadcast all the events to all other modules with the notification message: `CALENDAR_EVENTS`. The event objects are stored in an array and contain the following fields: `title`, `startDate`, `endDate`, `fullDayEvent`, `location` and `geo`. <br><br> **Possible values:** `true`, `false` <br><br> **Default value:** `true` | `broadcastEvents` | If this property is set to true, the calendar will broadcast all the events to all other modules with the notification message: `CALENDAR_EVENTS`. The event objects are stored in an array and contain the following fields: `title`, `startDate`, `endDate`, `fullDayEvent`, `location` and `geo`. <br><br> **Possible values:** `true`, `false` <br><br> **Default value:** `true`
| `hidePrivate` | Hides private calendar events. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false` | `hidePrivate` | Hides private calendar events. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `excludedEvents` | An array of words / phrases from event titles that will be excluded from being shown. <br><br> **Example:** `['Birthday', 'Hide This Event']` <br> **Default value:** `[]` | `excludedEvents` | An array of words / phrases from event titles that will be excluded from being shown. <br><br>Additionally advanced filter objects can be passed in. Below is the configuration for the advance filtering object.<br>**Required**<br>`filterBy` - string used to determine if filter is applied.<br>**Optional**<br>`until` - Time before an event to display it Ex: [`'3 days'`, `'2 months'`, `'1 week'`]<br>`caseSensitive` - By default, excludedEvents are case insensitive, set this to true to enforce case sensitivity<br><br> **Example:** `['Birthday', 'Hide This Event', {filterBy: 'Payment', until: '6 days', caseSensitive: true}]` <br> **Default value:** `[]`
### Calendar configuration ### Calendar configuration

View File

@@ -113,11 +113,38 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
title = event.description; title = event.description;
} }
var excluded = false; var excluded = false,
dateFilter = null;
for (var f in excludedEvents) { for (var f in excludedEvents) {
var filter = excludedEvents[f]; var filter = excludedEvents[f],
if (title.toLowerCase().includes(filter.toLowerCase())) { testTitle = title.toLowerCase(),
until = null;
if (filter instanceof Object) {
if (typeof filter.until !== "undefined") {
until = filter.until;
}
// If additional advanced filtering is added in, this section
// must remain last as we overwrite the filter object with the
// filterBy string
if (filter.caseSensitive) {
filter = filter.filterBy;
testTitle = title;
} else {
filter = filter.filterBy.toLowerCase();
}
} else {
filter = filter.toLowerCase();
}
if (testTitle.includes(filter)) {
if (until) {
dateFilter = until;
} else {
excluded = true; excluded = true;
}
break; break;
} }
} }
@@ -137,6 +164,11 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
for (var d in dates) { for (var d in dates) {
startDate = moment(new Date(dates[d])); startDate = moment(new Date(dates[d]));
endDate = moment(parseInt(startDate.format("x")) + duration, "x"); endDate = moment(parseInt(startDate.format("x")) + duration, "x");
if (timeFilterApplies(now, endDate, dateFilter)) {
continue;
}
if (endDate.format("x") > now) { if (endDate.format("x") > now) {
newEvents.push({ newEvents.push({
title: title, title: title,
@@ -171,6 +203,10 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
continue; continue;
} }
if (timeFilterApplies(now, endDate, dateFilter)) {
continue;
}
// Every thing is good. Add it to the list. // Every thing is good. Add it to the list.
newEvents.push({ newEvents.push({
@@ -236,6 +272,28 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri
return false; return false;
}; };
/* timeFilterApplies()
* Determines if the user defined time filter should apply
*
* argument now Date - Date object using previously created object for consistency
* argument endDate Moment - Moment object representing the event end date
* argument filter string - The time to subtract from the end date to determine if an event should be shown
*
* return bool - The event should be filtered out
*/
var timeFilterApplies = function(now, endDate, filter) {
if (filter) {
var until = filter.split(" "),
value = parseInt(until[0]),
increment = until[1].slice("-1") === "s" ? until[1] : until[1] + "s", // Massage the data for moment js
filterUntil = moment(endDate.format()).subtract(value, increment);
return now < filterUntil.format("x");
}
return false;
};
/* public methods */ /* public methods */
/* startFetch() /* startFetch()

View File

@@ -45,7 +45,7 @@ var Fetcher = function(url, reloadInterval, encoding) {
var title = item.title; var title = item.title;
var description = item.description || item.summary || item.content || ""; var description = item.description || item.summary || item.content || "";
var pubdate = item.pubdate || item.published || item.updated; var pubdate = item.pubdate || item.published || item.updated || item["dc:date"];
var url = item.url || item.link || ""; var url = item.url || item.link || "";
if (title && pubdate) { if (title && pubdate) {

View File

@@ -5,9 +5,9 @@
"main": "js/electron.js", "main": "js/electron.js",
"scripts": { "scripts": {
"start": "sh run-start.sh", "start": "sh run-start.sh",
"install": "cd vendor && npm install", "install": "cd vendor && yon install",
"install-fonts": "cd fonts && npm install", "install-fonts": "cd fonts && yon install",
"postinstall": "sh installers/postinstall/postinstall.sh && npm run install-fonts", "postinstall": "sh installers/postinstall/postinstall.sh && yon run install-fonts",
"test": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests --recursive", "test": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests --recursive",
"test:unit": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests/unit --recursive", "test:unit": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests/unit --recursive",
"test:e2e": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests/e2e --recursive", "test:e2e": "NODE_ENV=test ./node_modules/mocha/bin/mocha tests/e2e --recursive",
@@ -52,7 +52,8 @@
"spectron": "3.7.x", "spectron": "3.7.x",
"stylelint": "^8.4.0", "stylelint": "^8.4.0",
"stylelint-config-standard": "latest", "stylelint-config-standard": "latest",
"time-grunt": "latest" "time-grunt": "latest",
"yarn-or-npm": "^2.0.4"
}, },
"dependencies": { "dependencies": {
"body-parser": "^1.18.2", "body-parser": "^1.18.2",