• 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
A New Chapter for MagicMirror: The Community Takes the Lead
Read the statement by Michael Teeuw here.

MMM-NBA / NBA Scores Module

Scheduled Pinned Locked Moved Development
11 Posts 3 Posters 8.3k Views 3 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.
  • I Offline
    in_a_days
    last edited by Jan 16, 2017, 6:25 PM

    Per @strawberry-3-141’s suggestion I’m relocating this discussion from the NFL Module thread. I’ve managed to parse data from

    http://www.espn.com/nba/bottomline/scores

    using a python program that stores team names, scores, winners and game times. I can produce this result on the command line:

    0_1484590474543_parser.jpg

    My current goal is to learn how to execute @strawberry-3-141’s suggestion:

    “Help: you can run the python script in from inside the node_helper and read the output, then send the data to your module with a socket notification”

    I have a lot to learn. I’ve figured out a lot about socket notifications and sending notifications and data between modules. I think I can probably handle that part. But I have zero confidence in the process of calling the script and reading output from within the node_helper. I suspect running the script from node_helper will look similar to this suggestion:

    https://github.com/paviro/MMM-Facial-Recognition/blob/master/node_helper.js#L11

    But the variables are a mystery to me and I don’t know how to read the result. If anybody can link to a tutorial that will help me understand this process I will be very grateful! I would much rather learn to do this for myself than have somebody do the work and write the code for me. Thank you!

    S B 2 Replies Last reply Jan 16, 2017, 6:31 PM Reply Quote 1
    • S Offline
      strawberry 3.141 Project Sponsor Module Developer @in_a_days
      last edited by strawberry 3.141 Jan 16, 2017, 6:35 PM Jan 16, 2017, 6:31 PM

      @in_a_days

      in the python script you will need this function to return a json object to your node helper https://github.com/paviro/MMM-Facial-Recognition/blob/master/facerecognition/facerecognition.py#L25

      in the node_helper you would need this function https://github.com/paviro/MMM-Facial-Recognition/blob/master/node_helper.js#L9

      what variables are unclear to you, name them and we can try to explain them

      Please create a github issue if you need help, so I can keep track

      I 1 Reply Last reply Jan 16, 2017, 7:24 PM Reply Quote 1
      • I Offline
        in_a_days @strawberry 3.141
        last edited by Jan 16, 2017, 7:24 PM

        @strawberry-3.141

        These are very helpful. I assume I will also need to

        import sys
        import json
        

        at the top of my file?

        Right now I’m storing data in a few arrays in my .py file. For example, I have an array where

        homeTeam[gameNum]
        

        will display the string of the home team name.

        Will this pass the full array?

        to_node("home teams", homeTeam)
        
        S 1 Reply Last reply Jan 16, 2017, 7:25 PM Reply Quote 0
        • S Offline
          strawberry 3.141 Project Sponsor Module Developer @in_a_days
          last edited by Jan 16, 2017, 7:25 PM

          @in_a_days

          yes you will need both imports, as they are used in this function

          this should pass the full array

          Please create a github issue if you need help, so I can keep track

          I 1 Reply Last reply Jan 16, 2017, 11:15 PM Reply Quote 0
          • I Offline
            in_a_days @strawberry 3.141
            last edited by in_a_days Jan 16, 2017, 11:16 PM Jan 16, 2017, 11:15 PM

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • B Offline
              Burner911 @in_a_days
              last edited by Jan 17, 2017, 7:28 AM

              @in_a_days Thank you so much for working on this! I’ve been hoping for an NBA module for a while now

              I 1 Reply Last reply Jan 17, 2017, 3:47 PM Reply Quote 0
              • I Offline
                in_a_days @Burner911
                last edited by Jan 17, 2017, 3:47 PM

                @Burner911

                Still a long way to go, but I’ll keep working at this till I make something work! :)

                The parser is available here if anybody wants to play around with displaying the data.

                https://github.com/in-a-days/MMM-NBA/blob/master/MMM-NBA.py

                It’s the first original code I’ve written in a very long time so forgive me if it’s not pretty. ;)

                B 1 Reply Last reply Jan 24, 2017, 11:57 PM Reply Quote 1
                • B Offline
                  Burner911 @in_a_days
                  last edited by Jan 24, 2017, 11:57 PM

                  @in_a_days How are things going? Any luck so far?

                  I 1 Reply Last reply Jan 25, 2017, 12:58 AM Reply Quote 0
                  • I Offline
                    in_a_days @Burner911
                    last edited by Jan 25, 2017, 12:58 AM

                    @Burner911

                    Still a work in progress! I’ve managed to pull score data from the espn site, but exchanging the data between the python script and node helper is really challenging me. I was trying to just reverse engineer one of the other scoring modules, but both my parsing method and lack of javascript experience have made this really really difficult. I’ve been studying several tutorials and working on building simple modules from scratch just to make sure I understand all the socketNotification exchanges.

                    Now that I’m getting a feel for it, I’ll probably re-write the parser in javascript. It’s a slow process, but I plan to stay at it until it’s done or someone else makes it first. :)

                    S B 2 Replies Last reply Jan 25, 2017, 9:41 AM Reply Quote 1
                    • S Offline
                      strawberry 3.141 Project Sponsor Module Developer @in_a_days
                      last edited by Jan 25, 2017, 9:41 AM

                      @in_a_days at least there is a module for the standings https://forum.magicmirror.builders/topic/1479/mmm-nbaranking-nba-standings

                      Please create a github issue if you need help, so I can keep track

                      1 Reply Last reply Reply Quote 1
                      • 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