0m4r / MMM-SoccerLiveScore

Displays Soccer-Live-Scores on MagicMirror
MIT License
8 stars 6 forks source link

Not Working anymore #13

Closed spacecdr closed 1 month ago

spacecdr commented 2 months ago

Hi, there are two days this plugin is not working anymore... am i the only one who notice this behaviour? My environment is docker based... i tried migrating my container elsewhere but the problem still Everything is working but MMM-SoccerLiveScore rest in "Loading..." Let me/us know

Egnos87 commented 2 months ago

Hi, @spacecdr I have the same problem. Below what the MM shows:

[06.09.2024 15:03.23.629] [ERROR] MMM-SoccerLiveScore doPost URL {
  href: 'https://toralarm.com/api/api/competitions',
  origin: 'https://toralarm.com',
  protocol: 'https:',
  username: '',
  password: '',
host: 'toralarm.com',
  hostname: 'toralarm.com',
  port: '',
  pathname: '/api/api/competitions',
  search: '',
  searchParams: URLSearchParams {},
  hash: ''
} {
  method: 'POST',
  gzip: true,
  headers: {
    Host: 'toralarm.com',
    'accept-language': 'en-US,en;q=0.9,it;q=0.8,de-DE;q=0.7,de;q=0.6',
    'content-type': 'application/json;charset=UTF-8'
  },
  body: '{"lng":"it"}'
} Response {
  size: 0,
  timeout: 0,
  [Symbol(Body internals)]: {
    body: Gunzip {
      _writeState: [Uint32Array],
      _readableState: [ReadableState],
      _events: [Object: null prototype],
      _eventsCount: 5,
      _maxListeners: undefined,
      _writableState: [WritableState],
      allowHalfOpen: true,
      bytesWritten: 0,
      _handle: [Zlib],
      _outBuffer: <Buffer 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ... 16334 more bytes>,
      _outOffset: 0,
      _chunkSize: 16384,
      _defaultFlushFlag: 2,
      _finishFlushFlag: 2,
      _defaultFullFlushFlag: 3,
      _info: undefined,
      _maxOutputLength: 1073741823,
      _level: -1,
      _strategy: 0,
      [Symbol(kCapture)]: false,
      [Symbol(kCallback)]: null,
      [Symbol(kError)]: null
    },
    disturbed: false,
    error: null
  },
  [Symbol(Response internals)]: {
    url: 'https://toralarm.com/api/api/competitions',
    status: 500,
    statusText: 'Internal Server Error',
    headers: Headers { [Symbol(map)]: [Object: null prototype] },
    counter: 0
  }
}

@0m4r can you help us?

Thank you very much!

0m4r commented 2 months ago

Hi @spacecdr @Egnos87 I have seen this bug, please allow me some time to look into it and get back.

Well, from a quick check, the APIs it uses to fetch data do not work anymore. I cannot teel if this is permanent or temporary, but as long as the APIs do not provide any data, there is not much I can do to fix this.

spacecdr commented 2 months ago

i know you were retrieving data from toralarm.com, that's what i was looking for... but i didn't find any "exposed API" to fix the problem. It seems they were blocking requests...

spacecdr commented 2 months ago

What about https://www.api-football.com/? (100 requests a day, then 4 any 15 minutes :-) ) It could be good, even if people should create a free plan/token...

0m4r commented 2 months ago

Yeah, looking for an other API endpoint is an alternative, but it will require sone time to implement...

0m4r commented 2 months ago

if you wanna try, I had some spare time to jot down a beta version: https://github.com/0m4r/MMM-SoccerLiveScore/tree/beta

to use it, you should check out from the beta branch:

cd modules/MMM-SoccerLiveScore git checkout beta git fetch -p git pull npm ci

update the config of the module by adding a token key to set to the token you get from https://www.football-data.org/, and update the leagues' array with values from:

