ianperrin / MMM-YouTubeChannelStats

A MagicMirror Module for displaying statistics for a YouTube channel.
MIT License
2 stars 1 forks source link
magicmirror stats youtube

MagicMirror Module: MMM-YouTubeChannelStats

A MagicMirror Module for displaying statistics about YouTube channels.

Platform License Test Status Code Climate Known Vulnerabilities

Example

Example screenshot

Installation

  1. Stop your MagicMirror and clone the repository into the modules folder

    cd ~/MagicMirror/modules
    git clone https://github.com/ianperrin/MMM-YouTubeChannelStats.git
    cd ~/MagicMirror/modules/MMM-YouTubeChannelStats
  2. Create a Google API key

  3. Add the module to the config file (~/MagicMirror/config/config.js) for your mirror.

    modules: [
     {
       module: "MMM-YouTubeChannelStats",
       position: "top_right",
       config: {
         channelIds: "your_youtube_channel_id,another_youtube_channel_id",
         apiKey: "your_google_api_key"
       }
     }
    ];

    The full list of config options can be found in the configuration options table.

  4. Restart the MagicMirror

    pm2 restart mm

Updating the module

To update the module to the latest version,

  1. Pull the changes from this repository into the module folder:

    cd ~/MagicMirror/modules/MMM-YouTubeChannelStats
    git pull
  2. Restart the mirror

    pm2 restart mm

Configuration options

The following properties can be added to the configuration:

Option Default Description Possible Values
channelIds The YouTube channel id or ids. Note: Multiple channel ids can be entered as a comma separated list (e.g. "id1,id2") or an array of strings (e.g. ["id1", "id2"])..
apiKey The YouTube API key.
stats ["views", "subscribers", "videos"] Optional - Which statistics to display. Note: - The stats can be listed in any order, and only one is required. However, they must be entered as an array of strings i.e. comma separated values within square brackets. views, subscribers, videos
showLabels true Optional - Display labels next to the statistics. true or false
grayscale true Optional - Display channel images in grayscale. true or false
maximumChannels 0 Optional - The maximum number of channels displayed in the module. If 0 (or not defined), all channels will be shown. If maximumChannels is less than the number of configured channelIds, the channels will automatically rotate based on the rotationInterval 0 or a number less than the number of channelIds.
fetchInterval 3600 * 1000 (1 hour) Optional - How often the statistics should be fetched (in milliseconds). 1000 - 86400000
rotationInterval 10 * 1000 (10 seconds) Optional - How often the channels should be rotated if maximumChannels is also set. 1000 - 86400000
animationSpeed 2.5 * 1000 (2.5 seconds) Optional - The speed of the update animation (in milliseconds). 0 - 5000