diff --git a/.gitignore b/.gitignore index fbe259c4..708870ec 100644 --- a/.gitignore +++ b/.gitignore @@ -3,11 +3,5 @@ !/modules/node_helper !/modules/node_helper/** -/modules/* -!/modules/calendar -!/modules/clock -!/modules/compliments -!/modules/currentweather -!/modules/helloworld -!/modules/newsfeed -!/modules/weatherforecast +/modules/** +!/modules/default/** diff --git a/README.md b/README.md index 80bc19f9..3df3738a 100644 --- a/README.md +++ b/README.md @@ -24,13 +24,13 @@ Things that still have to be implemented or changed. ##Modules ### Default modules: -- **Clock** -- **Calendar** -- **Current Weather** -- **Weather Forecast** -- **News Feed** -- **Compliments** -- **Hello World** +- [**Clock**](modules/default/clock) +- [**Calendar**](modules/default/calendar) +- [**Current Weather**](modules/default/currentweather) +- [**Weather Forecast**](modules/default/weatherforecast) +- [**News Feed**](modules/default/newsfeed) +- [**Compliments**](modules/default/compliments) +- [**Hello World**](modules/default/helloworld) ### 3rd Party Modules: diff --git a/index.html b/index.html index 70b73040..18eb65e9 100644 --- a/index.html +++ b/index.html @@ -31,6 +31,7 @@ + diff --git a/js/electron.js b/js/electron.js index fc05c10e..74192f6c 100755 --- a/js/electron.js +++ b/js/electron.js @@ -6,7 +6,7 @@ const fs = require('fs'); const Server = require(__dirname + '/server.js'); const spawn = require('child_process').spawn; const electron = require('electron'); - +const defaultModules = require(__dirname + '/../modules/default/defaultmodules.js'); // Config var config = {}; @@ -56,8 +56,18 @@ function loadConfig (callback) { } } -function loadModule(moduleName) { - var helperPath = __dirname + '/../modules/' + moduleName + '/node_helper.js'; +function loadModule(module) { + + var elements = module.split('/'); + var moduleName = elements[elements.length - 1]; + var moduleFolder = __dirname + '/../modules/' + module; + + if (defaultModules.indexOf(moduleName) !== -1) { + moduleFolder = __dirname + '/../modules/default/' + module; + } + + var helperPath = moduleFolder + '/node_helper.js'; + var loadModule = true; try { fs.accessSync(helperPath, fs.R_OK); diff --git a/js/loader.js b/js/loader.js index a35c013c..0c6f661c 100644 --- a/js/loader.js +++ b/js/loader.js @@ -79,12 +79,20 @@ var Loader = (function() { var moduleData = modules[m]; var module = moduleData.module; + var elements = module.split('/'); + var moduleName = elements[elements.length - 1]; + var moduleFolder = config.paths.modules + '/' + module; + + if (defaultModules.indexOf(moduleName) !== -1) { + moduleFolder = config.paths.modules + '/default/' + module; + } + moduleFiles.push({ index: m, identifier: 'module_' + m + '_' + module, - name: module, - path: config.paths.modules + '/' + module, - file: module + '.js', + name: moduleName, + path: moduleFolder + '/' , + file: moduleName + '.js', position: moduleData.position, header: moduleData.header, config: moduleData.config, diff --git a/js/main.js b/js/main.js index cf81ca3f..4bc15d02 100644 --- a/js/main.js +++ b/js/main.js @@ -49,7 +49,7 @@ var MM = (function() { - updateDom(module, 500); + updateDom(module, 0); } } diff --git a/modules/default/calendar/README.md b/modules/default/calendar/README.md new file mode 100644 index 00000000..41d6242e --- /dev/null +++ b/modules/default/calendar/README.md @@ -0,0 +1,152 @@ +# Module: Calendar +The `calendar` module is one of the default modules of the MagicMirror. +This module displays events from a public .ical calendar. It can combine multiple calendars. + +## Using the module + +To use this module, add it to the modules array in the `config/config.js` file: +````javascript +modules: [ + { + module: 'calendar', + position: 'top_left', // This can be any of the regions. Best results in left or right regions. + config: { + // The config property is optional. + // If no config is set, an example calendar is shown. + // See 'Configuration options' for more information. + } + } +] +```` + +## Configuration options + +The following properties can be configured: + + +
Option | +Description | +
---|---|
maximumEntries |
+ The maximum number of events shown. + Possible values: 0 - 100
+ Default value: 10
+ |
+
displaySymbol |
+ Display a symbol in front of an entry. + Possible values: true or false
+ Default value: true
+ |
+
defaultSymbol |
+ The default symbol. + Possible values: See Font Awsome website. + Default value: calendar
+ |
+
maxTitleLength |
+ The maximum title length. + Possible values: 10 - 50
+ Default value: 25
+ |
+
fetchInterval |
+ How often does the content needs to be fetched? (Milliseconds) + Possible values: 1000 - 86400000
+ Default value: 300000 (5 minutes)
+ |
+
animationSpeed |
+ Speed of the update animation. (Milliseconds) + Possible values: 0 - 5000
+ Default value: 2000 (2 seconds)
+ |
+
fade |
+ Fade the future events to black. (Gradient) + Possible values: true or false
+ Default value: true
+ |
+
fadePoint |
+ Where to start fade? + Possible values: 0 (top of the list) - 1 (bottom of list)
+ Default value: 0.25
+ |
+
calendars |
+ The list of calendars. + Possible values: An array, see calendar configuration below. + Default value: An example calendar. + |
+
titleReplace |
+ An object of textual replacements applied to the tile of the event. This allow to remove or replace certains words in the title. + Example: + +
+ titleReplace: {'Birthday of ' : '', 'foo':'bar'}
+
+ |
+
Option | +Description | +
---|---|
url |
+ The url of the calendar .ical. This property is required. + Possible values: Any public accessble .ical calendar. + |
+
symbol |
+ The symbol to show in front of an event. This property is optional. + Possible values: See Font Awsome website. + |
+
Option | +Description | +
---|---|
timeFormat |
+ Use 12 or 24 hour format. + Possible values: 12 or 24
+ Default value: uses value of config.timeFormat + |
+
displaySeconds |
+ Display seconds. + Possible values: true or false
+ Default value: true
+ |
+
Option | +Description | +
---|---|
updateInterval |
+ How often does the compliment have to change? (Milliseconds) + Possible values: 1000 - 86400000
+ Default value: 30000 (30 seconds)
+ |
+
fadeSpeed |
+ Speed of the update animation. (Milliseconds) + Possible values: 0 - 5000
+ Default value: 4000 (4 seconds)
+ |
+
compliments |
+ The list of compliments. + Possible values: An object with three arrays: morning , afternoon andevening . See compliment configuration below.
+ Default value: See compliment configuration below. + |
+
morning
, afternoon
andevening
. Based on the time of the day, the compliments will be picked out of one of these arrays. The arrays contain one or multiple compliments.
+
+#### Default value:
+````javascript
+config: {
+ compliments: {
+ morning: [
+ 'Good morning, handsome!',
+ 'Enjoy your day!',
+ 'How was your sleep?'
+ ],
+ afternoon: [
+ 'Hello, beauty!',
+ 'You look sexy!',
+ 'Looking good today!'
+ ],
+ evening: [
+ 'Wow, you look hot!',
+ 'You look nice!',
+ 'Hi, sexy!'
+ ]
+ }
+}
+````
\ No newline at end of file
diff --git a/modules/compliments/compliments.js b/modules/default/compliments/compliments.js
similarity index 100%
rename from modules/compliments/compliments.js
rename to modules/default/compliments/compliments.js
diff --git a/modules/default/currentweather/README.md b/modules/default/currentweather/README.md
new file mode 100644
index 00000000..c3834674
--- /dev/null
+++ b/modules/default/currentweather/README.md
@@ -0,0 +1,145 @@
+# Module: Current Weather
+The `currentweather` module is one of the default modules of the MagicMirror.
+This module displays the current weather, including the windspeed, the sunset or sunrise time, the temperature and an icon to display the current conditions.
+
+## Using the module
+
+To use this module, add it to the modules array in the `config/config.js` file:
+````javascript
+modules: [
+ {
+ module: 'currentweather',
+ position: 'top_right', // This can be any of the regions.
+ // Best results in left or right regions.
+ config: {
+ // See 'Configuration options' for more information.
+ location: 'Amsterdam,Netherlands',
+ appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key.
+ }
+ }
+]
+````
+
+## Configuration options
+
+The following properties can be configured:
+
+
+Option | +Description | +
---|---|
location |
+ The location used for weather information. + Example: Amsterdam,Netherlands
+ Default value: New York
+ |
+
appid |
+ The OpenWeatherMap API key, which can be obtained by creating an OpenWeatherMap account. + This value is REQUIRED + |
+
units |
+ What units to use? + Possible values: default = Kelvin, metric = Celsius, imperial =Fahrenheit
+ Default value: metric
+ |
+
updateInterval |
+ How often does the content needs to be fetched? (Milliseconds) + Possible values: 1000 - 86400000
+ Default value: 300000 (10 minutes)
+ |
+
animationSpeed |
+ Speed of the update animation. (Milliseconds) + Possible values: 0 - 5000
+ Default value: 2000 (2 seconds)
+ |
+
timeFormat |
+ Use 12 or 24 hour format. + Possible values: 12 or 24
+ Default value: uses value of config.timeFormat + |
+
lang |
+ The language of the days. + Possible values: en , nl , ru , etc ...
+ Default value: uses value of config.language + |
+
initialLoadDelay |
+ The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds) + Possible values: 1000 - 5000
+ Default value: 0
+ |
+
retryDelay |
+ The delay before retrying after a request failure. (Milliseconds) + Possible values: 1000 - 60000
+ Default value: 2500
+ |
+
apiVersion |
+ The OpenWeatherMap API version to use. + Default value: 2.5
+ |
+
apiBase |
+ The OpenWeatherMap base URL. + Default value: 'http://api.openweathermap.org/data/'
+ |
+
weatherEndpoint |
+ The OpenWeatherMap API endPoint. + Default value: 'weather'
+ |
+
iconTable |
+ The conversion table to convert the weather conditions to weather-icons. + Default value: iconTable: {
+ '01d':'wi-day-sunny',
+ '02d':'wi-day-cloudy',
+ '03d':'wi-cloudy',
+ '04d':'wi-cloudy-windy',
+ '09d':'wi-showers',
+ '10d':'wi-rain',
+ '11d':'wi-thunderstorm',
+ '13d':'wi-snow',
+ '50d':'wi-fog',
+ '01n':'wi-night-clear',
+ '02n':'wi-night-cloudy',
+ '03n':'wi-night-cloudy',
+ '04n':'wi-night-cloudy',
+ '09n':'wi-night-showers',
+ '10n':'wi-night-rain',
+ '11n':'wi-night-thunderstorm',
+ '13n':'wi-night-snow',
+ '50n':'wi-night-alt-cloudy-windy'
+ }
+ |
+
Option | +Description | +
---|---|
text |
+ The text to display. + Example: 'Hello world!'
+ Default value: 'Hello world!'
+ |
+
classes |
+ Classes to apply to the text. + Example: 'xsmall bold'
+ Default value: 'normal medium'
+ |
+
Option | +Description | +
---|---|
feedUrl |
+ The url of the feed used for the headlines. + Default value: 'http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml'
+ |
+
showPublishDate |
+ Display the publish date of an headline. + Default value: true
+ Default value: true or false
+ |
+
reloadInterval |
+ How often does the content needs to be fetched? (Milliseconds) + Possible values: 1000 - 86400000
+ Default value: 300000 (5 minutes)
+ |
+
updateInterval |
+ How often do you want to display a new headline? (Milliseconds) + Possible values: 1000 - 60000
+ Default value: 7500 (7.5 seconds)
+ |
+
animationSpeed |
+ Speed of the update animation. (Milliseconds) + Possible values: 0 - 5000
+ Default value: 2000 (2.5 seconds)
+ |
+
Option | +Description | +
---|---|
location |
+ The location used for weather information. + Example: Amsterdam,Netherlands
+ Default value: New York
+ |
+
appid |
+ The OpenWeatherMap API key, which can be obtained by creating an OpenWeatherMap account. + This value is REQUIRED + |
+
units |
+ What units to use? + Possible values: default = Kelvin, metric = Celsius, imperial =Fahrenheit
+ Default value: metric
+ |
+
updateInterval |
+ How often does the content needs to be fetched? (Milliseconds) + Possible values: 1000 - 86400000
+ Default value: 300000 (10 minutes)
+ |
+
animationSpeed |
+ Speed of the update animation. (Milliseconds) + Possible values: 0 - 5000
+ Default value: 2000 (2 seconds)
+ |
+
lang |
+ The language of the days. + Possible values: en , nl , ru , etc ...
+ Default value: uses value of config.language + |
+
fade |
+ Fade the future events to black. (Gradient) + Possible values: true or false
+ Default value: true
+ |
+
fadePoint |
+ Where to start fade? + Possible values: 0 (top of the list) - 1 (bottom of list)
+ Default value: 0.25
+ |
+
initialLoadDelay |
+ The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds) + Possible values: 1000 - 5000
+ Default value: 0
+ |
+
retryDelay |
+ The delay before retrying after a request failure. (Milliseconds) + Possible values: 1000 - 60000
+ Default value: 2500
+ |
+
apiVersion |
+ The OpenWeatherMap API version to use. + Default value: 2.5
+ |
+
apiBase |
+ The OpenWeatherMap base URL. + Default value: 'http://api.openweathermap.org/data/'
+ |
+
weatherEndpoint |
+ The OpenWeatherMap API endPoint. + Default value: 'forecast/daily'
+ |
+
iconTable |
+ The conversion table to convert the weather conditions to weather-icons. + Default value: iconTable: {
+ '01d':'wi-day-sunny',
+ '02d':'wi-day-cloudy',
+ '03d':'wi-cloudy',
+ '04d':'wi-cloudy-windy',
+ '09d':'wi-showers',
+ '10d':'wi-rain',
+ '11d':'wi-thunderstorm',
+ '13d':'wi-snow',
+ '50d':'wi-fog',
+ '01n':'wi-night-clear',
+ '02n':'wi-night-cloudy',
+ '03n':'wi-night-cloudy',
+ '04n':'wi-night-cloudy',
+ '09n':'wi-night-showers',
+ '10n':'wi-night-rain',
+ '11n':'wi-night-thunderstorm',
+ '13n':'wi-night-snow',
+ '50n':'wi-night-alt-cloudy-windy'
+ }
+ |
+