Name ID Area Start Date End Date
Campeonato Brasileiro Série A 2013 Brazil 2024-04-13 2024-12-08
Championship 2016 England 2024-08-09 2025-05-03
Premier League 2021 England 2024-08-16 2025-05-25
UEFA Champions League 2001 Europe 2024-09-17 2025-05-31
European Championship 2018 Europe 2024-06-14 2024-07-14
Ligue 1 2015 France 2024-08-18 2025-05-18
Bundesliga 2002 Germany 2024-08-23 2025-05-17
Serie A 2019 Italy 2024-08-18 2025-05-25
Eredivisie 2003 Netherlands 2024-08-09 2025-05-18
Primeira Liga 2017 Portugal 2024-08-11 2025-05-17
Copa Libertadores 2152 South America 2024-02-07 2024-08-23
Primera Division 2014 Spain 2024-08-18 2025-05-25
FIFA World Cup 2000 World 2022-11-20 2022-12-18

restart MM. It, if working, shows you the current matchday results (only). There is nothing more.

@spacecdr @Egnos87

...do not care about the code... it is less than WIP ;)

spacecdr commented 2 months ago

magicmirror | 2024-09-13T12:35:31.602748862Z [13.09.2024 12:35.31.601] [ERROR] WARNING! Could not validate config file. Starting with default configuration. Please correct syntax errors at or above this line: /opt/magic_mirror/modules/MMM-SoccerLiveScore/node_helper.js:103 magicmirror | 2024-09-13T12:35:31.602829559Z ...this.requestOptions?.header, magicmirror | 2024-09-13T12:35:31.602846682Z ^ magicmirror | 2024-09-13T12:35:31.602862574Z magicmirror | 2024-09-13T12:35:31.602877262Z SyntaxError: Unexpected token '.' magicmirror | 2024-09-13T12:35:31.602891419Z at wrapSafe (internal/modules/cjs/loader.js:915:16) magicmirror | 2024-09-13T12:35:31.602905629Z at Module._compile (internal/modules/cjs/loader.js:963:27) magicmirror | 2024-09-13T12:35:31.602920068Z at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10) magicmirror | 2024-09-13T12:35:31.602935013Z at Module.load (internal/modules/cjs/loader.js:863:32) magicmirror | 2024-09-13T12:35:31.602949511Z at Function.Module._load (internal/modules/cjs/loader.js:708:14) magicmirror | 2024-09-13T12:35:31.602962843Z at Module.require (internal/modules/cjs/loader.js:887:19) magicmirror | 2024-09-13T12:35:31.602977407Z at require (internal/modules/cjs/helpers.js:74:18) magicmirror | 2024-09-13T12:35:31.603024221Z at loadModule (/opt/magic_mirror/js/app.js:126:19) magicmirror | 2024-09-13T12:35:31.603040042Z at loadNextModule (/opt/magic_mirror/js/app.js:164:5) magicmirror | 2024-09-13T12:35:31.603054665Z at /opt/magic_mirror/js/app.js:166:6

spacecdr commented 2 months ago

i left my old config quite untouched (changed only league IDs):

                        module: 'MMM-SoccerLiveScore',
                        position: 'top_center',
                        header: 'LiveScore',
                        config: {
                        leagues: [2019, 2021, 2014, 2001],
                        showNames: true,
                        showLogos: true,
                        displayTime: 30 * 1000,
                        showStandings: true,
                        showTables: true,
                        showScorers: false,
                        showDetails: false,
                        language: 'it', // supported values are en, de, it
                        }

and edited node_helper.js setting my token instead of "null"

0m4r commented 2 months ago

update the config of the module by adding a token key to set to the token you get from https://www.football-data.org/, and update the leagues' array with values from:

I think I was not clear, sorry. Please add your token in your module configuration

config: {
  leagues: [2019, 2021, 2014, 2001],
  showNames: true,
  showLogos: true,
  displayTime: 30 * 1000,
  showStandings: true,
  showTables: true,
  showScorers: false,
  showDetails: false,
  language: 'it', // supported values are en, de, it
  token: YOUR_TOKEN
}
spacecdr commented 2 months ago

same behavior...

P.s. what "npm ci" does?

spacecdr commented 2 months ago

Please correct syntax errors at or above this line: /opt/magic_mirror/modules/MMM-SoccerLiveScore/node_helper.js:103

spacecdr commented 2 months ago

