Categories
Uncategorized

Matchplay Posting

I post the results from the pinball tournaments I run on our site, which usually involves copying a previous post and updating all the info by hand. I took some time this week to put together a script that reads the results from matchplay and builds a post with all the right info.

It’s not enough to publish as a git repo or anything and I just wanted to have a place to keep it so it’s here for now.

ben@odin ~> cat ~/bin/tcpp
#!/bin/sh

playersjson=$(curl -s "https://app.matchplay.events/api/tournaments/$1?includePlayers=1" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json")

finalsId=$(printf %s "$playersjson" | jq -r ".data.linkedTournamentId")
standingsids=$(curl -s "https://app.matchplay.events/api/tournaments/$finalsId/standings" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    | jq -r '.[] | .playerId')

d=$(printf %s "$playersjson" | jq -r ".data.startUtc")
shortdate=$(date --date "$d" +"%B %-d")
ifpa=$(curl -s 'https://api.ifpapinball.com/v1/calendar/search?api_key=GET_YOUR_OWN&address=Traverse%20City&m=3')
ifpatourney=$(printf %s "$ifpa" | jq -r ".calendar[] | select(.start_date == \"$(date --date "$d" +"%F")\").tournament_id")

author=1
excerpt="Results for $shortdate tourney"

case $(date --date "$d" +"%a") in
    Thu)
        categories="58,54"
        ;;
    Mon)
        categories="58,52"
        ;;
    Sun)
        categories="58,51"
        author=8
        excerpt="Results for the $shortdate Belles tourney"
        ;;
    *)
        categories="4"
        ;;
esac

player1=$(printf %s "$playersjson" | jq -r ".data.players | .[] | select(.playerId == $(printf %s "$standingsids" | head -n1 | tail -n1)).name")
player2=$(printf %s "$playersjson" | jq -r ".data.players | .[] | select(.playerId == $(printf %s "$standingsids" | head -n2 | tail -n1)).name")
player3=$(printf %s "$playersjson" | jq -r ".data.players | .[] | select(.playerId == $(printf %s "$standingsids" | head -n3 | tail -n1)).name")
player4=$(printf %s "$playersjson" | jq -r ".data.players | .[] | select(.playerId == $(printf %s "$standingsids" | head -n4 | tail -n1)).name")

printf "https://tcpinball.org/wp-admin/post.php?action=edit&post="
sudo -Hu www-data wp --path=/var/www/tcpinball.org \
    post create \
    --post_author="$author" \
    --post_category="$categories" \
    --post_title="$shortdate Results" \
    --post_excerpt="$excerpt" \
    --post_status=draft \
    --porcelain \
    --post_content="<!-- wp:paragraph -->
<p>Format: Group Match Play</p>
<!-- /wp:paragraph -->

