Update functions/pitch_summary_functions.py
Browse files
functions/pitch_summary_functions.py
CHANGED
|
@@ -20,6 +20,14 @@ import matplotlib.pyplot as plt
|
|
| 20 |
import matplotlib.gridspec as gridspec
|
| 21 |
import PIL
|
| 22 |
from stuff_model import calculate_arm_angles as caa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
| 25 |
### PITCH COLOURS ###
|
|
@@ -928,7 +936,7 @@ def fangraphs_pitching_leaderboards(season: int,
|
|
| 928 |
print(start_date,end_date)
|
| 929 |
print(f'{season}-01-01',f'{season}-12-31')
|
| 930 |
|
| 931 |
-
if start_date_input == f'{season}-01-01' and end_date_input == f'{season}-12-31':
|
| 932 |
|
| 933 |
url = f"""
|
| 934 |
https://www.fangraphs.com/api/leaders/major-league/data?age=&pos=all&stats=pit&lg=all&season={season}&season1={season}
|
|
|
|
| 20 |
import matplotlib.gridspec as gridspec
|
| 21 |
import PIL
|
| 22 |
from stuff_model import calculate_arm_angles as caa
|
| 23 |
+
from datetime import datetime
|
| 24 |
+
|
| 25 |
+
def get_current_year():
|
| 26 |
+
return int(datetime.today().year)
|
| 27 |
+
|
| 28 |
+
# Example usage
|
| 29 |
+
print(get_current_year()) # Outputs: '2025' (or the current year)
|
| 30 |
+
|
| 31 |
|
| 32 |
|
| 33 |
### PITCH COLOURS ###
|
|
|
|
| 936 |
print(start_date,end_date)
|
| 937 |
print(f'{season}-01-01',f'{season}-12-31')
|
| 938 |
|
| 939 |
+
if (start_date_input == f'{season}-01-01' and end_date_input == f'{season}-12-31') and (season==get_current_year()):
|
| 940 |
|
| 941 |
url = f"""
|
| 942 |
https://www.fangraphs.com/api/leaders/major-league/data?age=&pos=all&stats=pit&lg=all&season={season}&season1={season}
|