line 103 is "...this.requestOptions?.header,"

  doPost: async function (url, options) {
    let data;
    const localUrl = new URL(url);
    const localOptions = {
      ...this.requestOptions,
      ...options,
      headers: {
        ...this.requestOptions?.header,
        ...options?.header,
        'X-Auth-Token': this.token
      },
    };
    Log.debug(this.name, 'doPost', localUrl, localOptions);
    const resp = await fetch(url, localOptions);
    if (resp.status === 200) {
      data = await resp.json();
    } else {
      Log.error(this.name, 'doPost', localUrl, localOptions, resp);
      data = null;
    }
    return data;
    // return {}
  },
0m4r commented 2 months ago

thanks for the hint, I'll look into it @spacecdr

spacecdr commented 2 months ago

BTW, i'm using a docker container, if you want to try by docker-compose, here is my config:

    magicmirror:
       container_name: magicmirror
       image: bastilimbach/docker-magicmirror
       restart: unless-stopped
       volumes:
         #- /etc/localtime:/etc/localtime:ro
         - ~/DOCKER/magic_mirror/config:/opt/magic_mirror/config
         - ~/DOCKER/magic_mirror/modules:/opt/magic_mirror/modules
       ports:
         - 8000:8080

i then go to the container by "docker exec -it magicmirror bash" and follow your guide to download beta inside modules folder

0m4r commented 2 months ago

so, @spacecdr I think I forgot to mention on the beta branch you can only have showStandings: true, and you should set the rest to false

showTables: false,
showScorers: false,
showDetails: false,
spacecdr commented 2 months ago

@0m4r unfortunately even with showTables set to false, i still got the error:

magicmirror | 2024-09-13T19:39:59.104043136Z [13.09.2024 19:39.59.103] [ERROR] Whoops! There was an uncaught exception... magicmirror | 2024-09-13T19:39:59.109106873Z [13.09.2024 19:39.59.108] [ERROR] /opt/magic_mirror/modules/MMM-SoccerLiveScore/node_helper.js:103 magicmirror | 2024-09-13T19:39:59.109166734Z ...this.requestOptions?.header, magicmirror | 2024-09-13T19:39:59.109181789Z ^ magicmirror | 2024-09-13T19:39:59.109195763Z magicmirror | 2024-09-13T19:39:59.109209267Z SyntaxError: Unexpected token '.'

0m4r commented 2 months ago

what version of node are you using? it looks like it is complaining about the spread operator...

I cannot replicate it, I can only think about node versions :S

spacecdr commented 2 months ago

i wrote you... it's docker based... (bastilimbach/docker-magicmirror) node v12.22.1 npm 6.14.12 MagicMirror2 2.15.0

spacecdr commented 2 months ago

Tell me what should i update, if nodejs, or MM2...

0m4r commented 2 months ago

Both? Maybe first MM and then node if it still does not work?

spacecdr commented 2 months ago

i wrote you... it's docker based... (bastilimbach/docker-magicmirror) node v12.22.1 npm 6.14.12 MagicMirror2 2.15.0

Solved using this container: karsten13/magicmirror:latest mm

HeisemerBub commented 2 months ago

And what can i do with proxmox container and mm server?

0m4r commented 2 months ago

And what can i do with proxmox container and mm server?

I do not use a container, so I cannot really help. Be aware tho, he refers to the beta branch and not the stable one (the one broken...)

spacecdr commented 2 months ago

And what can i do with proxmox container and mm server?

Exactly... i have an MM server container and two raspberry pi 1 model B as client (using dietpi and midori fullscreen). They're working great!

p.s. That’s my kitchen “sea house”, the other MM pi client is on bedroom

IMG_0749 IMG_0750

HeisemerBub commented 2 months ago

Yes, and what exactly did you do? Please write exactly how you proceeded?

0m4r commented 2 months ago

I may need to ask you to continue this discussion somewhere else (maybe on the MM forum, so to share the information with the full community?) this is a bug report and it is not the right place for a tutorial.

Egnos87 commented 2 months ago

Hi @0m4r, I tried to use the command "git checkout beta" into the directory "MMM-SoccerLiveScore" but but i get this error:

pi@raspberrypi:~/MagicMirror/modules/MMM-SoccerLiveScore $ git checkout beta error: pathspec 'beta' did not match any file(s) known to git

