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

Getting to rotate #60

Open
Irishking03 opened this issue Dec 1, 2023 · 7 comments
Open

Getting to rotate #60

Irishking03 opened this issue Dec 1, 2023 · 7 comments

Comments

@Irishking03
Copy link

@mikemountain or anyone

Where is the setting to rotate the game. I currently have this in the config.json

{
"preferred": {
"teams": ["PHI", "DAL", "WASH", "NYG"]
},
"rotation": {
"enabled": true,
"only_preferred": false,
"rates": {
"live": 15.0,
"final": 10.0,
"pregame": 10.0
},
"while_preferred_team_live": {
"enabled": false,
"during_halftime": false
}
},
"scrolling_speed": 2,
"use_helmet_logos": false,
"debug": "true"
}

BUT I CANT GET THE GAMES TO ROTATE LIKE THEY NORMALLY DO.

@alexanderthebadatcoding
Copy link

try changing
"while_preferred_team_live": {
"enabled": true,
"during_halftime": true

@Irishking03
Copy link
Author

@alexanderthebadatcoding WOULD HELP IF I Wasn't and idiot. I fixed that and also the PHL for eagles is PHI (SMACKS HEAD).. However now the eagles upcoming game comes up but I also have commanders, giants and dallas as preferred. But not rotating.

@Irishking03
Copy link
Author

It Looks like whatever I put in Preferred team as the last team (example "team": ["PHI", "LAR", "DAL", "NYG"]) will populate only. Like in this example is NYG.. If i remove NYG just Dallas populates.. So wierd.

@Irishking03
Copy link
Author

I don't know what I did but it is rotating now.

{
"preferred": {
"teams": ["PHI", "WAS"]
},
"rotation": {
"enabled": true,
"only_preferred": false,
"rates": {
"live": 15.0,
"final": 10.0,
"pregame": 10.0
},
"while_preferred_team_live": {
"enabled": true,
"during_halftime": false
}
},
"scrolling_speed": 2,
"use_helmet_logos": false,
"debug": "true"
}

@alexanderthebadatcoding
Copy link

alexanderthebadatcoding commented Dec 1, 2023

I think there is a bug in the code, there's a post saying that the while preferred_team_live settings can cause an Issue. I think what is happening is that the code checks if a preferred team is playing, but then shows the first result returned from the API: http://site.api.espn.com/apis/site/v2/sports/football/nfl/scoreboard, which for this week is Dallas vs Seattle.

thats what my guess is. I just made sure to have rotation "enabled": true, and
"while_preferred_team_live": {
"enabled": true,
"during_halftime": true
}.

That way It will just always rotate the games shown.

@Irishking03
Copy link
Author

Now issue is the board with randomly turn off after a period of time. I have to log back in the pi (SSH) and re-enter the code.

@alexanderthebadatcoding
Copy link

alexanderthebadatcoding commented Dec 9, 2023

You could try to set a Supervisor task to run the script continuously, and if it crashes then restart it.
sudo apt-get install -y supervisor
sudo service supervisor start
then in
/etc/supervisor/conf.d/
add a start.conf file

[program:scoreboard]
command=sudo python3 led.py
directory=/home/pi/
autostart=true
autorestart=true
stderr_logfile=/home/pi/boot.err.log
supervisorctl reread
supervisorctl update
sudo supervisorctl start scoreboard

More information here: https://serversforhackers.com/c/monitoring-processes-with-supervisord

Also I created a script that switches between the NFL and NBA scoreboard etc.
But you might need to edit the settings a little bit to get it working.
What I did was created and led.py script and then set that to run on boot.

and then the led.py script has:

import subprocess
import os

# Define the paths to the two scripts you want to switch between
nfl = '/home/pi/nflscore/main.py'
nba = '/home/pi/nba-led-scoreboard/main.py'

def run_script(script_path, duration):
    try:
        # Run script
        process = subprocess.Popen(["python3", script_path])
        # print("Loading " + script_path)

        # Wait for the specified duration
        time.sleep(duration)
        # Terminate the subprocess
        process.terminate()

    except Exception as e:
        print(f"An unexpected error occurred: {e}")
        # Handle the unexpected error, for example, exit the script
        exit(1)

while True:
        # Run NBA
        print("Showing NBA Scoreboard")
        run_script(nba, 200)

         # Run NFL
         print("Showing NFL Scores")
         run_script(nfl, 100)

However for this to work I did have to edit the renderer files to change the paths for the logos. But maybe there is a way around that.

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

No branches or pull requests

2 participants