• 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. flashnatic
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.
F
Offline
  • Profile
  • Following 0
  • Followers 0
  • Topics 1
  • Posts 2
  • Groups 0

flashnatic

@flashnatic

0
Reputation
318
Profile views
2
Posts
0
Followers
0
Following
Joined May 24, 2016, 5:22 PM
Last Online Jul 13, 2018, 4:10 PM

flashnatic Unfollow Follow

Latest posts made by flashnatic

  • RE: MMM-CalendarExt

    Hi :),

    Is it possible to start MMM-CalendarExt hidden and let it show up with this.sendNotification(‘CHANGED_PROFILE’, {to:‘daddy’}) or something like that?`
    Background ist that I want to use Buttons at my Mirror to hide all other modules and show CalendarExt in fullscreen (MMM-Toggle).
    Problem is that Calendar do not refresh in hidden mode.

    my config:

    {
    			module: 'MMM-CalendarExt',
    			position: "top_left", //anywhere. It is not related to real position of view
    			config: {
    			  system: {
    				show: ["weeks"], //you can select views which you want to show.
    				locale: 'de',
    				showEmptyView: 1,
    				},
    				views: {
    					weeks: {
    						position: "middle_center",
    						showWeeks: 1,
    						weeksTitle: 'Woche',
    						weeksFormat: 'WW',
    						weekdayFormat: 'dd',
    						titleFormat : 'D',
    						overTitleFormat : 'D. MMM',
    						monthTitleFormat: "MMMM",
    						counts: 6,
    						overflowRolling: 1,
    						oneLineEvent: 1,
    					},										
    				},		
    				calendars: [
    					{
    					  name: "Kalender",
    					  styleName:"style5",
    					  url: "https://calendar.google.com...
    					},
    					{
    					  name: "Geburtstage",
    					  styleName:"style15",
    					  symbol:"birthday@em",
    					  url: "https://calendar.google.com...
    					},
    					{
    					  name: "Müllabfuhr",
    					  styleName:"style3",
    					  symbol:"wastebasket@em",
    					  url: "https://calendar.google.com...
    					},		
    					{
    					  name: "WM Kalender",
    					  symbol:"soccer@em",
    					  url: "https://calendar.google.com....
    					},						
    				],
    			}
    		},
    

    Thanks in advance :)

    posted in Productivity
    F
    flashnatic
    Jun 7, 2018, 4:30 PM
  • Slideshow Module with PDF support

    Hey guys,

    I need your help :).

    My module “Pictures” can show any kind of pictures, located on a mounted network drive. On startup node_helper mounts a specific drive, then it scans this folder every two seconds (it could be any other value) and write all filenames in a text file. Pictures imports and filters this file. At the end it generates a slideshow.

    Now I want to implement pdf files in the same way. Actually it works with a little workaround but I’m not happy with that. I have to start MagicMirror and additionally I have to start another browser (unfortunatelly “node serveronly” doesn’t work) on the pi to show pdf files with the integrated plugin.

    For that I have several questions^^:

    • Is there a possibility to show pdf files native in my module?
    • My slideshow is a little laggy on the pi (3B). Any PC with the same network connection shows the same slideshow in browser with perfect performance. Can I improve my slideshow performance anyhow?
    • I have a problem to run “node serveronly” with raspian stretch an the new MagicMirror 2.3.1. I can start but as soon as I connect to the pi by IP:8080 my module generates -75 errors. This won’t happen if MagicMirror runs with “npm start”.

    Best regards
    flash

    node_helper.js

    var request = require('request');
    var NodeHelper = require("node_helper");
    const exec = require('child_process').exec;
    
    module.exports = NodeHelper.create({
    
    	start: function() {
    		this.started = false;
    	},
    
    	socketNotificationReceived: function(notification, payload) {
    		if (notification === "CONFIG" && this.started == false) {	
    			this.config = payload;
    			// mounting network drive
    			exec("/usr/bin/sudo mount -t cifs -o user=" + this.config.user + ",password=" + this.config.password + " " + this.config.source + " /home/pi/MagicMirror/modules/Pictures/images", null);
    			this.started = true;
    		}		
    		if (notification === "GET_PICTURE_DATA" && this.started) {
    			var path = "/home/pi/MagicMirror/modules/Pictures/images/"+ this.config.folder + "/";
    			var opt1 = '-type f ! -path "/home/pi/MagicMirror/modules/Pictures/images/' + this.config.folder + '/.thumb/*" | awk -F"/"'
    			var opt2 = '{print $NF"/" }';
    			var opt3 = '| sort > ~/MagicMirror/modules/Pictures/files.txt';
    			
    			exec("find " + "'" + path + "' " + opt1 + " '" + opt2 + "' " + opt3, null);
    			this.getData(payload);
    		}
    	},
    
    	getData: function(options) {
    		request(options, (error, response, body) => {
    			this.sendSocketNotification("PICTURE_DATA", body); 
    		});
    	}
    });
    

    Pictures.js

    var showPicture = 0;
    var textdata = [];
    var textdataHelp = [];
    var findExt = [];
    
    Module.register("Pictures",{
        defaults: {
            loadingText: 'Lade SlideShow...',
    		pictureInterval: 20 * 1000,			
        },
    	
    	start: function() {
    		Log.info("Starting module: " + this.name);	
    		this.loaded = false;		
    		this.sendSocketNotification('CONFIG', this.config);
    		this.locationSelf = window.location.href;
    		this.file = 'modules/Pictures/files.txt';	
    		setTimeout(this.updateFiles, 2000, this);
    	},
    
    	socketNotificationReceived: function(notification, payload){
    		if(notification === 'PICTURE_DATA' && payload !== null){
    			this.loaded = false;
    			textdataHelp = payload.split("/\n");			
    			if (textdataHelp[0] !== ""){
    				textdata = []; // textdata will not be cleared, if helper has no content
    			}
    			for (i = 0; i  textdata.length - 1) {
    				showPicture = 0;	
    			}	
    			self.updateDom(1000);
    			showPicture++;
    		}
        },	
    	
        getDom: function() {
    		var wrapper = document.createElement("div");	
            var pictureInfo = document.createElement('table');
    
            if (!this.loaded) {
                wrapper.innerHTML = this.config.loadingText;
                return wrapper;
            }
    		var currCount = showPicture + 1;
            var tableHead = document.createElement('tr');
    		tableHead.className = 'normal small';
    		
    		var y = 0
    		findExt = textdata[showPicture].split(".");
    		for (i = 0; i  0){ 
    			//tableHead.innerHTML = '<br />' + currCount + '/' + textdata.length;
    			tableHead.innerHTML = '<br />' + currCount + '/' + textdata.length;
    
    		}else{
    			tableHead.innerHTML = '<img src="' + this.locationSelf + 'modules/Pictures/images/' + this.config.folder + '/' + textdata[showPicture] +'" alt="Vorschau" /><br />' + currCount + '/' + textdata.length;
    
    		}
    		
    		y = 0;
    		findExt = [];
    		
            pictureInfo.appendChild(tableHead);		
    		
    		wrapper.appendChild(pictureInfo);	
            return wrapper;
        },	
    	
    });
    
    posted in Development
    F
    flashnatic
    Apr 30, 2018, 6:49 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