Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showcase/Proposal: Major refactor #335

Merged
merged 106 commits into from
Apr 7, 2022
Merged

Conversation

WardBrian
Copy link
Member

@WardBrian WardBrian commented Jun 22, 2021

I decided to build one of these last week and couldn't leave well enough alone. I didn't intend to contribute back any changes, but I ended up doing a lot of work which may be useful for the broader community using this. In retrospect, a lot of what I did overlaps pretty strongly with requests already present in this repo - it seems that if I wanted a feature, chances are someone else did as well.

For the moment, I'm treating this as more of a showcase PR -- merging would require a decent bit more work and buy-in on some of my changes, which may not all be popular.

Major code changes:

This last change in particular should make the program more robust to future MLB api changes, as the only changes would be needed in these classes rather than every place that depends on a game's data etc.

Features and minor changes:

TODO

If this was going to be merged, there are a lot of further tweaks needed. The few that come to mind immediately:

  • Update install script/method (why ship matrix as a submodule?)
  • Update formatting for boards other than 32x32 or 64x32
  • Update readme with new information
  • Should probably parse the important dates manually and ditch mlbgame entirely

@pfightingpolish
Copy link

I wrote up a quick train display for my local subway stop during the offseason I'd like to keep using, but it's actually a rather difficult scheduling problem, especially if you don't want to be making network requests for information you're not actively using

There are a couple different ways I can think of attacking this:

  1. Consider having an entirely different complete directory for different applications. For instance, I have different directories for different sports (MLB, NFL, basketball, soccer, etc.) and just go in and change the /lib/systemd/system/mlb-led-scoreboard.service file to load the different sport I want to display. The full build doesn't take up that much space. Multiple iterations on the same partition is very doable.
  2. If you want to try and integrate it into the game display functionality, write it in as its own data class and renderer class, then set up the function in your renderers/main.py file to only have it call for the data on a conditional function, such as "no active games" or "no games on this day" or whatever. There's always a way to make something conditional.

@tracerrx
Copy link
Contributor

on my 64x128 I get a flashing ? on strikeouts. Assuming this means I'm missing some font install for a backwards K? Also the mlb logo for 64x128 is missing from /assets

@tracerrx
Copy link
Contributor

mlb-w128h64.png
mlb-w128h64

@tracerrx
Copy link
Contributor

Some font size changes and position changes for 128x6
w128h64.json.zip
4

@WardBrian
Copy link
Member Author

Care to describe your changes? I only use 64x32 personally so the other sizes were mostly quickly eyeballed by me

@tracerrx
Copy link
Contributor

  • Change Default font to 7x13 from 9x18B
  • Change base size to 10 from 14
  • Change Due Up font to 5x7 from 7x13B
  • Set Due Up divider to false
  • Change leadoff font to 7x13 from 7x13B
  • Moved number x pos from 87 to 93
  • Re-positioned inning indicator arrow
  • Re-positioned and resized OUTS
  • Changed font to 5x7 for atbat and pitcher
  • Added font 9x18B to Home and Away team names, changed positions to accomdate font size

@tracerrx
Copy link
Contributor

FYI, installs and runs just fine on 64bit Raspberry Pi OS.

@tracerrx
Copy link
Contributor

FYI, when running as a service add time-sync.target as a want and after to ensure that NTP syncs and gets a date before mlb-led-scoreboard starts.

in /lib/systemd/system/mlb-led-scoreboard.service make sure you have:

[Unit]
Description=MLB LED Scoreboard
Wants=network-online.target time-sync.target
After=network.target network-online.target time-sync.target

@twfarley
Copy link
Member

twfarley commented Apr 7, 2022

Update the readme and wiki to include python 3 updates and I think we can merge.

I’d really like a 32x32 version as well so we don’t deprecate those that bought in with that config.

@WardBrian
Copy link
Member Author

It works on 32x, it just doesn’t display the new batter/pitcher

I can update the readme later

@WardBrian
Copy link
Member Author

@twfarley I can't edit the wiki, but I did fix the README

@tracerrx
Copy link
Contributor

Is the Network/Channel the game is on in the feed? If so anyway we can put it on the pregame screen? Especially with all the exclusive deals now (Espn, Amazon Prime, AppleTV+, Peacock).. its getting a little confusing.

@WardBrian
Copy link
Member Author

I can’t find it in the data feed

@tracerrx
Copy link
Contributor

I just looked at todays NYY-BOS feed and while its not in the live feed below:
http://statsapi.mlb.com/api/v1.1/game/661316/feed/live

It does look like maybe its here:
https://statsapi.mlb.com/api/v1/schedule?sportId=1&date=2022-04-10&hydrate=broadcasts

@WardBrian
Copy link
Member Author

Huh, I will look into it. I guess the most useful thing is only showing if it's a national broadcast?

@WardBrian
Copy link
Member Author

It would be much easier if the information was available from the game endpoint rather than the schedule one

@tracerrx
Copy link
Contributor

Agreed.. I also don't understand this hydrate option (maybe it can be used on the game url as well?)... I found it here:
https://www.reddit.com/r/mlbdata/comments/rzywe0/mlb_tv_network_info/

@WardBrian
Copy link
Member Author

I was able to find a (kinda old) version of the MLB documentation and it seems like that isn’t on the game endpoint

@tracerrx
Copy link
Contributor

  1. The link to this thread was removed from the README on github....
  2. How hard would it be to build in a configurable delay? It seems that the MLB API is much faster than live game boradcasts this year.. maybe 10-15 seconds?

@WardBrian
Copy link
Member Author

I’ve also noticed it being a few pitches ahead of the feed, though the Gameday app often is as well. The technical details of how you’d do such a delay get complicated pretty quickly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New standings implementation displays wrong record