<!-- wp:table {\"hasFixedLayout\":false} -->
<figure class=\"wp-block-table\"><table><thead><tr><th>Place</th><th>Player</th></tr></thead><tbody><tr><td>1st</td><td>$player1</td></tr><tr><td>2nd</td><td>$player2</td></tr><tr><td>3rd</td><td>$player3</td></tr><tr><td>4th</td><td>$player4</td></tr></tbody></table></figure>
<!-- /wp:table -->

<!-- wp:paragraph -->
<p>See the full results on <a href=\"https://app.matchplay.events/tournaments/$1\">Match Play</a> - <a href=\"https://app.matchplay.events/tournaments/$finalsId\">Finals</a> (<a href=\"https://www.ifpapinball.com/tournaments/view.php?t=$ifpatourney\">IFPA</a>).</p>
<!-- /wp:paragraph -->
"

Results table was built by dumping the content from a previous post.

Categories
Uncategorized

Solar Ride Paint Restoration

This is our pinball machine. We’ve owned it for about 3 years at this point.
One of the previous owners covered the cabinet for some reason with this faux woodgrain paintjob. I’ve been meaning to do something with it since we got it and today happened to be that time.

My buddy Joey sent me a text the other day after he saw it for the first time offering to help me get it restored so of course I took him up on it.

It’s not done yet but we made a good amount of progress with some light sanding and latex paint remover.

Bonus dog in this pic. It’s in pretty good condition under the 2 layers of paint and at least one layer of a clear coat. Looking forward to seeing the finished product!

Categories
Uncategorized

Keep it Simple

I run two weekly pinball tournaments here in Traverse City (https://tcpinball.org/) which we submit to the IFPA for global rankings.

The IFPA charges a $1 per player fee to be “sanctioned”. This fee is generously sponsored by each location that we run tournaments at. Thinking it’d be easy enough to pull back the player counts later on, I put the fee payments on my credit card and figured I’d get reimbursed later on.

This is what the stats page shows on IFPA, which is not useful to me, but it shows I’ve paid $568 as of this date in fees. I need to know how much each location owes me.

I spent probably 4 hours yesterday digging through the API docs for matchplay and the IFPA directly trying to get a count of players by location.

I ended up writing some code which didn’t quite solve it either. The list of tournaments that it gives back doesn’t include the player count, meaning I have to make another API call to get the player details for each tournament. I got rate-limited almost immediately just testing it.

While the data I need might not be accessible via the APIs, it’s right here on my TD page in a nice little table. Queue another hour of trying to parse the HTML with several different tools.

The brain blast came as I was eating dinner. Stop trying to parse it and just paste it into a spreadsheet. Works immediately. Save as a CSV and import to a sqlite db.

sqlite> .mode csv
sqlite> .import ifpa.csv ifpa
sqlite> select sum(players) from ifpa where tournament like '%coin slot%';
436
sqlite> select sum(players) from ifpa where tournament like '%right brain%';
148

I could’ve figured out how to match this up with a calculated column in the spreadsheet but the important feature there was just parsing the HTML from my clipboard.

Major props to spreadsheets and sqlite yet again!

Categories
Uncategorized

Pinball Expo Day Three

Got to play Elton John right away in the morning when the line was the shortest. Shoots wonderfully. Steve Ritchie is back, baby! I put up over 200M and got on the board. Four multiballs started and Joe Katz started calling shots for me. What a blast!

Played some more Pulp Fiction. Also shoots nice and the single-level layout is very cool. Excited to have this on location soon.

Also got to play Big Lebowski. Gorgeous pin with great theme integration. Also played a game of the bowling-only mode in the sub-playfield.

Categories
Uncategorized

Pinball Expo Day Two

Played all the Atari pins I could find. Five of them (including Hercules but I didn’t play the one they had there because we have one at right brain).

Galactic Tank Force is cool. I really love the theme and was fully convinced it was a real show at some point. We went to the panel with the cast and got some more stories of how it was made.

Star Wars home pin is silly. The screen is so small.

Categories
Uncategorized

Pinball Expo Day One

Some photos and notes from day 1 of expo:

Started out with the Stern factory tour. They recently moved into a new, bigger factory building. It’s Huge.

I liked seeing the process from individual parts to a finished pin, but the vibes were off. I don’t think a single factory worker was white. I don’t recall seeing a designer/programmer/etc that wasn’t white. Let alone the crowds being led through the building gawking at the whole process.

The Jersey Jack tour last year wasn’t much better for this dynamic, but the scale was quite a big smaller.

Got to play Pulp Fiction and even met Mark Ritchie in the line to play it. Played Labyrinth after chatting with Bowen Kerins. I learned that pinball isn’t even his full-time job!

Tons of cool homebrews on the floor and even a transparent cabinet build for an EM.

Saw a couple talks including a panel of some folks that built Pulp Fiction. It’s been in the works for over a decade. Quentin Tarantino is as strange as suspected.

There was a screening of the Pinball film including a lovely intro by Roger Sharpe and Michael Gottlieb. If you haven’t seen it, I highly recommend it!

Categories
Uncategorized

Pinball Expo Day 1 (zero?)

Drove down to pinball expo today. Disappointed with the communication on the pre-expo tournament. I ended up on the waitlist and didn’t know it started at 4pm!

Played some silly arcade games and a round or two on galactic tank force.

Also signed up for the mains tournament and played my first couple qualifying games. Terrible scores but I have plenty of submissions left.

Categories
Uncategorized

VFW Pinball 2023

I just got home from vfw. It’s a pinball museum outside Ann Arbor in a former VFW that houses the private collection of Clay Harrell. Over 500 pins across 3 different buildings. The true pinball mecca!

Here’s a selection of the photos I took over the weekend. Click to view larger and see descriptions.