Skip to content

Commit

Permalink
hardcode league and urls since automatic fetching not working
Browse files Browse the repository at this point in the history
  • Loading branch information
md-arif-shaikh committed Jul 8, 2023
1 parent 556b043 commit 65e9d4c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
20 changes: 18 additions & 2 deletions soccer-leagues.el
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,24 @@
:group 'soccer
:link '(url-link :tag "Homepage" "https://github.com/md-arif-shaikh/soccer"))

(defvar soccer-leagues--leagues-alist)
(setq soccer-leagues--leagues-alist (soccer-leagues--get-competition-names-and-urls))
;;; The functions to fetch league and urls is not working anymore. Hardcoding some of these.
;;;(setq soccer-leagues--leagues-alist (soccer-leagues--get-competition-names-and-urls))
(defcustom soccer-leagues-leagues-alist '(("Premier League" . "https://www.theguardian.com/football/premierleague")
("La Liga" . "https://www.theguardian.com/football/laligafootball")
("Serie A" . "https://www.theguardian.com/football/serieafootball")
("Bundeshliga" . "https://www.theguardian.com/football/bundesligafootball")
("Ligue 1" . "https://www.theguardian.com/football/ligue1football")
("Champions League" . "https://www.theguardian.com/football/championsleague")
("FA Cup" . "https://www.theguardian.com/football/fa-cup")
("Carabao Cup" . "https://www.theguardian.com/football/carabao-cup")
("Championship" . "https://www.theguardian.com/football/championship")
("Europa League" . "https://www.theguardian.com/football/uefa-europa-league")
("Conference League" . "https://www.theguardian.com/football/europa-conference-league")
("MLS" . "https://www.theguardian.com/football/mls")
("Women's Super League" . "https://www.theguardian.com/football/womens-super-league"))
"Alist of league and urls."
:type '(alist :value-type (group integer))
:group 'soccer)

(provide 'soccer-leagues)

Expand Down
6 changes: 3 additions & 3 deletions soccer.el
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@
:group 'soccer-face)

(defun soccer--get-league-names ()
"Extract league names from `soccer-leagues--leagues-alist'."
(mapcar 'car soccer-leagues--leagues-alist))
"Extract league names from `soccer-leagues-leagues-alist'."
(mapcar 'car soccer-leagues-leagues-alist))

(defun soccer--get-league-url (league)
"Get url of a LEAGUE."
Expand Down Expand Up @@ -513,7 +513,7 @@
(defun soccer--all-clubs ()
"Get all club names."
(delete-dups (-flatten (cl-loop for leagues in (soccer--league-names)
collect (mapcar 'car (cdr (assoc leagues soccer-leagues--leagues-alist)))))))
collect (mapcar 'car (cdr (assoc leagues soccer-leagues-leagues-alist)))))))

(defun soccer-scorecard (date home away)
"Get the socrecard for a match between HOME and AWAY on a DATE. Enter DATE in YYYY-MM-DD format if entering it manually. If the input is from `org-read-date' calendar popup then it is in YYYY-MM-DD format by default."
Expand Down

0 comments on commit 65e9d4c

Please sign in to comment.