What's wrong?

Thanks

0m4r commented 2 months ago

try with a git fetch -p before the git checkout beta

Egnos87 commented 2 months ago

Ok, now I get this error:

[18.09.2024 18:48.04.873] [ERROR] (node:9951) UnhandledPromiseRejectionWarning: ReferenceError: fetch is not defined
    at Class.doPost (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:109:18)
    at Class.getLeagueIds (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:124:29)
    at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:740:12)
    at Socket.<anonymous> (/home/pi/MagicMirror/js/node_helper.js:107:11)
    at Socket.emit (node:events:513:28)
    at Socket.emitUntyped (/home/pi/MagicMirror/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/pi/MagicMirror/node_modules/socket.io/dist/socket.js:703:39
    at process.processTicksAndRejections (node:internal/process/task_queues:78:11)
(Use `electron --trace-warnings ...` to show where the warning was created)
[18.09.2024 18:48.04.874] [ERROR] (node:9951) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

and this is my config:

{
          module: 'MMM-SoccerLiveScore',
          position: 'top_right',
          //header: 'Live-Scores',
          config: {
            leagues: [2019],
            showNames: true,
            showLogos: true,
            displayTime: 60 * 1000,
            showStandings: true,
            showTables: false,
            showDetails: false,
            showScorers: false,
            scrollVertical: false,
            language: 'it', // supported values are en, de, it
            token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
          }
},

Could you help me?

Thanks

HeisemerBub commented 2 months ago

Hi, a question ..is the token for free?

0m4r commented 2 months ago

Hi, a question ..is the token for free?

https://www.football-data.org/pricing

spacecdr commented 2 months ago

Hi, a question ..is the token for free?

Yes

spacecdr commented 2 months ago

Ok, now I get this error:

[18.09.2024 18:48.04.873] [ERROR] (node:9951) UnhandledPromiseRejectionWarning: ReferenceError: fetch is not defined
    at Class.doPost (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:109:18)
    at Class.getLeagueIds (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:124:29)
    at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:740:12)
    at Socket.<anonymous> (/home/pi/MagicMirror/js/node_helper.js:107:11)
    at Socket.emit (node:events:513:28)
    at Socket.emitUntyped (/home/pi/MagicMirror/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/pi/MagicMirror/node_modules/socket.io/dist/socket.js:703:39
    at process.processTicksAndRejections (node:internal/process/task_queues:78:11)
(Use `electron --trace-warnings ...` to show where the warning was created)
[18.09.2024 18:48.04.874] [ERROR] (node:9951) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

and this is my config:

{
        module: 'MMM-SoccerLiveScore',
        position: 'top_right',
        //header: 'Live-Scores',
        config: {
          leagues: [2019],
          showNames: true,
          showLogos: true,
          displayTime: 60 * 1000,
          showStandings: true,
          showTables: false,
          showDetails: false,
          showScorers: false,
          scrollVertical: false,
          language: 'it', // supported values are en, de, it
          token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        }
},

Could you help me?

Thanks

MM version? Nodejs version? Update anything to latest and it will work

Egnos87 commented 2 months ago

MagicMirror: v2.23.0 Node v16.20.2

0m4r commented 2 months ago

this is the same problem you already reported in #10 Please update the node version to 18+

Egnos87 commented 2 months ago

No problem, I updated node, now: v18.20.4

But I'm stuck in the same errors:

[19.09.2024 21:30.23.868] [ERROR] (node:1843) UnhandledPromiseRejectionWarning: ReferenceError: fetch is not defined
    at Class.doPost (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:109:18)
    at Class.getLeagueIds (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:124:29)
    at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:740:12)
    at Socket.<anonymous> (/home/pi/MagicMirror/js/node_helper.js:107:11)
    at Socket.emit (node:events:513:28)
    at Socket.emitUntyped (/home/pi/MagicMirror/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/pi/MagicMirror/node_modules/socket.io/dist/socket.js:703:39
    at process.processTicksAndRejections (node:internal/process/task_queues:78:11)
(Use `electron --trace-warnings ...` to show where the warning was created)
[19.09.2024 21:30.23.869] [ERROR] (node:1843) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)

