diff --git a/.gitignore b/.gitignore index 5c53e354..7da86b2b 100644 --- a/.gitignore +++ b/.gitignore @@ -131,7 +131,7 @@ dmypy.json .pyre/ # ignore generated logos -assets/logos/*/light/* +assets/logos/* !assets/logos/svg/light/* #nhl-led-scoreboard diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 615aafb0..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "python.pythonPath": "/usr/bin/python3" -} \ No newline at end of file diff --git a/README.md b/README.md index a5f094a0..a9b04b12 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,8 @@ JJ ## Description This is a Python software made to display NHL live scores, stats, and more of your favorite teams, on a Raspberry Pi driven RGB LED matrix. An LED matrix panel (also called a Dot led matrix or dot matrix) is a panel of LEDs used to build huge displays as you see in arenas, malls, time square, etc... +## Disclaimer +This project relies on an undocumented NHL API which is also what nhl.com use. The data is not always accurate and might have delays and errors that's out of our control. ## Tutorials from other source >"I followed instructions from somewhere else and I'm having issues" @@ -173,9 +175,13 @@ this page. [Raspbian Buster Lite Installation](https://medium.com/@danidudas/install-raspbian-jessie-lite-and-setup-wi-fi-without-access-to-command-line-or-using-the-network-97f065af722e) + #### Time Zones Before you start installing anything, make sure your raspberry pi is set to your local time zone. Usually, you do so when you install Raspian, but if you think you skipped that part, you can change it by running `sudo raspi-config` +#### Intalling Git +You will need to install Git on your raspberry pi in order to download the software. To do so, run this command. +`sudo apt install git` #### Installing the NHL scoreboard software This installation process might take some time because it will install all the dependencies listed below. @@ -195,16 +201,12 @@ If it's a first install of the software, there is no config.json only a config.j #### Updating your software. -If you undate from any version that was released **before V1.0.0**, run these commands to update. `git reset --hard` `git checkout master` -`sudo git pull` +`git pull` `sudo chmod +x scripts/install.sh` `sudo ./scripts/install.sh`. -If your board runs **any V1 version**, simply run the install like so. -`sudo chmod +x scripts/install.sh` -`sudo ./scripts/install.sh` If you face any issue after updating, rerun the install and it should fix it. otherwise check the issue section to see if a solution as been found for your problem. If not open an issue and I'll find a solution. diff --git a/VERSION b/VERSION index 94fe62c2..9075be49 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.5.4 +1.5.5 diff --git a/assets/animations/goal_light_animation.gif b/assets/animations/goal_light_animation.gif index b2e53b08..bda9ad36 100644 Binary files a/assets/animations/goal_light_animation.gif and b/assets/animations/goal_light_animation.gif differ diff --git a/assets/images/64x32_scoreboard_center_gradient.png b/assets/images/64x32_scoreboard_center_gradient.png new file mode 100644 index 00000000..f57d35f8 Binary files /dev/null and b/assets/images/64x32_scoreboard_center_gradient.png differ diff --git a/assets/logos/ARI/light/64x32.png b/assets/logos/ARI/light/64x32.png deleted file mode 100644 index 58c2f990..00000000 Binary files a/assets/logos/ARI/light/64x32.png and /dev/null differ diff --git a/assets/logos/BOS/light/64x32.png b/assets/logos/BOS/light/64x32.png deleted file mode 100644 index 1405a81c..00000000 Binary files a/assets/logos/BOS/light/64x32.png and /dev/null differ diff --git a/assets/logos/CAR/light/64x32.png b/assets/logos/CAR/light/64x32.png deleted file mode 100644 index c5ffbc60..00000000 Binary files a/assets/logos/CAR/light/64x32.png and /dev/null differ diff --git a/assets/logos/CBJ/light/64x32.png b/assets/logos/CBJ/light/64x32.png deleted file mode 100644 index 68d5f3dc..00000000 Binary files a/assets/logos/CBJ/light/64x32.png and /dev/null differ diff --git a/assets/logos/CGY/light/64x32.png b/assets/logos/CGY/light/64x32.png deleted file mode 100644 index e300e6d5..00000000 Binary files a/assets/logos/CGY/light/64x32.png and /dev/null differ diff --git a/assets/logos/CHI/light/64x32.png b/assets/logos/CHI/light/64x32.png deleted file mode 100644 index f315c90f..00000000 Binary files a/assets/logos/CHI/light/64x32.png and /dev/null differ diff --git a/assets/logos/COL/light/64x32.png b/assets/logos/COL/light/64x32.png deleted file mode 100644 index ec7db668..00000000 Binary files a/assets/logos/COL/light/64x32.png and /dev/null differ diff --git a/assets/logos/DAL/light/64x32.png b/assets/logos/DAL/light/64x32.png deleted file mode 100644 index 530a675e..00000000 Binary files a/assets/logos/DAL/light/64x32.png and /dev/null differ diff --git a/assets/logos/DET/light/64x32.png b/assets/logos/DET/light/64x32.png deleted file mode 100644 index ed9f08a8..00000000 Binary files a/assets/logos/DET/light/64x32.png and /dev/null differ diff --git a/assets/logos/EDM/light/64x32.png b/assets/logos/EDM/light/64x32.png deleted file mode 100644 index 5a4c7b55..00000000 Binary files a/assets/logos/EDM/light/64x32.png and /dev/null differ diff --git a/assets/logos/FLA/light/64x32.png b/assets/logos/FLA/light/64x32.png deleted file mode 100644 index e73b4bed..00000000 Binary files a/assets/logos/FLA/light/64x32.png and /dev/null differ diff --git a/assets/logos/LAK/light/64x32.png b/assets/logos/LAK/light/64x32.png deleted file mode 100644 index e560dec6..00000000 Binary files a/assets/logos/LAK/light/64x32.png and /dev/null differ diff --git a/assets/logos/MIN/light/64x32.png b/assets/logos/MIN/light/64x32.png deleted file mode 100644 index df508083..00000000 Binary files a/assets/logos/MIN/light/64x32.png and /dev/null differ diff --git a/assets/logos/NJD/light/64x32.png b/assets/logos/NJD/light/64x32.png deleted file mode 100644 index 727d078c..00000000 Binary files a/assets/logos/NJD/light/64x32.png and /dev/null differ diff --git a/assets/logos/NSH/light/64x32.png b/assets/logos/NSH/light/64x32.png deleted file mode 100644 index 49e2ec32..00000000 Binary files a/assets/logos/NSH/light/64x32.png and /dev/null differ diff --git a/assets/logos/NYI/light/64x32.png b/assets/logos/NYI/light/64x32.png deleted file mode 100644 index cdec00fc..00000000 Binary files a/assets/logos/NYI/light/64x32.png and /dev/null differ diff --git a/assets/logos/NYR/light/64x32.png b/assets/logos/NYR/light/64x32.png deleted file mode 100644 index ac30dc35..00000000 Binary files a/assets/logos/NYR/light/64x32.png and /dev/null differ diff --git a/assets/logos/PHI/light/64x32.png b/assets/logos/PHI/light/64x32.png deleted file mode 100644 index 11b77c7a..00000000 Binary files a/assets/logos/PHI/light/64x32.png and /dev/null differ diff --git a/assets/logos/PIT/light/64x32.png b/assets/logos/PIT/light/64x32.png deleted file mode 100644 index 04048371..00000000 Binary files a/assets/logos/PIT/light/64x32.png and /dev/null differ diff --git a/assets/logos/SJS/light/64x32.png b/assets/logos/SJS/light/64x32.png deleted file mode 100644 index 29675581..00000000 Binary files a/assets/logos/SJS/light/64x32.png and /dev/null differ diff --git a/assets/logos/STL/light/64x32.png b/assets/logos/STL/light/64x32.png deleted file mode 100644 index f7c14c5d..00000000 Binary files a/assets/logos/STL/light/64x32.png and /dev/null differ diff --git a/assets/logos/TBL/light/64x32.png b/assets/logos/TBL/light/64x32.png deleted file mode 100644 index 1d5518e3..00000000 Binary files a/assets/logos/TBL/light/64x32.png and /dev/null differ diff --git a/assets/logos/TOR/light/64x32.png b/assets/logos/TOR/light/64x32.png deleted file mode 100644 index 0d1fb8ea..00000000 Binary files a/assets/logos/TOR/light/64x32.png and /dev/null differ diff --git a/assets/logos/VAN/light/64x32.png b/assets/logos/VAN/light/64x32.png deleted file mode 100644 index 45e51fe0..00000000 Binary files a/assets/logos/VAN/light/64x32.png and /dev/null differ diff --git a/assets/logos/VGK/light/64x32.png b/assets/logos/VGK/light/64x32.png deleted file mode 100644 index 88f2c1a7..00000000 Binary files a/assets/logos/VGK/light/64x32.png and /dev/null differ diff --git a/assets/logos/WPG/light/64x32.png b/assets/logos/WPG/light/64x32.png deleted file mode 100644 index 84722cf9..00000000 Binary files a/assets/logos/WPG/light/64x32.png and /dev/null differ diff --git a/assets/logos/WSH/light/64x32.png b/assets/logos/WSH/light/64x32.png deleted file mode 100644 index 33d03fdd..00000000 Binary files a/assets/logos/WSH/light/64x32.png and /dev/null differ diff --git a/assets/logos/svg/light/ANA_light.svg b/assets/logos/svg/light/ANA_light.svg deleted file mode 100644 index 8f740aa6..00000000 --- a/assets/logos/svg/light/ANA_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/ARI_light.svg b/assets/logos/svg/light/ARI_light.svg deleted file mode 100644 index c6056b4d..00000000 --- a/assets/logos/svg/light/ARI_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/BOS_light.svg b/assets/logos/svg/light/BOS_light.svg deleted file mode 100644 index a1c8674c..00000000 --- a/assets/logos/svg/light/BOS_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/BUF_light.svg b/assets/logos/svg/light/BUF_light.svg deleted file mode 100644 index 0ccc2415..00000000 --- a/assets/logos/svg/light/BUF_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/CAR_light.svg b/assets/logos/svg/light/CAR_light.svg deleted file mode 100644 index ae3a805e..00000000 --- a/assets/logos/svg/light/CAR_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/CBJ_light.svg b/assets/logos/svg/light/CBJ_light.svg deleted file mode 100644 index 39c7246f..00000000 --- a/assets/logos/svg/light/CBJ_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/CGY_light.svg b/assets/logos/svg/light/CGY_light.svg deleted file mode 100644 index 27813eab..00000000 --- a/assets/logos/svg/light/CGY_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/CHI_light.svg b/assets/logos/svg/light/CHI_light.svg deleted file mode 100644 index a9d5f16d..00000000 --- a/assets/logos/svg/light/CHI_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/COL_light.svg b/assets/logos/svg/light/COL_light.svg deleted file mode 100644 index 5d702fa0..00000000 --- a/assets/logos/svg/light/COL_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/DAL_light.svg b/assets/logos/svg/light/DAL_light.svg deleted file mode 100644 index f7219c66..00000000 --- a/assets/logos/svg/light/DAL_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/DET_light.svg b/assets/logos/svg/light/DET_light.svg deleted file mode 100644 index 54f918a9..00000000 --- a/assets/logos/svg/light/DET_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/EDM_light.svg b/assets/logos/svg/light/EDM_light.svg deleted file mode 100644 index a785ea9f..00000000 --- a/assets/logos/svg/light/EDM_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/FLA_light.svg b/assets/logos/svg/light/FLA_light.svg deleted file mode 100644 index e8b82829..00000000 --- a/assets/logos/svg/light/FLA_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/LAK_light.svg b/assets/logos/svg/light/LAK_light.svg deleted file mode 100644 index 4c86c048..00000000 --- a/assets/logos/svg/light/LAK_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/MIN_light.svg b/assets/logos/svg/light/MIN_light.svg deleted file mode 100644 index 101bacb0..00000000 --- a/assets/logos/svg/light/MIN_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/MTL_light.svg b/assets/logos/svg/light/MTL_light.svg deleted file mode 100644 index ce7397a4..00000000 --- a/assets/logos/svg/light/MTL_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/NJD_light.svg b/assets/logos/svg/light/NJD_light.svg deleted file mode 100644 index 53b7b750..00000000 --- a/assets/logos/svg/light/NJD_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/NSH_light.svg b/assets/logos/svg/light/NSH_light.svg deleted file mode 100644 index f5241efe..00000000 --- a/assets/logos/svg/light/NSH_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/NYI_light.svg b/assets/logos/svg/light/NYI_light.svg deleted file mode 100644 index d062714b..00000000 --- a/assets/logos/svg/light/NYI_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/NYR_light.svg b/assets/logos/svg/light/NYR_light.svg deleted file mode 100644 index 83e167e3..00000000 --- a/assets/logos/svg/light/NYR_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/OTT_light.svg b/assets/logos/svg/light/OTT_light.svg deleted file mode 100644 index cb1a7850..00000000 --- a/assets/logos/svg/light/OTT_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/PHI_light.svg b/assets/logos/svg/light/PHI_light.svg deleted file mode 100644 index db957938..00000000 --- a/assets/logos/svg/light/PHI_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/PIT_light.svg b/assets/logos/svg/light/PIT_light.svg deleted file mode 100644 index 35b3f135..00000000 --- a/assets/logos/svg/light/PIT_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/SEA_light.svg b/assets/logos/svg/light/SEA_light.svg deleted file mode 100644 index 24faaba0..00000000 --- a/assets/logos/svg/light/SEA_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/SJS_light.svg b/assets/logos/svg/light/SJS_light.svg deleted file mode 100644 index 98e8de2d..00000000 --- a/assets/logos/svg/light/SJS_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/STL_light.svg b/assets/logos/svg/light/STL_light.svg deleted file mode 100644 index eb5b6900..00000000 --- a/assets/logos/svg/light/STL_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/TBL_light.svg b/assets/logos/svg/light/TBL_light.svg deleted file mode 100644 index 1e903730..00000000 --- a/assets/logos/svg/light/TBL_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/TOR_light.svg b/assets/logos/svg/light/TOR_light.svg deleted file mode 100644 index 84802f42..00000000 --- a/assets/logos/svg/light/TOR_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/VAN_light.svg b/assets/logos/svg/light/VAN_light.svg deleted file mode 100644 index 5fef4ba3..00000000 --- a/assets/logos/svg/light/VAN_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/VGK_light.svg b/assets/logos/svg/light/VGK_light.svg deleted file mode 100644 index 4c84ff1e..00000000 --- a/assets/logos/svg/light/VGK_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/WPG_light.svg b/assets/logos/svg/light/WPG_light.svg deleted file mode 100644 index ad850263..00000000 --- a/assets/logos/svg/light/WPG_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logos/svg/light/WSH_light.svg b/assets/logos/svg/light/WSH_light.svg deleted file mode 100644 index a78c99a3..00000000 --- a/assets/logos/svg/light/WSH_light.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/config/colors/teams.json b/config/colors/teams.json index 19df8b2b..9d24b637 100644 --- a/config/colors/teams.json +++ b/config/colors/teams.json @@ -74,13 +74,13 @@ "7": { "primary": { "r": 0, - "g": 38, - "b": 84 + "g": 48, + "b": 135 }, "text":{ - "r": 252, - "g": 181, - "b": 20 + "r": 243, + "g": 208, + "b": 62 } }, "8": { @@ -389,5 +389,33 @@ "g": 62, "b": 126 } + }, + "east":{ + "primary": { + "r": 0, + "g": 140, + "b": 85 + } + }, + "west":{ + "primary": { + "r": 0, + "g": 98, + "b": 179 + } + }, + "central":{ + "primary": { + "r": 216, + "g": 102, + "b": 31 + } + }, + "north":{ + "primary": { + "r": 202, + "g": 24, + "b": 38 + } } } \ No newline at end of file diff --git a/config/config.json.save b/config/config.json.save new file mode 100644 index 00000000..4a957edc --- /dev/null +++ b/config/config.json.save @@ -0,0 +1,141 @@ +{ + "debug": false, + "loglevel": "INFO", + "live_mode": false, + "preferences": { + "time_format": "12h", + "end_of_day": "8:00", + "location": "", + "live_game_refresh_rate": 10, + "teams": [ + "Canadiens" + ], + "sog_display_frequency": 4, + "goal_animations": { + "pref_team_only": true + } + }, + "states": { + "off_day": [ + "covid_19", + "standings", + "weather", + "clock" + ], + "scheduled": [ + "team_summary", + "standings", + "scoreticker", + "clock" +s ], + "intermission": [ + "scoreticker", + "team_summary" + ], + "post_game": [ + "team_summary", + "standings", + "scoreticker", + "clock" + ] + }, + "boards": { + "scoreticker": { + "preferred_teams_only": false, + "rotation_rate": 5 + }, + "seriesticker": { + "preferred_teams_only": true, + "rotation_rate": 5 + }, + "standings": { + "preferred_standings_only": true, + "standing_type": "wild_card", + "divisions": "central", + "conference": "eastern" + }, + "clock": { + "duration": 15, + "hide_indicator": false, + "preferred_team_colors": true, + "clock_rgb": "", + "date_rgb": "", + "flash_seconds": true + }, + "covid19": { + "worldwide_enabled": false, + "country_enabled": false, + "country": [ + "USA" + ], + "us_state_enabled": false, + "us_state": [ + "New York" + ], + "canada_enabled": false, + "canada_prov": [ + "Quebec" + ] + }, + "weather": { + "enabled": false, + "view": "full", + "units": "metric", + "duration": 60, + "data_feed": "EC", + "owm_apikey": "", + "update_freq": 5, + "show_on_clock": true, + "forecast_enabled": true, + "forecast_days": 3, + "forecast_update": 1 + }, + "wxalert": { + "alert_feed": "EC", + "update_freq": 5, + "show_alerts": true, + "nws_show_expire": false, + "alert_title": true, + "scroll_alert": true, + "alert_duration": 5, + "show_on_clock": true + } + }, + "sbio": { + "screensaver": { + "enabled": false, + "animations": true, + "start": "22:00", + "stop": "22:05", + "data_updates": false, + "motionsensor": true, + "pin": 24, + "delay": 30 + }, + "dimmer": { + "enabled": false, + "source": "software", + "daytime": "", + "nighttime": "", + "offset": 90, + "frequency": 5, + "light_level_lux": 400, + "mode": "always", + "sunset_brightness": 5, + "sunrise_brightness": 40 + }, + "pushbutton": { + "enabled": false, + "bonnet": false, + "pin": 25, + "reboot_duration": 2, + "reboot_override_process": "", + "display_reboot": true, + "poweroff_duration": 10, + "poweroff_override_process": "", + "display_halt": true, + "state_triggered1": "weather", + "state_triggered1_process": "" + } + } +} diff --git a/config/layout/layout.json b/config/layout/layout.json index 1534b9c1..8966d156 100755 --- a/config/layout/layout.json +++ b/config/layout/layout.json @@ -12,6 +12,17 @@ } }, "scoreboard": { + "center_top":{ + "position": ["50%", 0], + "align": "center-top" + }, + "relative_center_top": { + "position": [0, 2], + "relative": { + "to": "center_top", + "align": "center-bottom" + } + }, "home_logo": { "position": [["50%", 15], 0], "align": "left" diff --git a/config/layout/layout_128x64.json b/config/layout/layout_128x64.json index 30a9971a..3359450e 100755 --- a/config/layout/layout_128x64.json +++ b/config/layout/layout_128x64.json @@ -12,13 +12,24 @@ } }, "scoreboard": { + "center_top":{ + "position": ["50%", 0], + "align": "center-top" + }, + "relative_center_top": { + "position": [0, 2], + "relative": { + "to": "center_top", + "align": "center-bottom" + } + }, "home_logo": { - "position": ["100%", 0], - "align": "right" + "position": [["50%", 15], 0], + "align": "left" }, "away_logo": { - "position": [0, 0], - "align": "left" + "position": [["50%", -15], 0], + "align": "right" }, "vs": { "position": ["50%", "45%"], @@ -35,20 +46,29 @@ "align": "center-top" }, "scheduled_time": { - "position": ["50%", 6], - "align": "center-top" + "position": [0, 2], + "relative": { + "to": "scheduled_date", + "align": "center-bottom" + } }, "clock": { - "position": ["50%", 6], - "align": "center-top" + "position": [0, 2], + "relative": { + "to": "period", + "align": "center-bottom" + } }, "period": { "position": ["50%", 0], "align": "center-top" }, "period_final": { - "position": ["50%", 6], - "align": "center-top" + "position": [0, 2], + "relative": { + "to": "center_top", + "align": "center-bottom" + } }, "SOG_label": { "position": ["50%", 0], @@ -59,8 +79,11 @@ "align": "center-top" }, "irregular_status": { - "position": ["50%", 6], - "align": "center-top" + "position": [0, 2], + "relative": { + "to": "center_top", + "align": "center-bottom" + } } }, diff --git a/config/layout/logos.json b/config/layout/logos.json index 98289878..85f725e8 100644 --- a/config/layout/logos.json +++ b/config/layout/logos.json @@ -17,31 +17,21 @@ "position": [0, 0], "flip": 0, "rotate": 0, - "crop": [0, 0, 0, 0] - }, - "TOR": { + "crop": [0, 0, 0, 0], + "home": { - "zoom": "90%", - "position": [-2, 0] + "zoom": "100%", + "position": [0, 0], + "flip": 0, + "rotate": 0, + "crop": [0, 0, 0, 0] }, "away": { - "position": [2, 0] - } - }, - "ANA": { - "home": { - "zoom": "70%", - "position": [-5, "15%"] - }, - "away": { - "zoom": "80%", - "position": [5, "10%"] - } - }, - "PIT": { - "away": { - "zoom": "80%", - "position": [5, "10%"] + "zoom": "100%", + "position": [0, 0], + "flip": 0, + "rotate": 0, + "crop": [0, 0, 0, 0] } } } diff --git a/config/layout/logos_64x32.json b/config/layout/logos_64x32.json new file mode 100644 index 00000000..1b9a089e --- /dev/null +++ b/config/layout/logos_64x32.json @@ -0,0 +1,349 @@ +{ + "team_summary": { + "logos": { + "_default": { + "zoom": "100%", + "position": [0, 0], + "flip": 0, + "rotate": 0, + "crop": [0, 0, 0, 0] + } + } + }, + "scoreboard": { + "logos": { + "_default": { + "zoom": "100%", + "position": [0, 0], + "flip": 0, + "rotate": 0, + "crop": [0, 0, 0, 0], + + "home": { + "zoom": "100%", + "position": [0, 0], + "flip": 0, + "rotate": 0, + "crop": [0, 0, 0, 0] + }, + "away": { + "zoom": "100%", + "position": [0, 0], + "flip": 0, + "rotate": 0, + "crop": [0, 0, 0, 0] + } + }, + "ANA": { + "home": { + "zoom": "80%", + "position": [-22, 3] + }, + "away": { + "zoom": "80%", + "position": [7, 3] + } + }, + "ARI": { + "home": { + "zoom": "100%", + "position": [-14, 0] + }, + "away": { + "zoom": "100%", + "position": [3, 0] + } + }, + "BOS": { + "home": { + "zoom": "100%", + "position": [-4, 0] + }, + "away": { + "zoom": "100%", + "position": [4, 0] + } + }, + "BUF": { + "home": { + "zoom": "100%", + "position": [-4, 0] + }, + "away": { + "zoom": "100%", + "position": [4, 0] + } + }, + "CGY": { + "home": { + "zoom": "100%", + "position": [-16, 0] + }, + "away": { + "zoom": "100%", + "position": [5, 0] + } + }, + "CAR": { + "home": { + "zoom": "100%", + "position": [-16, 0] + }, + "away": { + "zoom": "100%", + "position": [15, 0] + } + }, + "CHI": { + "home": { + "zoom": "100%", + "position": [-4, 0] + }, + "away": { + "zoom": "100%", + "position": [20, 0] + } + }, + "COL": { + "home": { + "zoom": "100%", + "position": [-5, 0] + }, + "away": { + "zoom": "100%", + "position": [5, 0] + } + }, + "CBJ": { + "home": { + "zoom": "100%", + "position": [-15, 0] + }, + "away": { + "zoom": "100%", + "position": [8, 0] + } + }, + "DAL": { + "home": { + "zoom": "100%", + "position": [-10, 0] + }, + "away": { + "zoom": "100%", + "position": [12, 0] + } + }, + "DET": { + "home": { + "zoom": "100%", + "position": [-5, 0] + }, + "away": { + "zoom": "100%", + "position": [24, 0] + } + }, + "EDM": { + "home": { + "zoom": "100%", + "position": [-3, 0] + }, + "away": { + "zoom": "100%", + "position": [3, 0] + } + }, + "FLA": { + "home": { + "zoom": "100%", + "position": [-3, 0] + }, + "away": { + "zoom": "100%", + "position": [3, 0] + } + }, + "LAK": { + "home": { + "zoom": "90%", + "position": [-1, 2] + }, + "away": { + "zoom": "90%", + "position": [1, 2] + } + }, + "MIN": { + "home": { + "zoom": "100%", + "position": [-20, 0] + }, + "away": { + "zoom": "100%", + "position": [13, 0] + } + }, + "MTL": { + "home": { + "zoom": "90%", + "position": [-3, 2] + }, + "away": { + "zoom": "90%", + "position": [3, 2] + } + }, + "NJD": { + "home": { + "zoom": "100%", + "position": [-4, 0] + }, + "away": { + "zoom": "100%", + "position": [4, 0] + } + }, + "NSH": { + "home": { + "zoom": "85%", + "position": [-25, 3] + }, + "away": { + "zoom": "85%", + "position": [8, 3] + } + }, + "NYI": { + "home": { + "zoom": "100%", + "position": [-3, 0] + }, + "away": { + "zoom": "100%", + "position": [3, 0] + } + }, + "NYR": { + "home": { + "zoom": "100%", + "position": [-3, 0] + }, + "away": { + "zoom": "100%", + "position": [3, 0] + } + }, + "OTT": { + "home": { + "zoom": "100%", + "position": [-22, 0] + }, + "away": { + "zoom": "100%", + "position": [3, 0] + } + }, + "PHI": { + "home": { + "zoom": "90%", + "position": [-21, 2] + }, + "away": { + "zoom": "90%", + "position": [8, 2] + } + }, + "PIT": { + "home": { + "zoom": "100%", + "position": [-3, 0] + }, + "away": { + "zoom": "100%", + "position": [18, 0] + } + }, + "SJS": { + "home": { + "zoom": "100%", + "position": [-16, 0] + }, + "away": { + "zoom": "100%", + "position": [7, 0] + } + }, + "STL": { + "home": { + "zoom": "100%", + "position": [-4, 0] + }, + "away": { + "zoom": "100%", + "position": [20, 0] + } + }, + "TBL": { + "home": { + "zoom": "100%", + "position": [-3, 0] + }, + "away": { + "zoom": "100%", + "position": [5, 0] + } + }, + "TOR": { + "home": { + "zoom": "100%", + "position": [-4, 0] + }, + "away": { + "zoom": "100%", + "position": [4, 0] + } + }, + "VAN": { + "home": { + "zoom": "100%", + "position": [-17, 0] + }, + "away": { + "zoom": "100%", + "position": [5, 0] + } + }, + "VGK": { + "home": { + "zoom": "100%", + "position": [-2, 0] + }, + "away": { + "zoom": "100%", + "position": [2, 0] + } + }, + "WSH": { + "home": { + "zoom": "120%", + "position": [-5, -3] + }, + "away": { + "zoom": "120%", + "position": [40, -3] + } + }, + "WPG": { + "home": { + "zoom": "100%", + "position": [-2, 0] + }, + "away": { + "zoom": "100%", + "position": [2, 0] + } + } + } + } +} \ No newline at end of file diff --git a/config/logos.json b/config/logos.json new file mode 100644 index 00000000..648626ba --- /dev/null +++ b/config/logos.json @@ -0,0 +1,3 @@ +{ + "_default": "light" +} \ No newline at end of file diff --git a/nhl_setup b/nhl_setup index 052ffe8f..38785278 100755 Binary files a/nhl_setup and b/nhl_setup differ diff --git a/src/boards/screensaver.py b/src/boards/screensaver.py index b23471b5..5a613836 100644 --- a/src/boards/screensaver.py +++ b/src/boards/screensaver.py @@ -68,13 +68,14 @@ def draw_screenSaver(self): show_gif = False else: # Fade to black - - while b >=0: - self.matrix.set_brightness(self.brightness) - self.brightness = b - self.matrix.render() - b -= 1 - sleep(0.1) + # If user doesn't use dimmer or brightness on command line + if b is not None: + while b >=0: + self.matrix.set_brightness(self.brightness) + self.brightness = b + self.matrix.render() + b -= 1 + sleep(0.1) self.matrix.clear() self.matrix.draw.rectangle([0,0, self.matrix.width, self.matrix.height], fill=(0,0,0)) diff --git a/src/boards/standings.py b/src/boards/standings.py index 932bb623..b1807bf1 100644 --- a/src/boards/standings.py +++ b/src/boards/standings.py @@ -227,7 +227,7 @@ def draw_standing(data, name, records, img_height, width): # Create a new data image. image = Image.new('RGB', (width, img_height)) draw = ImageDraw.Draw(image) - + team_colors = data.config.team_colors """ Each record info is shown in a row of 7 pixel high. The initial row start at pixel 0 (top screen). For each team's record we add an other row and increment the row position by the height of a row plus the @@ -236,8 +236,9 @@ def draw_standing(data, name, records, img_height, width): row_pos = 0 row_height = 7 top = row_height - 1 # For some reason, when drawing with PIL, the first row is not 0 but -1 - - draw.text((1, 0), name, font=layout.font) + div_bg_color = team_colors.color("{}.primary".format(name)) + draw.rectangle((0,0,63,6), fill=(div_bg_color['r'], div_bg_color['g'], div_bg_color['b'])) + draw.text((1, 0), name, font=layout.font, fill=(0,0,0)) row_pos += row_height for team in records: @@ -247,7 +248,6 @@ def draw_standing(data, name, records, img_height, width): wins = team['leagueRecord']['wins'] losses = team['leagueRecord']['losses'] ot = team['leagueRecord']['ot'] - team_colors = data.config.team_colors bg_color = team_colors.color("{}.primary".format(team_id)) txt_color = team_colors.color("{}.text".format(team_id)) draw.rectangle([0, top + row_pos, 12, row_pos], fill=(bg_color['r'], bg_color['g'], bg_color['b'])) diff --git a/src/config/file.py b/src/config/file.py index 041130db..d39b3c58 100644 --- a/src/config/file.py +++ b/src/config/file.py @@ -3,9 +3,10 @@ import copy class ConfigFile: - def __init__(self, path, size=None): + def __init__(self, path, size=None, warn_if_missing=True): self.path = path self.size = size + self.warn_if_missing = warn_if_missing self.load() @@ -16,7 +17,8 @@ def load(self): self.data = JSONData(self.json, self.size) except: - print('Config file {} not found!'.format(self.path)) + if (self.warn_if_missing): + print('Config file {} not found!'.format(self.path)) def save(self): with open(self.path, 'w') as f: diff --git a/src/config/files/fonts.py b/src/config/files/fonts.py index af5dcf95..c2bed072 100644 --- a/src/config/files/fonts.py +++ b/src/config/files/fonts.py @@ -5,7 +5,7 @@ class FontsConfig: def __init__(self, size): self.config = ConfigFile('config/fonts/fonts.json') - self.dynamic_config = ConfigFile('config/fonts/fonts_{}x{}.json'.format(size[0], size[1]), size) + self.dynamic_config = ConfigFile('config/fonts/fonts_{}x{}.json'.format(size[0], size[1]), size, False) self.config.combine(self.dynamic_config) diff --git a/src/config/files/layout.py b/src/config/files/layout.py index 1cd6a36c..e724a83c 100644 --- a/src/config/files/layout.py +++ b/src/config/files/layout.py @@ -3,14 +3,16 @@ class LayoutConfig: def __init__(self, size, fonts): self.layout = ConfigFile('config/layout/layout.json', size) - self.dynamic_layout = ConfigFile('config/layout/layout_{}x{}.json'.format(size[0], size[1]), size) - self.colors = ConfigFile('config/colors/layout.json') - self.fonts = fonts - + self.dynamic_layout = ConfigFile('config/layout/layout_{}x{}.json'.format(size[0], size[1]), size, False) # Combine layout for current size with the base layout, overwriting any values found self.layout.combine(self.dynamic_layout) self.logo_config = ConfigFile('config/layout/logos.json', size) + self.dynamic_logo_config = ConfigFile('config/layout/logos_{}x{}.json'.format(size[0], size[1]), size, False) + self.logo_config.combine(self.dynamic_logo_config) + + self.colors = ConfigFile('config/colors/layout.json') + self.fonts = fonts def get_board_layout(self, board): layouts = self.layout.data @@ -44,10 +46,13 @@ def get_scoreboard_logo(self, team, board, gameLocation): logo = self.logo_config.data.scoreboard.logos._default.__copy__() logos = self.logo_config.data[board].logos - + + conf_set = logos["_default"] if (team in logos): - logo.__merge__(logos[team]) - if (gameLocation != None and gameLocation in logos[team]): - logo.__merge__(logos[team][gameLocation], overwrite=True) + conf_set = logos[team] + + logo.__merge__(conf_set, overwrite=True) + if (gameLocation != None and gameLocation in conf_set): + logo.__merge__(conf_set[gameLocation], overwrite=True) return logo diff --git a/src/config/files/logos.py b/src/config/files/logos.py new file mode 100644 index 00000000..d5e39fc5 --- /dev/null +++ b/src/config/files/logos.py @@ -0,0 +1,13 @@ +from config.file import ConfigFile + +class LogosConfig: + def __init__(self): + self.config = ConfigFile('config/logos.json') + + def get_team_logo(self, team): + logos = self.config.data + + if (team in logos): + return logos[team] + + return logos["_default"] \ No newline at end of file diff --git a/src/config/main.py b/src/config/main.py index b624d06f..ff2edc90 100644 --- a/src/config/main.py +++ b/src/config/main.py @@ -2,9 +2,11 @@ from config.files.layout import LayoutConfig from config.files.settings import SettingsConfig from config.files.fonts import FontsConfig +from config.files.logos import LogosConfig class Config: def __init__(self, size): self.settings = SettingsConfig() self.fonts = FontsConfig(size) - self.layout = LayoutConfig(size, self.fonts) \ No newline at end of file + self.layout = LayoutConfig(size, self.fonts) + self.logos = LogosConfig() \ No newline at end of file diff --git a/src/data/scoreboard.py b/src/data/scoreboard.py index 23c67dd0..493a6b0c 100755 --- a/src/data/scoreboard.py +++ b/src/data/scoreboard.py @@ -93,10 +93,10 @@ def __init__(self, overview, data): # If the request to the API fails,return an empty list of goal plays. # This method is there to prevent the goal board to display the wrong info for play in away_scoring_plays: - players = get_goal_players(play['players'], data) - if players: + try: + players = get_goal_players(play['players'], data) away_goal_plays.append(Goal(play, players)) - else: + except KeyError: debug.error("Failed to get Goal details for current live game. will retry on data refresh") away_goal_plays = [] break @@ -104,10 +104,10 @@ def __init__(self, overview, data): # If the request to the API fails,return an empty list of goal plays # This method is there to prevent the goal board to display the wrong info for play in home_scoring_plays: - players = get_goal_players(play['players'], data) - if players: + try: + players = get_goal_players(play['players'], data) home_goal_plays.append(Goal(play,players)) - else: + except KeyError: debug.error("Failed to get Goal details for current live game. will retry on data refresh") home_goal_plays = [] break diff --git a/src/images/image_helper.py b/src/images/image_helper.py index a5b9615c..c1124c69 100644 --- a/src/images/image_helper.py +++ b/src/images/image_helper.py @@ -4,7 +4,6 @@ class ImageHelper: def image_from_svg(url): - print(url) out = BytesIO() cairosvg.svg2png(url=url, write_to=out) img = Image.open(out) diff --git a/src/main.py b/src/main.py index 2a9bbafa..f1430c5a 100644 --- a/src/main.py +++ b/src/main.py @@ -25,7 +25,7 @@ SCRIPT_NAME = "NHL-LED-SCOREBOARD" -SCRIPT_VERSION = "1.5.4" +SCRIPT_VERSION = "1.5.5" def run(): diff --git a/src/nhl_api/info.py b/src/nhl_api/info.py index e0b70331..502b251c 100644 --- a/src/nhl_api/info.py +++ b/src/nhl_api/info.py @@ -133,7 +133,8 @@ def standings(): #wildcard = data_wildcard['records'] for division in range(len(divisions)): team_records = divisions[division]['teamRecords'] - division_name = divisions[division]['division']['name'] + division_full_name = divisions[division]['division']['name'].split() + division_name = division_full_name[-1] #conference_name = divisions[division]['conference']['name'] for team in range(len(team_records)): diff --git a/src/nhl_setup/nhl_setup.py b/src/nhl_setup/nhl_setup.py index 73a1f498..3ae102ff 100755 --- a/src/nhl_setup/nhl_setup.py +++ b/src/nhl_setup/nhl_setup.py @@ -15,7 +15,7 @@ from time import sleep -SCRIPT_VERSION = "1.5.0" +SCRIPT_VERSION = "1.5.1" TEAMS = ['Avalanche','Blackhawks','Blues','Blue Jackets','Bruins','Canadiens','Canucks','Capitals','Coyotes','Devils','Ducks','Flames','Flyers', 'Golden Knights','Hurricanes','Islanders','Jets','Kings','Maple Leafs','Lightning','Oilers','Panthers','Penguins','Predators', @@ -51,7 +51,9 @@ class RGBValidator(Validator): def validate(self, document): r = r"(\d+),\s*(\d+),\s*(\d+)" #ok = regex.match('^(\d+),\s*(\d+),\s*(\d+)$', document.text) - ok = all(0 <= int(group) <= 255 for group in re.match(r, document.text).groups()) + ok = False + if re.match(r,document.text) is not None: + ok = all(0 <= int(group) <= 255 for group in re.match(r, document.text).groups()) if not ok: raise ValidationError( message='Please enter a valid RGB tuple (r,g,b)', @@ -545,7 +547,7 @@ def states_settings(default_config,qmark,setup_type): thestates = STATES for astate in thestates: - board_list = ['clock','weather','wxalert','scoreticker','seriesticker','standings','team_summary','covid_19','stanley_cup_champions','christmas'] + board_list = ['clock','weather','wxalert','wxforecast','scoreticker','seriesticker','standings','team_summary','covid_19','stanley_cup_champions','christmas'] boards_selected = [] board = None diff --git a/src/renderer/logos.py b/src/renderer/logos.py index ae408b19..b399d1bb 100644 --- a/src/renderer/logos.py +++ b/src/renderer/logos.py @@ -6,12 +6,13 @@ from utils import round_normal PATH = 'assets/logos' -LOGO_NAME = 'light' -LOGO_URL = 'assets/logos/svg/{}/{}_{}.svg' +LOGO_URL = 'https://assets.nhle.com/logos/nhl/svg/{}_{}.svg' class LogoRenderer: def __init__(self, matrix, config, element_layout, team_abbrev, board, gameLocation=None): self.matrix = matrix + + self.logo_name = config.config.logos.get_team_logo(team_abbrev) self.layout = config.config.layout.get_scoreboard_logo( team_abbrev, board, @@ -31,7 +32,7 @@ def get_size(self): def get_path(self, team_abbrev): size = self.get_size() return get_file('{}/{}/{}/{}x{}.png'.format( - PATH, team_abbrev, LOGO_NAME, + PATH, team_abbrev, self.logo_name, size[0], size[1] )) @@ -67,7 +68,7 @@ def save_image(self, filename, team_abbrev): raise self.logo = ImageHelper.image_from_svg( - LOGO_URL.format(LOGO_NAME,team_abbrev, LOGO_NAME) + LOGO_URL.format(team_abbrev, self.logo_name) ) self.logo.thumbnail(self.get_size()) diff --git a/src/renderer/main.py b/src/renderer/main.py index ad3191dd..f3e64388 100755 --- a/src/renderer/main.py +++ b/src/renderer/main.py @@ -31,8 +31,7 @@ def render(self): if self.data.config.testing_mode: debug.info("Rendering in Testing Mode") while True: - self._draw_goal_animation() - ScoreboardRenderer(self.data, self.matrix, Scoreboard(self.data.games[0], self.data)).render() + ScoreboardRenderer(self.data, self.matrix, Scoreboard(self.data.games[1], self.data)).render() self.matrix.render() data.refresh.daily(self.data) sleep(15) @@ -78,15 +77,15 @@ def render(self): self.data.refresh_data() except AttributeError as e: - debug.log(f"ERROR WHILE RENDERING: {e}") - debug.log("Refreshing data in a minute") + debug.info(f"ERROR WHILE RENDERING: {e}") + debug.info("Refreshing data in a minute") self.boards.fallback(self.data, self.matrix, self.sleepEvent) self.data.refresh_data() def __render_offday(self): while True: - debug.log('PING !!! Render off day') + debug.info('PING !!! Render off day') if self.data._is_new_day(): debug.info('This is a new day') data.refresh.daily(self.data) diff --git a/src/renderer/matrix.py b/src/renderer/matrix.py index babf7dc3..c8cda8bf 100644 --- a/src/renderer/matrix.py +++ b/src/renderer/matrix.py @@ -179,6 +179,8 @@ def draw_rectangle(self, position, size, color): "position": position, "size": size } + + def draw_pixel(self, position, color): try: diff --git a/src/renderer/scoreboard.py b/src/renderer/scoreboard.py index e477a96f..2cba7500 100644 --- a/src/renderer/scoreboard.py +++ b/src/renderer/scoreboard.py @@ -10,6 +10,7 @@ def __init__(self, data, matrix, scoreboard, shot_on_goal=False): self.layout = self.data.config.config.layout.get_board_layout('scoreboard') self.font = self.data.config.layout.font self.font_large = self.data.config.layout.font_large + self.team_colors = data.config.team_colors self.scoreboard = scoreboard self.matrix = matrix self.show_SOG = shot_on_goal @@ -33,9 +34,20 @@ def __init__(self, data, matrix, scoreboard, shot_on_goal=False): def render(self): self.matrix.clear() + # bg_away = self.team_colors.color("{}.primary".format(self.scoreboard.away_team.id)) + # bg_home = self.team_colors.color("{}.primary".format(self.scoreboard.home_team.id)) + # self.matrix.draw_rectangle((0,0), (64,64), (bg_away['r'],bg_away['g'],bg_away['b'])) + # self.matrix.draw_rectangle((64,0), (128,64), (bg_home['r'],bg_home['g'],bg_home['b'])) + self.matrix.draw_rectangle((0,0), (32,32), (0,0,0)) self.away_logo_renderer.render() + self.matrix.draw_rectangle((32,0), (64,32), (0,0,0)) self.home_logo_renderer.render() - + + #self.matrix.draw.polygon([(37,0), (91,0), (80,64), (48,64)], fill=(0,0,0)) + #Work in progress. testing gradients + gradient = Image.open(get_file('assets/images/64x32_scoreboard_center_gradient.png')) + self.matrix.draw_image((32,0), gradient, align="center") + if self.status.is_scheduled(self.scoreboard.status): self.draw_scheduled() @@ -64,11 +76,13 @@ def draw_scheduled(self): self.layout.scheduled_time, start_time ) + self.matrix.draw_text_layout( self.layout.vs, 'VS' ) + self.matrix.render() def draw_live(self): @@ -108,14 +122,10 @@ def draw_final(self): result = self.scoreboard.periods.clock score = '{}-{}'.format(self.scoreboard.away_team.goals, self.scoreboard.home_team.goals) date = convert_date_format(self.scoreboard.date) - - #Work in progress. testing gradients - #gradient = Image.open(get_file('assets/images/scoreboard_center_gradient.png')) - #self.matrix.draw_image((64,0), gradient, align="center") # Draw the info self.matrix.draw_text_layout( - self.layout.scheduled_date, + self.layout.center_top, date ) @@ -142,7 +152,7 @@ def draw_irregular(self): # Draw the text on the Data image. self.matrix.draw_text_layout( - self.layout.scheduled_date, + self.layout.center_top, 'TODAY' ) self.matrix.draw_text_layout( diff --git a/src/sbio/screensaver.py b/src/sbio/screensaver.py index a54d1ee3..da3d6beb 100644 --- a/src/sbio/screensaver.py +++ b/src/sbio/screensaver.py @@ -49,7 +49,11 @@ def __init__(self, data, matrix,sleepEvent, scheduler): def runSaver(self): #Launch screen saver board, then Fade off brightness to 0 if not self.data.screensaver_livegame: - debug.info("Screen saver started.... Currently displayed board " + self.data.curr_board) + if self.data.curr_board is not None: + debug.info("Screen saver started.... Currently displayed board " + self.data.curr_board) + else: + debug.info("Screen saver started.... Currently displayed board is not set") + self.data.screensaver = True self.sleepEvent.set() else: @@ -67,7 +71,10 @@ def runSaver(self): def stopSaver(self): #Stop screen saver board, Fade brightness back to last setting - debug.info("Screen saver stopped.... Starting next displayed board " + self.data.prev_board) + if self.data.prev_board is not None: + debug.info("Screen saver stopped.... Starting next displayed board " + self.data.prev_board) + else: + debug.info("Screen saver stopped.... Starting next displayed board (not set)") #Resume all paused jobs if not self.data.config.screensaver_data_updates: @@ -85,8 +92,10 @@ def stopSaver(self): i = 0 - while i <= self.original_brightness: - self.matrix.set_brightness(i) - i += 1 - sleep(0.1) + # If user doesn't use dimmer or brightness on command line, don't fade in + if self.original_brightness is not None: + while i <= self.original_brightness: + self.matrix.set_brightness(i) + i += 1 + sleep(0.1) diff --git a/src/utils.py b/src/utils.py index f99ff269..555e14ef 100644 --- a/src/utils.py +++ b/src/utils.py @@ -83,6 +83,8 @@ def args(): help="Shows the current refresh rate of the LED panel.") parser.add_argument("--led-slowdown-gpio", action="store", help="Slow down writing to GPIO. Range: 0..4. (Default: 1)", choices=range(5), type=int) + parser.add_argument("--led-limit-refresh", action="store", + help="Limit refresh rate to this frequency in Hz. Useful to keep a constant refresh rate on loaded system. 0=no limit. Default: 0", default=0, type=int) parser.add_argument("--led-no-hardware-pulse", action="store", help="Don't use hardware pin-pulse generation.") parser.add_argument("--led-rgb-sequence", action="store", help="Switch if your matrix has led colors swapped. (Default: RGB)", default="RGB", type=str) @@ -93,6 +95,7 @@ def args(): parser.add_argument("--led-multiplexing", action="store", help="Multiplexing type: 0 = direct; 1 = strip; 2 = checker; 3 = spiral; 4 = Z-strip; 5 = ZnMirrorZStripe; 6 = coreman; 7 = Kaler2Scan; 8 = ZStripeUneven. (Default: 0)", default=0, type=int) + parser.add_argument("--led-panel-type", action="store", help="Needed to initialize special panels. Supported: 'FM6126A'", default="", type=str) parser.add_argument("--terminal-mode", action="store", help="Run on terminal instead of matrix. (Default: False)", default=False, type=bool) parser.add_argument("--updatecheck", action="store_true", help="Check for updates (Default: False)", default=False) @@ -122,6 +125,7 @@ def led_matrix_options(args): options.pwm_lsb_nanoseconds = args.led_pwm_lsb_nanoseconds options.led_rgb_sequence = args.led_rgb_sequence options.panel_type = args.led_panel_type + options.limit_refresh_rate_hz = args.led_limit_refresh try: options.pixel_mapper_config = args.led_pixel_mapper except AttributeError: