Sport Schedules / GameTimes

#1

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.

0 Likes

#2

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:

0 Likes

#3

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

#4

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

Done it for you.

1 Like