Probably there are other problems, can I to run other tests?

0m4r commented 2 months ago

Try installing the node fetch package manually please

Egnos87 commented 2 months ago

Could you guide me in this operation or suggest me an online guide?

Thanks

0m4r commented 2 months ago

Could you guide me in this operation or suggest me an online guide?

Thanks

https://github.com/0m4r/MMM-SoccerLiveScore/issues/10#issuecomment-2039045949

Egnos87 commented 2 months ago

From the MMM-SoccerLiveScore module I did: npm install node-fetch and:

if I add in the node_helper.js file this line: const fetch = require('node-fetch'); The MM crash

pi@raspberrypi:~/MagicMirror $ npm start

> magicmirror@2.23.0 start
> DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js

[19.09.2024 22:23.29.916] [LOG]   Starting MagicMirror: v2.23.0
[19.09.2024 22:23.29.923] [LOG]   Loading config ...
[19.09.2024 22:23.29.927] [DEBUG] config template file not exists, no envsubst
[19.09.2024 22:23.29.936] [LOG]   Loading module helpers ...
[19.09.2024 22:23.29.938] [LOG]   No helper found for module: MMM-pages.
[19.09.2024 22:23.29.940] [LOG]   No helper found for module: alert.
[19.09.2024 22:23.29.942] [LOG]   No helper found for module: clock.
[19.09.2024 22:23.29.987] [LOG]   Initializing new module helper ...
[19.09.2024 22:23.29.988] [LOG]   Module helper loaded: MMM-GPIO-Notifications
[19.09.2024 22:23.30.007] [LOG]   Initializing new module helper ...
[19.09.2024 22:23.30.008] [LOG]   Module helper loaded: MMM-Screen-Powersave-Notification
[19.09.2024 22:23.30.447] [LOG]   Initializing new module helper ...
[19.09.2024 22:23.30.449] [LOG]   Module helper loaded: EXT-YouTubeCast
[19.09.2024 22:23.30.450] [LOG]   No helper found for module: MMM-CSSswitch.
[19.09.2024 22:23.30.723] [LOG]   Initializing new module helper ...
[19.09.2024 22:23.30.724] [LOG]   Module helper loaded: calendar
[19.09.2024 22:23.30.746] [LOG]   Initializing new module helper ...
[19.09.2024 22:23.30.747] [LOG]   Module helper loaded: MMM-anotherNewsFeed
[19.09.2024 22:23.31.148] [LOG]   Initializing new module helper ...
[19.09.2024 22:23.31.148] [LOG]   Module helper loaded: MMM-DarkSkyForecast
[19.09.2024 22:23.31.338] [LOG]   Initializing new module helper ...
[19.09.2024 22:23.31.338] [LOG]   Module helper loaded: MMM-WordOfTheDay
[19.09.2024 22:23.31.339] [LOG]   No helper found for module: MMM-Multimonth.
[19.09.2024 22:23.31.370] [LOG]   Initializing new module helper ...
[19.09.2024 22:23.31.370] [LOG]   Module helper loaded: MMM-MyGarbage
[19.09.2024 22:23.31.534] [ERROR] (node:7790) UnhandledPromiseRejectionWarning: Error [ERR_REQUIRE_ESM]: require() of ES Module /home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_modules/node-fetch/src/index.js from /home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js not supported.
Instead change the require of index.js in /home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js to a dynamic import() which is available in all CommonJS modules.
    at f._load (node:electron/js2c/asar_bundle:2:13330)
    at Object.<anonymous> (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:10:15)
    at f._load (node:electron/js2c/asar_bundle:2:13330)
    at loadModule (/home/pi/MagicMirror/js/app.js:184:19)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:220:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at /home/pi/MagicMirror/js/app.js:230:4
    at new Promise (<anonymous>)
    at loadModules (/home/pi/MagicMirror/js/app.js:211:10)
    at App.start (/home/pi/MagicMirror/js/app.js:277:9)
