MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Fifa World Cup overview

    Scheduled Pinned Locked Moved Unsolved Requests
    soccerworld cupsport
    25 Posts 11 Posters 15.8k Views 10 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B Offline
      barnosch
      last edited by

      looks nice.

      If i would be interested in this football crap, i would definetely install it on ther mirror ;)

      1 Reply Last reply Reply Quote 0
      • C Offline
        conkhidot @AxLed
        last edited by

        @axled It doesn’t work for me :P

        0|mm | Whoops! There was an uncaught exception…
        0|mm | SyntaxError: Unexpected token p in JSON at position 4
        0|mm | at JSON.parse (:null:null)
        0|mm | at Request._callback (/home/pi/Magicmirror/modules/MMM-SoccerLiveScore/node_helper.js:115:29)
        0|mm | at Request.self.callback (/home/pi/Magicmirror/modules/node_modules/request/request.js:186:22)
        0|mm | at emitTwo (events.js:106:13)
        0|mm | at Request.emit (events.js:194:7)
        0|mm | at Request. (/home/pi/Magicmirror/modules/node_modules/request/request.js:1163:10)
        0|mm | at emitOne (events.js:96:13)
        0|mm | at Request.emit (events.js:191:7)
        0|mm | at IncomingMessage. (/home/pi/Magicmirror/modules/node_modules/request/request.js:1085:12)
        0|mm | at Object.onceWrapper (events.js:293:19)
        0|mm | at emitNone (events.js:91:20)
        0|mm | at IncomingMessage.emit (events.js:188:7)
        0|mm | at endReadableNT (_stream_readable.js:975:12)
        0|mm | at _combinedTickCallback (internal/process/next_tick.js:80:11)
        0|mm | at process._tickCallback (internal/process/next_tick.js:104:9)

        1 Reply Last reply Reply Quote 0
        • A Offline
          AxLed Module Developer
          last edited by

          @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

          1 Reply Last reply Reply Quote 0
          • P Offline
            PaulB
            last edited by

            Hey guys,

            how do you enter the node_helper.js?

            When I enter the code “sudo nano /home/pi/MagicMirror/MMM-SoccerLiveScore/node_helper.js” it will create a new file. So therefore the node_helper.js has to be stored in a folder.
            Does anyone know which folder this is or how to find the file?

            Kind regards,
            Paul

            1 Reply Last reply Reply Quote 0
            • C Offline
              cdelaorden
              last edited by cdelaorden

              Im using MagicMirror-FootballLeagues

              It works by just adding the league 467

              EDIT:

              If someone is using it without luck be sure to use an api key and place showUnavailable as true

              1 Reply Last reply Reply Quote 0
              • A Offline
                AxLed Module Developer
                last edited by

                @paulb said in Fifa World Cup overview:

                “sudo nano /home/pi/MagicMirror/MMM-SoccerLiveScore/node_helper.js”

                Hi Paul,
                there is a folder missing in your command, there must be a /modules/ between MagicMirror and MMM-Soccer…
                “sudo nano /home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js”

                AxLED

                1 Reply Last reply Reply Quote 0
                • R Offline
                  robert @conkhidot
                  last edited by

                  @conkhidot

                  I tried your code but only get loading… window…

                  Robert

                  1 Reply Last reply Reply Quote 0
                  • P Offline
                    PaulB
                    last edited by

                    @AxLed , thank for providing your code.

                    Unfortunately the module is shown while runnin MM but no data is loaded. I have adjusted the config,js as well as node_helper.js as you said. Do you have an idea what could ve been wrong?

                    Kind regards,
                    Paul

                    1 Reply Last reply Reply Quote 0
                    • R Offline
                      rak
                      last edited by

                      I created a fork and a pull request with all necessary changes.

                      1 Reply Last reply Reply Quote 0
                      • A Offline
                        AxLed Module Developer
                        last edited by

                        @PaulB

                        Hi,

                        what are the logs showing? (npm start dev [on Raspberry]) or (F12 [on broser like Firefox]).

                        AxLED

                        P 1 Reply Last reply Reply Quote 0
                        • A Offline
                          AxLed Module Developer
                          last edited by

                          @rak

                          I think your fork is only working for league 4000 (Worldcup/WM 2018), as the other leagues have still use the old links. I didnt have the time to do a fork for all leagues.
                          I guess you have to some if then else statements, if league 4000 ist used.

                          AxLED

                          R 1 Reply Last reply Reply Quote 0
                          • R Offline
                            robert @AxLed
                            last edited by

                            @axled

                            Tried it with “4000” for World cup but not showing scores, only shows other league scores.

                            1 Reply Last reply Reply Quote 0
                            • A Offline
                              AxLed Module Developer
                              last edited by

                              Hi to all,

                              today i tried MagicMirror-FootballLeagues (which is a modified fork of MMM-SoccerLiveScore) with League ID 467 an the following config:

                              {
                                          module: 'MagicMirror-FootballLeagues',
                                          position: 'top_left',
                                          header: 'Live-Scores',
                                          config: {
                                              leagues: [467],
                                                  showNames: true,
                                                  displayTime: 60 * 1000,
                                                  showTables: true,
                                              showLogos: true,
                                              apiKey: 'secret',
                                              showUnavailable: true
                                          }
                              
                              

                              Works perfect. In my opinion the fastes way to get Fifa World Cup on MM.

                              AxLED

                              R 2 Replies Last reply Reply Quote 0
                              • R Offline
                                robert @AxLed
                                last edited by

                                Indeed does work with this module.

                                You need to obtain an API key for this to work. Link in the description of the module.

                                Cheers!

                                @axled

                                1 Reply Last reply Reply Quote 0
                                • R Offline
                                  robert @AxLed
                                  last edited by

                                  Just a heads up the table needs pagination list way to long for smaller displays.

                                  @axled

                                  1 Reply Last reply Reply Quote 0
                                  • P Offline
                                    PaulB @AxLed
                                    last edited by

                                    @axled

                                    I just get npm ERR! messages. Therefore i assume I am doing something wrong.

                                    Which command, do I have to enter (sorry…for asking but I am a newbie )

                                    Thank you very much in advance! :-)

                                    R 1 Reply Last reply Reply Quote 0
                                    • R Offline
                                      robert @PaulB
                                      last edited by

                                      @paulb
                                      Just follow the directions in the previous post you’ll get it. It took me a few times to get it right…

                                      Cheers!

                                      1 Reply Last reply Reply Quote 0
                                      • V Offline
                                        vinp Module Developer
                                        last edited by

                                        I’ve updated my fork of MMM-MyScoreboard to update scores and game statuses for the World Cup games. Lots of Overtime / Shootouts to handle :) I also added a few other leagues. https://github.com/vincep5/MMM-MyScoreboard/tree/add_more_soccer

                                        1 Reply Last reply Reply Quote 0

                                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                        With your input, this post could be even better 💗

                                        Register Login
                                        • 1
                                        • 2
                                        • 1 / 2
                                        • First post
                                          Last post
                                        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