Skip to content

A MagicMirror² module for playing music from folder.

License

Notifications You must be signed in to change notification settings

x3mEr/MMM-MP3Player

 
 

Repository files navigation

MMM-MP3Player

About

A MagicMirror² module for playing music from folder.
This is the version of the MMM-MP3Player module remade to my needs.
Starting screen:
picture
If no album cover found:
picture
Album cover retrieved from ID3-Tags:
picture

  • supports .mp3, .flac (surprisingly for me, it can be played as 'audio/mpeg' object as well) and .wav music formats;
  • reads ID3 metadata (artist and song title) - if no data, the filename is displayed;
  • displays album cover. Player tries to retrieve the image from ID3-Tags, otherwise it searches file cover.jpg in the playing music file directory.
  • autoplay, random order, loop playlist capability;
  • current settings of 'autoPlay' and 'random' options are displayed while loading the module;
  • control through notifications (play, stop, next track, prev track, turn random on/off);
  • module only supports rock music.

Dependencies

Beside the core modules, this module uses one dependency:

Module URL
node-id3 https://www.npmjs.com/package/node-id3

Installation

  • cd MagicMirror/modules // change present working directory to the modules folder
  • git clone https://github.com/x3mEr/MMM-MP3Player.git // clone the module from github
  • cd MMM-MP3Player // navigate to the MMM-MP3Player directory
  • npm install // install dependencies
  • Add the following configuration to the modules array in the MagicMirror/config/config.js file:
    modules: [
        {
			module: "MMM-MP3Player",
			position: "top_left",
			config: {
				musicPath: "modules/MMM-MP3Player/music/", 
				autoPlay: true,
				random: false,
				loopList: true,
			}
        }
    ]

Do not forget to add extra parameters for other modules (i.e. classes: "default everyone", for face recognition module)

  • Finally, add some cool music to the musicPath folder and enjoy!

Update

  • cd MagicMirror/modules/MMM-MP3Player // change present working directory to the modules folder
  • if you have done local edits, backup the files you have edited and run git reset --hard
  • git pull // to pull the changes from the repository

Configuration

Option Description
musicPath The path of the folder with .mp3 files.
Default: 'modules/MMM-MP3Player/music/'
Type: string
autoPlay Should music be played after loading the module?
Default: true
Type: boolean
random Should music be shuffled?
Default: false
Type: boolean
Note: Every next track is randomly selected. So after the playlist ends the order of tracks will be another.
loopList Loop the tracklist?
Default: true
Type: boolean
  • In case of random: true, previous track is not a track, played previously, it's a previous file in musicPath folder.

Control with notifications

The playback can be controlled from another module (e.g. voicecontrol) with notifications. To play track, pause playback, play next or previous track, turn random on/off, following notifications should be send, respectively:

this.sendNotification('PLAY_MUSIC', 'some_info');
this.sendNotification('STOP_MUSIC', 'some_info');
this.sendNotification('NEXT_TRACK', 'some_info');
this.sendNotification('PREVIOUS_TRACK', 'some_info');
this.sendNotification('RANDOM_ON', 'some_info');
this.sendNotification('RANDOM_OFF', 'some_info');

About

A MagicMirror² module for playing music from folder.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 77.0%
  • CSS 23.0%