(Use `electron --trace-warnings ...` to show where the warning was created)
[19.09.2024 22:23.31.540] [ERROR] (node:7790) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
[19.09.2024 22:23.31.936] [LOG]   Launching application.
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to open kms_swrast (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load swrast driver

if I remove const fetch = require('node-fetch'); I get these errors:

[19.09.2024 22:22.18.768] [ERROR] (node:7225) UnhandledPromiseRejectionWarning: ReferenceError: fetch is not defined
    at Class.doPost (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:110:18)
    at Class.getLeagueIds (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:125:29)
    at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:741:12)
    at Socket.<anonymous> (/home/pi/MagicMirror/js/node_helper.js:107:11)
    at Socket.emit (node:events:513:28)
    at Socket.emitUntyped (/home/pi/MagicMirror/node_modules/socket.io/dist/typed-events.js:69:22)
    at /home/pi/MagicMirror/node_modules/socket.io/dist/socket.js:703:39
    at process.processTicksAndRejections (node:internal/process/task_queues:78:11)
(Use `electron --trace-warnings ...` to show where the warning was created)
[19.09.2024 22:22.18.770] [ERROR] (node:7225) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
0m4r commented 2 months ago

please try to replace const fetch = require('node-fetch'); with import fetch from "node-fetch"

reference: https://www.npmjs.com/package/node-fetch#es-modules-esm

Egnos87 commented 2 months ago

Same situation: if I add import fetch from "node-fetch" into "MMM-SoccerLiveScore\node_helper.js" the MM crash:

> magicmirror@2.23.0 start
> DISPLAY="${DISPLAY:=:0}" ./node_modules/.bin/electron js/electron.js

