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

    Posts

    Recent Best Controversial
    • RE: Fifa World Cup overview

      @conkhidot
      here is the code of my modified node_helper.js

      /* global Module */
      
      /* Magic Mirror
       * Module: MMM-SoccerLiveScore
       *
       * By Luke Scheffler https://github.com/LukeSkywalker92
       * MIT Licensed.
       */
      
      var NodeHelper = require('node_helper');
      var request = require('request');
      
      module.exports = NodeHelper.create({
          start: function () {
              console.log('MMM-SoccerLiveScore helper started...')
          },
      
          getTeamLogo: function (teamId) {
              var self = this;
              var options = {
                  method: 'GET',
                  url: 'https://www.ta4-images.de/ta/images/teams/' + teamId + '/64',
                  headers: {
                      'Host': 'www.ta4-images.de',
                      'Accept': '*/*',
                      'Accept-Language': 'de-de',
                      'Connection': 'keep-alive',
                      'Accept-Encoding': 'gzip, deflate',
                      'User-Agent': 'TorAlarm/20161206 CFNetwork/808.1.4 Darwin/16.1.0'
                  },
                  encoding: null
              };
      
      
              request(options, function (error, response, body) {
                  if (error) throw new Error(error);
                  var image = new Buffer(body).toString('base64');
                  self.sendSocketNotification('LOGO', {
                      teamId: teamId,
                      image: image
                  });
      
              });
      
      
          },
      
          getLeagueIds: function (leagues, showLogos) {
              var self = this;
              var options = {
                  method: 'POST',
                  //url: 'https://www.ta4-data.de/ta/data/competitions',
                  url: 'https://www.ta4-data.de/em4/data/competitions',
                  headers: {
                      'Host': 'ta4-data.de',
                      'Content-Type': 'application/x-www-form-urlencoded',
                      'Connection': 'keep-alive',
                      'Accept': '*/*',
                      'User-Agent': 'TorAlarm/20161202 CFNetwork/808.1.4 Darwin/16.1.0',
                      'Accept-Language': 'de-de',
                      'Accept-Encoding': 'gzip',
                      'Content-Length': '49',
                  },
                  body: '{"lng":"de-DE","device_type":0,"decode":"decode"}',
                  form: false
              };
      
              request(options, function (error, response, body) {
                  var competitions = JSON.parse(body).competitions;
                  var leagueIds = [];
                  for (var i = 0; i < leagues.length; i++) {
                      for (var j = 0; j < competitions.length; j++) {
                          if (competitions[j].id == leagues[i]) {
                              if (showLogos) {
                                  if (competitions[j].has_table) {
                                      self.getTeams(competitions[j].id);
                                      self.getTable(competitions[j].id);
                                  } else {
                                      self.getLogosFromScores(competitions[j].id);
                                  }
                              }
                              leagueIds.push(competitions[j].id)
                              self.sendSocketNotification('LEAGUES', {
                                  name: competitions[j].name,
                                  id: competitions[j].id
                              });
                          }
                      }
                  }
                  for (var i = 0; i < leagueIds.length; i++) {
                      self.getScores(leagueIds[i]);
                  }
              });
          },
      
          getTeams: function (leagueId) {
              var self = this;
              var options = {
                  method: 'POST',
                  //url: 'https://www.ta4-data.de/ta/data/competitions/' + leagueId.toString() + '/table',
                  url: 'https://www.ta4-data.de/em4/data/competitions/' + leagueId.toString() + '/table',
                  headers: {
                      'Host': 'ta4-data.de',
                      'Content-Type': 'application/x-www-form-urlencoded',
                      'Connection': 'keep-alive',
                      'Accept': '*/*',
                      'User-Agent': 'TorAlarm/20161202 CFNetwork/808.1.4 Darwin/16.1.0',
                      'Accept-Language': 'de-de',
                      'Accept-Encoding': 'gzip',
                      'Content-Length': '49',
                  },
                  body: '{"lng":"de-DE","device_type":0,"decode":"decode"}',
                  form: false
              };
              request(options, function (error, response, body) {
                  var teamIds = [];
                  var data = JSON.parse(body);
                  for (var i = 0; i < data.data.length; i++) {
      	    if (data.data[i].type !== 'table') { continue; }
                      for (var j = 0; j < data.data[i].table.length; j++) {
                          teamIds.push(data.data[i].table[j].team_id);
                      }
                  }
                  self.getLogos(teamIds);
              });
          },
      
          getTable: function (leagueId) {
              var self = this;
              var options = {
                  method: 'POST',
                  //url: 'https://www.ta4-data.de/ta/data/competitions/' + leagueId.toString() + '/table',
                  url: 'https://www.ta4-data.de/em4/data/competitions/' + leagueId.toString() + '/table',
                  headers: {
                      'Host': 'ta4-data.de',
                      'Content-Type': 'application/x-www-form-urlencoded',
                      'Connection': 'keep-alive',
                      'Accept': '*/*',
                      'User-Agent': 'TorAlarm/20161202 CFNetwork/808.1.4 Darwin/16.1.0',
                      'Accept-Language': 'de-de',
                      'Accept-Encoding': 'gzip',
                      'Content-Length': '49',
                  },
                  body: '{"lng":"de-DE","device_type":0,"decode":"decode"}',
                  form: false
              };
              request(options, function (error, response, body) {
                  var teamIds = [];
                  var data = JSON.parse(body);
                  var refreshTime = data.refresh_time*1000;
                  data = data.data;
      	    for(var i = 0; i < data.length; i++) {
      		    if (data[i].type === 'table') {
      			self.sendSocketNotification('TABLE', {
      			    leagueId: leagueId,
      			    table: data[i].table
      			});
      			setTimeout(function () {
      			    self.getTable(leagueId);
      			}, refreshTime);
      		        return;
      		    }
      	    }
              });
          },
      
          getLogos: function (teamIds) {
              var self = this;
              var logos = [];
              for (var i = 0; i < teamIds.length; i++) {
                  self.getTeamLogo(teamIds[i]);
              }
          },
      
          getScores: function (leagueId) {
              var self = this;
              var options = {
                  method: 'POST',
                  //url: 'https://www.ta4-data.de/ta/data/competitions/' + leagueId.toString() + '/matches/round/0',
                  url: 'https://www.ta4-data.de/em4/data/competitions/' + leagueId.toString() + '/matches/round/0',
                  headers: {
                      'Host': 'ta4-data.de',
                      'Content-Type': 'application/x-www-form-urlencoded',
                      'Connection': 'keep-alive',
                      'Accept': '*/*',
                      'User-Agent': 'TorAlarm/20161202 CFNetwork/808.1.4 Darwin/16.1.0',
                      'Accept-Language': 'de-de',
                      'Accept-Encoding': 'gzip',
                      'Content-Length': '49',
                  },
                  body: '{"lng":"de-DE","device_type":0,"decode":"decode"}',
                  form: false
              }
      
              request(options, function (error, response, body) {
                  var data = JSON.parse(body);
                  var refreshTime = data.refresh_time * 1000;
                  var standings = data.data;
                  self.sendSocketNotification('STANDINGS', {
                      leagueId: leagueId,
                      standings: standings
                  });
                  setTimeout(function () {
                      self.getScores(leagueId);
                  }, refreshTime);
              });
          },
      
          getLogosFromScores: function (leagueId) {
              var self = this;
              var options = {
                  method: 'POST',
                  //url: 'https://www.ta4-data.de/ta/data/competitions/' + leagueId.toString() + '/matches/round/0',
                  url: 'https://www.ta4-data.de/em4/data/competitions/' + leagueId.toString() + '/matches/round/0',
                  headers: {
                      'Host': 'ta4-data.de',
                      'Content-Type': 'application/x-www-form-urlencoded',
                      'Connection': 'keep-alive',
                      'Accept': '*/*',
                      'User-Agent': 'TorAlarm/20161202 CFNetwork/808.1.4 Darwin/16.1.0',
                      'Accept-Language': 'de-de',
                      'Accept-Encoding': 'gzip',
                      'Content-Length': '49',
                  },
                  body: '{"lng":"de-DE","device_type":0,"decode":"decode"}',
                  form: false
              }
      
              request(options, function (error, response, body) {
                  var data = JSON.parse(body);
                  var standings = data.data;
                  for (var i = 0; i < standings.length; i++) {
                      if (standings[i].matches !== undefined) {
                          for (var j = 0; j < standings[i].matches.length; j++) {
                              self.getTeamLogo(standings[i].matches[j].team1_id);
                              self.getTeamLogo(standings[i].matches[j].team2_id);
                          }
                      }
                  }
              });
          },
      
          socketNotificationReceived: function (notification, payload) {
              if (notification === 'CONFIG') {
                  this.getLeagueIds(payload.leagues, payload.showLogos);
              }
          }
      
      });
      
      

      AxLED

      posted in Requests
      A
      AxLed
    • RE: Fifa World Cup overview

      Hi to all,

      i found a different solution: https://github.com/LukeSkywalker92/MMM-SoccerLiveScore with some modifications.

      node_helper.js:
      change the hyperlinks (or only the …/ta/… part of the links in node_helper.js to …/em4/…)
      Example, Line 52:
      Change

      url: 'https://www.ta4-data.de/ta/data/competitions',
      

      to

      url: 'https://www.ta4-data.de/em4/data/competitions',
      

      Do the replacements on the 5 hyperlinks in node_helper, and here you go.

      config.js
      The league id for WM ist 4000

      {
      			module: "MMM-SoccerLiveScore",
      			position: "top_left",
      			header: "Live-Scores",
      			config: {
      				leagues: [4000],
              			showNames: true,
              			showLogos: true,
              			displayTime: 60 * 1000,
              			showTables: true
      				}
      		},
      

      Pictures:
      0_1529014299763_wm2018_1.JPG
      0_1529014318658_wm2018_2.JPG

      AxLED

      posted in Requests
      A
      AxLed
    • RE: MMM-Carousel change page when Sonos starts playing?

      Hi Joela85,

      how do you start the sonos module? Maybe on this call, there is a way to hook something additional up, for changing pages.
      I use MMM-Pages an this can be switched by the MM Notification System.

      AxLED

      posted in Troubleshooting
      A
      AxLed
    • RE: MMM-WeatherChart

      Hi,

      found a solution myself, there is a fork of this module: https://github.com/szech/mmm-weatherchart

      Installation:
      cd ~/MagicMirror/modules
      git clone https://github.com/szech/mmm-weatherchart.git
      cd mmm-weatherchart
      npm install

      Greets

      AxLED

      posted in Utilities
      A
      AxLed
    • RE: MMM-WeatherChart

      Hi,

      i wanted to try the module today, but i dont work i get some error “del missing” or similar.
      Could it be that there is the file package.json missing on the github link, as there are some depencies in node_helper.js

      var http = require('http');
      var fs = require('fs');
      var del = require('del');
      var request = require('request'); 
      var NodeHelper = require("node_helper");
      

      Greets AxLED

      posted in Utilities
      A
      AxLed
    • RE: Can client only version be displayed on tablet?

      Hi Stephan, if you run MM on a Pi you can connect to the Pi wir any device with Browser within the same network (like old tablets).
      http://ipofmm:8080

      AxLED

      posted in General Discussion
      A
      AxLed
    • RE: MMM-Navigate, Navigation inside MagicMirror with Rotary Encoder

      Hi to all,

      version 1.1 is online, details see first topic of this thread.

      AxLED

      posted in System
      A
      AxLed
    • RE: MMM-Carousel switching slides using MMM-Buttons

      Hi,

      you have to add/modify some code in MMM-Carousel.js

      The relevant part start at line 50 (notification received)

      notificationReceived: function (notification, payload, sender) {
                  var position, positions = ['top_bar', 'bottom_bar', 'top_left', 'bottom_left', 'top_center', 'bottom_center', 'top_right', 'bottom_right', 'upper_third', 'middle_center', 'lower_third'];
                  if (notification === 'MODULE_DOM_CREATED') {
                      // Initially, all modules are hidden except the first and any ignored modules
                      // We start by getting a list of all of the modules in the transition cycle
                      if ((this.config.mode === 'global') || (this.config.mode === 'slides')) {
                          this.setUpTransitionTimers(null);
                      } else {
                          for (position = 0; position < positions.length; position += 1) {
                              if (this.config[positions[position]].enabled === true) {
                                  this.setUpTransitionTimers(positions[position]);
                              }
                          }
                      }
                  }
      
                  // Handle KEYPRESS events from the MMM-KeyBindings Module
                  if (notification === "KEYPRESS_MODE_CHANGED") {
                      this.currentKeyPressMode = payload;
                  }
                  // if (notification === "KEYPRESS") {
                  //     console.log(payload);
                  // }
                  if (notification === "KEYPRESS" && (this.currentKeyPressMode === this.config.keyBindingsMode) && 
                          payload.KeyName in this.reverseKeyMap && payload.Sender === this.instance) {
                      if (payload.KeyName === this.config.keyBindings.NextSlide) {
                          this.manualTransition(undefined, 1);
                          this.restartTimer();
                      }
                      else if (payload.KeyName === this.config.keyBindings.PrevSlide) {
                          this.manualTransition(undefined, -1);
                          this.restartTimer();
                      }
                      else if (this.reverseKeyMap[payload.KeyName].startsWith("Slide")) {
                          var goToSlide = this.reverseKeyMap[payload.KeyName].match(/Slide([0-9]+)/i);
                          console.log((typeof goToSlide[1]) + " " + goToSlide[1]);
                          if (typeof parseInt(goToSlide[1]) === "number") { 
                              this.manualTransition(parseInt(goToSlide[1]));
                              this.restartTimer();                        
                          }
                      }
                  }
      },
      

      You can add your “own” Page_increment / Page_decrement parts here.

      AxLED

      posted in Troubleshooting
      A
      AxLed
    • RE: Run MM on Ubuntu 16 VM

      @Hriereb
      Did you install “npm” and “node” as this sometimes isnt installed at ubuntu by default?

      AxLED

      posted in General Discussion
      A
      AxLed
    • RE: Ubuntu 18.04 install issues

      @jtmoore81
      Did you install “npm” and “node” as this sometimes isnt installed at ubuntu by default?

      AxLED

      posted in Troubleshooting
      A
      AxLed
    • 1 / 1