A module for MagicMirror² that displays random animated gifs.
You'll need an API key, which you can get here.
Features:
- supports multiple module instances
- supports multiple mirror instances, controlled by a single server
Just navigate to the modules
directory of your MagicMirror² installation and clone this repository.
git clone https://github.com/shin10/MMM-FF-tenor-gif.git
Example:
{
module: "MMM-FF-tenor-gif",
position: "bottom",
hiddenOnStartup: true,
header: "Tenor",
config:{
baseURL: "https://g.tenor.com/v1/random",
searchParams: {
key: "$TENOR_API_KEY",
q: "excited",
contentfilter: "high",
media_filter: "minimal",
limit: 1
},
updateOnSuspension: null,
updateInterval: 1 * 60 * 60 * 1000,
imageMaxWidth: null,
imageMaxHeight: null,
animationSpeed: 1000,
events: {
GIF_RANDOM: "GIF_RANDOM",
ARTICLE_RANDOM: "GIF_RANDOM"
}
},
}
Option | Type | Default | Description |
---|---|---|---|
header |
string |
"Tenor" |
The header text, false to display nothing or null to show the description of the gif only. |
baseURL |
string |
"https://g.tenor.com/v1/random" |
The API endpoint. |
searchParams |
object |
(See below) | URLSearchParam object, containing the API key, etc. |
updateInterval |
int |
3600000 (1 hour) |
The duration of the update interval in ms or null . |
updateOnSuspension |
bool |
null |
When to update the image. null , false or true . Further explanations below. |
imageMaxWidth |
string |
null |
Maximum width of the comic strip in any valid css unit like px , % , vw , vmin ... |
imageMaxHeight |
string |
null |
Maximum height of the comic strip in any valid css unit like px , % , vh , vmin ... |
animationSpeed |
string |
1000 |
The duration of the page transition. |
events |
object |
A filter and list of event constants to remap if necessary. | |
events.sender |
string /array |
undefined |
Filter events to those dispatched by given module ids. |
Option | Type | Default | Description |
---|---|---|---|
key |
string |
undefined |
Enter your API key here. |
q |
string |
"excited" |
Search query |
locale |
string |
undefined |
The default value is en_US . |
contentfilter |
string |
"high" |
off , low , medium or high |
media_filter |
string |
"minimal" |
basic or minimal |
ar_range |
string |
undefined |
all , wide or standard |
limit |
int |
1 | Maximum number of results. |
See the API documentation for further information.
These two parameters work together. The updateInterval
is used to set the minimal amount of time the displayed item has to exist, before it will be replaced by the next. When this actually will take place depends on the value of updateOnSuspension
.
If updateOnSuspension
is set to true
the item will wait till the interval timer fired and the module goes to the background. If set to false
the updateInterval
has to elapse while the item is in background and will replace the item when the module is shown again.
If updateOnSuspension
is set to null
the content will be replaced whenever the timer is done; visible or not.
If updateInterval
is set to null
the item won't be updated by the module. Instead you'll have to dispatch one of the events listed above.
The following events are supported:
- GIF_RANDOM
For ease of use they can be remapped in the events
object to custom strings. Refer to the example config above.
Events will be ignored if the module is currently hidden.