[20.09.2024 19:28.48.018] [LOG]   Starting MagicMirror: v2.23.0
[20.09.2024 19:28.48.026] [LOG]   Loading config ...
[20.09.2024 19:28.48.030] [DEBUG] config template file not exists, no envsubst
[20.09.2024 19:28.48.038] [LOG]   Loading module helpers ...
[20.09.2024 19:28.48.040] [LOG]   No helper found for module: MMM-pages.
[20.09.2024 19:28.48.042] [LOG]   No helper found for module: alert.
[20.09.2024 19:28.48.043] [LOG]   No helper found for module: clock.
[20.09.2024 19:28.48.086] [LOG]   Initializing new module helper ...
[20.09.2024 19:28.48.088] [LOG]   Module helper loaded: MMM-GPIO-Notifications
[20.09.2024 19:28.48.106] [LOG]   Initializing new module helper ...
[20.09.2024 19:28.48.107] [LOG]   Module helper loaded: MMM-Screen-Powersave-Notification
[20.09.2024 19:28.48.503] [LOG]   Initializing new module helper ...
[20.09.2024 19:28.48.504] [LOG]   Module helper loaded: EXT-YouTubeCast
[20.09.2024 19:28.48.505] [LOG]   No helper found for module: MMM-CSSswitch.
[20.09.2024 19:28.48.751] [LOG]   Initializing new module helper ...
[20.09.2024 19:28.48.752] [LOG]   Module helper loaded: calendar
[20.09.2024 19:28.48.775] [LOG]   Initializing new module helper ...
[20.09.2024 19:28.48.776] [LOG]   Module helper loaded: MMM-anotherNewsFeed
[20.09.2024 19:28.49.160] [LOG]   Initializing new module helper ...
[20.09.2024 19:28.49.161] [LOG]   Module helper loaded: MMM-DarkSkyForecast
[20.09.2024 19:28.49.313] [LOG]   Initializing new module helper ...
[20.09.2024 19:28.49.314] [LOG]   Module helper loaded: MMM-WordOfTheDay
[20.09.2024 19:28.49.314] [LOG]   No helper found for module: MMM-Multimonth.
[20.09.2024 19:28.49.345] [LOG]   Initializing new module helper ...
[20.09.2024 19:28.49.345] [LOG]   Module helper loaded: MMM-MyGarbage
[20.09.2024 19:28.49.351] [ERROR] (node:8762) UnhandledPromiseRejectionWarning: /home/pi/MagicMirror/modules/MMM-SoccerLiveScore/node_helper.js:11
import fetch from "node-fetch";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:360:18)
    at wrapSafe (node:internal/modules/cjs/loader:1062:15)
    at Module._compile (node:internal/modules/cjs/loader:1097:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1196:10)
    at Module.load (node:internal/modules/cjs/loader:1011:32)
    at Module._load (node:internal/modules/cjs/loader:846:12)
    at f._load (node:electron/js2c/asar_bundle:2:13330)
    at Module.require (node:internal/modules/cjs/loader:1035:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at loadModule (/home/pi/MagicMirror/js/app.js:184:19)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:220:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
    at loadNextModule (/home/pi/MagicMirror/js/app.js:222:6)
(Use `electron --trace-warnings ...` to show where the warning was created)
[20.09.2024 19:28.49.352] [ERROR] (node:8762) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
[20.09.2024 19:28.49.728] [LOG]   Launching application.
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to open kms_swrast (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast (search paths /usr/lib/arm-linux-gnueabihf/dri:\$${ORIGIN}/dri:/usr/lib/dri)
failed to load swrast driver
0m4r commented 1 month ago

Following the unavailability of the API used by this module, a new version is under development and available for beta testing.

If you are interested in trying it out, please follow the steps (they assume you are in the MMM-SoccerLiveScore folder):

> git checkout beta
> git pull -r
> npm ci

update the configuration as follows:

{
  token: "TOKEN",
  leagues: [LEAGUE_ID_1, LEAGUE_ID_2],
  displayTime: 1 * 60 * 1000, // 1 minute
  requestInterval: 10 * 60 * 1000, // 10 minutes
  showNames: true,
  showLogos: true,
  showStandings: true,
  showTables: true,
  showScorers: true,
}

You must obtain the TOKEN from https://www.football-data.org/pricing (there is a free plan too!).

The list of available leagues you can add to the configuration depends on your subscription plan, the full list of leagues is available here: https://docs.football-data.org/general/v4/lookup_tables.html#_league_codes (you need the competitionId)

0m4r commented 1 month ago

Version 4.0 is released today. The API endpoint is new and it requires a subscription to https://www.football-data.org/pricing (a free plan is available too)

codac commented 3 weeks ago

I have pulled the latest version, but still have the same issue:

{
            module: 'MMM-SoccerLiveScore',
            position: 'top_left',
            config: {
                    leagues: [2012],
                    displayTime: 60 * 1000,
                    requestInterval: 10 * 60 * 1000, // 10 mins
                    showNames: true,
                    showLogos: true,
                    showStandings: false,
                    showTables: true,
                    showScorers: false,
                    scrollVertical: false,
                    logostToInvert: [109], // some teams logo are not visible on dark background
                    token: "XXXXXXXXXXXXXXX",
                    requestsAvailablePerMinute: "5",
            }
        },
0m4r commented 3 weeks ago

I have pulled the latest version, but still have the same issue:

{
          module: 'MMM-SoccerLiveScore',
          position: 'top_left',
          config: {
                  leagues: [2012],
                  displayTime: 60 * 1000,
                  requestInterval: 10 * 60 * 1000, // 10 mins
                  showNames: true,
                  showLogos: true,
                  showStandings: false,
                  showTables: true,
                  showScorers: false,
                  scrollVertical: false,
                  logostToInvert: [109], // some teams logo are not visible on dark background
                  token: "XXXXXXXXXXXXXXX",
                  requestsAvailablePerMinute: "5",
          }
      },

can you see any error in the logs? the config looks correct to me and I would not know how to help without any log to see.

codac commented 3 weeks ago

Dude, that was quick :-D

No error, the only thing I see is an Info MMM-SoccerLivesScore socketNotificationReceived (followed by the config settings) and another Info right behind "MMM-SoccerLiveScore doRequest url https://api.football-data.org/v4/competitions.

Should mention that I'm using karsten13/magicmirror docker.

0m4r commented 3 weeks ago

can you try changing the log level to debug in your mm config.json file and restart? You should see a bit more stuff...

If you do not mind, it would be useful if you could either attach a piece of it or cut and paste the content so I can also see it and eventually check if anything pops into my eyes.

codac commented 3 weeks ago

I have added "DEBUG" for the log level in config,json. So far no INFO or ERROR messages. Alright, as soon as something comes up, I'll attach/post the LOG entries.