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-MyScoreboard

    Scheduled Pinned Locked Moved Sport
    277 Posts 60 Posters 562.6k Views 63 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.
    • J Offline
      j.e.f.f Project Sponsor Module Developer
      last edited by j.e.f.f

      Here’s a module to display today’s scores for your favourite teams across multiple leagues.

      [card:jclarke0000/MMM-MyScoreboard]

      UPDATE 3-OCT-2022!

      • Correction of SNET provider ticker URL
      • Change of ESPN provider URL from HTTP to HTTPS
      • Replacement of deprecated library Request with Axios
      • Addition of of WNBA and NCAAW womens’ basketball
      • Team logo updates for various North American leagues
      • Correction of NCAA Wisconsin Badgers team shortcode from WIS to WISC

      Note to the anyone updating from a previous version:

      1. In the MMM-MyScoreboard directory, run git pull to get the latest source code
      2. Run npm install to install the new dependencies
      3. (Optional) Run npm prune to remove old dependencies that are no longer required

      Display is configurable for your preferred of 6 different view styles:
      0_1499122243396_MMM-MyScoreboard-viewStyles.jpg

      But Jeff! There are already modules for all these sports! Why did you write this?

      Glad you asked! While there are already modules to support many of the sports I am interested in, they all look and behave just a little bit differently. I wanted my scoreboard to have a consistent look across all leagues, and I also wanted the module to hide itself completely if there were no games.

      Furthermore, I wanted this to be modular such that adding more leagues would be fairly straightforward. Right now it supports NHL, MLB, NBA, NFL, MLS, NCAAF and CFL (Canadian Football). Pretty much any league with a public API can be added provided it fits with the two team, current score with status (e.g.: current period and game clock, future start time, etc.) format.

      So what’s the catch?

      My module ONLY displays today’s games. You won’t see yesterday’s scores (well you can with a creative hack using one of the configs… more below), nor will you see a schedule for upcoming games. My thought is you’re not really spending a lot of time looking at your mirror – you’re likely busy doing other stuff, like actually watching the game. But for today’s games that haven’t yet started, it’s a quick reminder that you need to make time later for your obligation to consume professional sport.

      What’s this magical hack you speak of?

      There is a configuration called rolloverHours that treats x amount of hours past midnight as the previous day. This way your scores don’t mysteriously disappear mid game at midnight (West coast NHL playoff overtime anybody?). Typically you might set this to 2 or 3 hours, but if you set it, say, to 12, then you’ll see yesterday’s finals up until noon, after which you’ll start to see today’s lineup.

      Enjoy this module! I’m quite proud of it, and let me know if you’d like to see some other leagues included. I’ve already had a request for pro video game leagues. It’s a little different and poses a bit of a challenge but I’ll see if it can be done.

      Special thanks to my beta testers @number1dan, @nhl, @d3r, @cowboysdude, and anyone else who tried this module out while I was getting everything working.

      -Jeff

      1 Reply Last reply Reply Quote 9
      • cowboysdudeC Offline
        cowboysdude Module Developer
        last edited by

        NICE job!

        1 Reply Last reply Reply Quote 0
        • sithasS Offline
          sithas
          last edited by

          looks great

          1. could you show us what your "yesterdays’ would look like?
          2. Is it all teams or just your favourite teams ( if i was to have The peguins and Predators would it show 2 or only 1 time ) Not that, that will ever happen Go WILD !
          J 1 Reply Last reply Reply Quote 0
          • J Offline
            j.e.f.f Project Sponsor Module Developer @sithas
            last edited by

            @sithas Yesterdays will just look like final scores. There’s no indication that they are from yesterday. The display will change to the actual list of today’s games starting later when the rollover time passes.

            This module just shows the games for the teams you want to follow. If you want to see all games then you need to put all teams in the follow list. You’ll only see one game listed if both teams are in your follow list.

            1 Reply Last reply Reply Quote 0
            • S Offline
              Spankythemusical
              last edited by

              Jeff,

              I have a question/huge favor. I’m trying to add NCAAF to this module. Unfortunately, I have exactly 0.2% experience with js. I can parse the website with Python and get the information I’m looking for, but I do not know how to translate that to js. I have taken your NBA.js and changed it in an attempt to make it work, but I’m sure I’m not even close to where I need to be. When you have a few free moments (i.e. this is not at all an important endeavor), could you look over where I am and point me closer to the right direction? I cannot tell you how much I would appreciate it. (I’ve realized that I cannot upload the text file, but I can copy/paste the code here)

              J 1 Reply Last reply Reply Quote 0
              • J Offline
                j.e.f.f Project Sponsor Module Developer @Spankythemusical
                last edited by

                @Spankythemusical I’m travelling this week, but I’ll have a look when I get back next week. Is the Fred a public JSON feed or are you scraping the NCAA website?

                S 1 Reply Last reply Reply Quote 0
                • P-Bo726P Offline
                  P-Bo726
                  last edited by

                  Love this module! Does this module allow more than one module to run at a time. I can’t seem to get more than one to run. Config file errors out. Could this feature be added? Why would I need this? I’d like to have one league down the right hand side and one down the left hand side.

                  J 1 Reply Last reply Reply Quote 0
                  • S Offline
                    Spankythemusical @j.e.f.f
                    last edited by

                    @j.e.f.f Thank you. Like I said, it’s not a big thing that needs immediate attention. The feed is a public JSON feed from ESPN.

                    J 1 Reply Last reply Reply Quote 0
                    • J Offline
                      j.e.f.f Project Sponsor Module Developer @Spankythemusical
                      last edited by

                      @Spankythemusical all of the current sports my module supports use public JSON feeds. If you want, take a look at, say, NBA to get an idea how it works.

                      S 1 Reply Last reply Reply Quote 0
                      • J Offline
                        j.e.f.f Project Sponsor Module Developer @P-Bo726
                        last edited by

                        @P-Bo726 it does not. Since the module takes care of dividing up the sports for you I didn’t see a reason for multiple instances.

                        P-Bo726P 1 Reply Last reply Reply Quote 0
                        • S Offline
                          Spankythemusical @j.e.f.f
                          last edited by

                          @j.e.f.f I actually used the MBA section as the template. Unfortunately, I do not have close to enough experience with js to ensure that it is correct. Is there a section of code that controls if the section is hidden or showing? If I could make the section how even without an upcoming game, then I could see if what I’ve done so far is successful.

                          J 2 Replies Last reply Reply Quote 0
                          • P-Bo726P Offline
                            P-Bo726 @j.e.f.f
                            last edited by

                            @j.e.f.f I’m in the process of building an all sports dashboard and could use multiple instances. I’d benefit from that feature and other may see a use for it as well. Please, Please :)

                            J 2 Replies Last reply Reply Quote 0
                            • J Offline
                              j.e.f.f Project Sponsor Module Developer @Spankythemusical
                              last edited by

                              @Spankythemusical you won’t have to touch the front end logic. Your NCAA extension file handles what the front end will receive. Typically the way the other sports work is that the sport is configured with the teams you wish to follow. Then you’ll query for all of “today’s” games, then filter what gets returned to the list of teams to follow. There is a README under the sports directory that goes into more detail about all of this.

                              You’ll also need to add your sport to the list of supported sports in node_helper.js. It’s an array near the top of the file.

                              Lastly, in case there are any special CSS requirements for your sport you may need to add some rules to MMM-MyScoreboard.css. But it should look pretty good right out of the box.

                              In any case I’ll lend a hand when I get back next week.

                              1 Reply Last reply Reply Quote 0
                              • J Offline
                                j.e.f.f Project Sponsor Module Developer @P-Bo726
                                last edited by

                                @P-Bo726 I’m travelling all this week but I’ll see what I can do when I get back.

                                1 Reply Last reply Reply Quote 0
                                • O Offline
                                  onetwankyfive
                                  last edited by

                                  +1 to NCAAF
                                  This would be amazing

                                  1 Reply Last reply Reply Quote 0
                                  • J Offline
                                    j.e.f.f Project Sponsor Module Developer @P-Bo726
                                    last edited by j.e.f.f

                                    @P-Bo726 So it looks like I’d need to make a pretty significant rewrite to make this module work with multiple instances. Right now my node_helper module stores quite a bit of instance information, including what supported sports modules are required – this part in particular poses a real problem being stored as instance configuration, as opposed to a global module configuration.

                                    I’ll spend some time thinking about how this might be architected, but I don’t think this will happen any time soon, sorry to say.

                                    If you wanted to get your hands dirty, you could manually make multiple instances of this module, but it’s really hacky. Make a copy of the MMM-MyScoreboard directory (Say, MMM-MyScoreBoard2). rename MMM-MyScorboard.js to MMM-MyScoreboard2.js. Do the same to the CSS file and rename it to MMM-MyScoreboard2.css. In the MMM-MyScoreboard2.js file, you’ll need to adjust line 12 Module.register("MMM-MyScoreboard" to read Module.register("MMM-MyScoreboard2" and similarly line 38 return ["MMM-MyScoreboard.css"]; to return ["MMM-MyScoreboard2.css"];

                                    Finally, do a search and replace in MMM-MyScoreboard2.css and replace all instances of MMM-MyScoreboard with MMM-MyScoreboard2.

                                    Now you have two independent modules - MMM-MyScoreboard and MMM-MyScoreboard2 - that you can configure separately in your config file.

                                    You can do this as many times as you like, so long as each time you are using a different name.

                                    1 Reply Last reply Reply Quote 0
                                    • P-Bo726P Offline
                                      P-Bo726
                                      last edited by

                                      Thank you for the response. I’ll take a look at that hack you provided. If you find some "free’’ time and want to work on the multiple instances I would still find some value in it. No pressure, no hurry. I appreciate all the work you have put into this module and the MM forum in general. Great work!

                                      J 1 Reply Last reply Reply Quote 0
                                      • J Offline
                                        j.e.f.f Project Sponsor Module Developer @P-Bo726
                                        last edited by

                                        @P-Bo726 Need to get NFL up and running before anything else. Pre-season starts this week!

                                        1 Reply Last reply Reply Quote 0
                                        • K Offline
                                          Krisalexroberts 0
                                          last edited by

                                          Could you get this working with Pointstreak? Lots of minority leagues/sports use Pointstreak such as the UK Elite Ice Hockey League (EIHL)

                                          J 1 Reply Last reply Reply Quote 0
                                          • J Offline
                                            j.e.f.f Project Sponsor Module Developer @Krisalexroberts 0
                                            last edited by

                                            @Krisalexroberts-0 I’ll take a look to see if there is a public data feed available for this. If so, it should be doable. It will take some time to amass all of the logos and such, but I like the potential for many leagues working with a single API.

                                            I still have to finish with NFL – I had it working with last night’s game, but I’d like to run it against next week’s preseason lineup to see if there are any gotchas before I release it.

                                            So far I have requests for NCAAF, Pointstreak and eSports. Should be an interesting summer!

                                            K 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
                                            • 3
                                            • 4
                                            • 5
                                            • 13
                                            • 14
                                            • 1 / 14
                                            • 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