Sport Schedules / GameTimes

Today I decided to add upcoming game times to The TouchBar. If anyone is interested how to add this, I would be happy to add the code once I'm complete.

Thank the lord! I've actually been looking everywhere for something like this, especially for NBA games. However, is there a possibility to obtain live scores on the Touch Bar as well?
Definitely interested and would greatly appreciate if you would share whenever you're finished. :slight_smile:

This is a simple widget. Basically, subscribe to the ical calendar for your sports teams, and that calendar name is pulled with my code, formatted and displayed. Just rename "Chicago Cubs Schedule" to your calendar schedule for your team. I changed the output a bit to include TV Channels.

tell application "BetterTouchTool"
    -----ic Code Your Calendar Name \"Chicago Cubs Schedule\"----
    
    set upcomingEvents to do shell script "/usr/local/bin/icalBuddy -ic \"Chicago Cubs Schedule\" -n -nc -ps \"|• |\" -iep \"title,datetime,location\" -po \"datetime,title,location\" -tf \"%1I:%M %p\" -df \"%b %d\" -ea -eed eventsToday+10 | head -n 1 | awk -F \"• \" '{print toupper(substr($2,1,1)) tolower(substr($2,2))\" -\" substr($3,4)\" ▶︎\" substr($4,19)}'"

    -- \" -\" substr($4,10) Gets the location field

    set maxSize to 80

    if length of upcomingEvents is greater than maxSize then
        --textoverflow
        set upcomingEvents to text 1 thru (maxSize - 3) of upcomingEvents & "..."
    else if upcomingEvents is "" then
        return "{\"text\":\" No Games Today \",\"font_color\": \"255,255,255,255\"}" -------------------AN OUTPUT
    end if

    set findReplace to upcomingEvents
    return "{\"text\":\" " & upcomingEvents & " \",\"font_color\": \"255,255,255,255\"}" -------------------AN OUTPUT
end tell

I could pull sports scores from a webpage/google, for me, Id have to hide them for a day later. If I can't see the game that night (Live or DVR). Don't like spoilers...

1 Like

Tip: you can use [code] [/code] to format code!

Done it for you.

1 Like

Hey, I'm very new to this whole touchbar thing but I really want this widget for myself as I'm a pretty big sports fan, I've subscribed to my team on ical and now I have all my team's games up on the calender, however, I need a couple more details as I'm not sure what to do next in order to have my games show up on my bar like yours, where do I paste your code? Do I have to change anything in your code so that it works for me? Thanks and sorry for ignorance!

You add the "button" (Apple Script Widget). Paste the code, changing the Ical Calendar Name "Chicago Cubs Schedule" to your own Calendar name you used in ical. As you can see in this image, I created a separate group for the sports calendars. Also there is now a NEW Even calendar widget built in, although very limited in scope compared to this, should be much easier for you to add your events.

Hope this helps, let me know...

Hey, I've tried to follow your instructions as best as I could, but still no luck. I have pasted in the code and replaced the name with my team name "Sporting" which is also what it is set to on ical for the game events. Here's a screenshot, and thanks for the help so far!!

Use the Apple Script Widget, not Run Apple Script. Also, you must have icalBuddy installed?

Requires iCalBuddy: https://hasseg.org/icalBuddy/

Nice thing about using this code compared to the new calendar widgets in BTT, for Sporting Events or any calendar with events you want to see well in advance of the due date. See the latest Touch Bar image below. Shows todays Cubs game, and Hockey for next week on the 16th. I use the code (eventsToday+10) to look 10 days in the future for an event. You can set this to any number of days you want. Compare to the BTT Widget which will only show todays events (wish he would add a Next Event Widget).

My Code:

BTT Calendar Event Widget

Apple Script Widget

Enjoy my work?

\ 45x45 crod463
August 24
How do you get the team logos?

I download the logos from the Internets.