• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
MagicMirror Forum
  • Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
  1. Home
  2. DrCastor
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
D
Offline
  • Profile
  • Following 0
  • Followers 0
  • Topics 0
  • Posts 5
  • Groups 0

DrCastor

@DrCastor

0
Reputation
429
Profile views
5
Posts
0
Followers
0
Following
Joined Oct 16, 2017, 4:08 PM
Last Online Nov 13, 2017, 4:58 PM

DrCastor Unfollow Follow

Latest posts made by DrCastor

  • RE: Simple Music Player Module

    no, I’m a noob in this. You should take a look at the files of MMM-TouchPlayerBasic, and try to enderstand how the volume is managed. Good luck!

    posted in Entertainment
    D
    DrCastor
    Oct 18, 2017, 7:14 AM
  • RE: Simple Music Player Module

    Happy to have helped you :). It is sad that just for a problem of syntax, the source file was never edited :$

    posted in Entertainment
    D
    DrCastor
    Oct 17, 2017, 3:01 PM
  • RE: Simple Music Player Module

    It seems that I don’t have enough priviledges for uploading a file directly in this reply, and I don’t really want to provide you a link to some uploading site, since I don’t know if it is allowed in the rules of this site. I’ll try to find a way.

    Since then, just try what I told you. You juste have to cut and paste what I wrote. I’m sure you can do it, be confident in yourself ;)

    posted in Entertainment
    D
    DrCastor
    Oct 16, 2017, 6:42 PM
  • RE: Simple Music Player Module

    Ok, found bad speakers, but at least, they allow me to test it. It works :). I’m a real noob, so some useless things may still be there. But at least, it will do the trick

    Go to the node_helper.js file, and change it this way:

    var Class = require("../../js/class.js");
    var express = require("express");
    var path = require("path");
    
    
    module.exports = NodeHelper.create({
    
    	init: function() {
    		console.log("Initializing mm-music-player module helper ...");
    	},
    
    	start: function() {
    		this.expressApp.get('/music', function (req, res) {
    			var fs = require('fs');
    			var path = require('path');
    
    			var files = [];
    
    			fs.readdir('modules/mm-music-player/music', (err, data) => {
    				for(i = 0; i < data.length; i++){
    					if(path.extname(data[i]) == ".mp3"){
    						files.push(data[i]);
    					}
    				}
    				
    				res.send(files);
    			});
    		});
    	},
    
    
    
    	/* setExpressApp(app)
    	 * Sets the express app object for this module.
    	 * This allows you to host files from the created webserver.
    	 *
    	 * argument app Express app - The Express app object.
    	 */
    	setExpressApp: function(app) {
    		this.expressApp = app;
    
    		var publicPath = this.path + "/public";
    		app.use("/" + this.name, express.static(publicPath));
    	},
    
    });
    

    If luck is by your side, it will work ;)

    posted in Entertainment
    D
    DrCastor
    Oct 16, 2017, 4:40 PM
  • RE: Simple Music Player Module

    Hi aro28,

    I had the same problem, so I decided to take a look at why this module couldn’t be loaded.

    The issues is in the Node_Helper.js given, which is mistaken. The structure is wrong. It looks like a quick adaptation of a ctrl+C/ctrl+V made from index.js, found in the node_helper folder (MM core folders).

    I’m actually tweeking it a bit. I’ll give you news when i get it worked nicely.
    (In fact, it seems i can now load it, but since my speaker are broke, i cant be sure it reads files… I’ll change them tomorrow)

    posted in Entertainment
    D
    DrCastor
    Oct 16, 2017, 4:12 PM
Enjoying MagicMirror? Please consider a donation!
MagicMirror created by Michael Teeuw.
Forum managed by Sam, technical setup by Karsten.
This forum is using NodeBB as its core | Contributors
Contact | Privacy Policy