A Return to Television, sort of


Almost a year has passed since I left the TV station and pursued Web Development work full time. Things are going great, but now I’m starting another journey that has led me back to television. I am now the TD for the Sacramento Kings games on NBC Sports California. For now I’m doing mostly the home games, but as the season goes on I’ll also work on the visitor shows.

I started training in December and I just finished my first game by myself so I guess that makes it official. I’m still doing all my web development work and just doing the home games for the Kings. TDing was always my favorite and doing live Sports is fast, exciting, nerve racking, but ultimately a lot of fun.

Production Truck for NBCCA Kings Basketball

A big thanks to Ross for recommending me and everyone who helped along the way!

New Adventures

Today marks my final day working at a television station.

It’s been a long journey, with many interviews and jobs that I almost got. I’ve been working on my programming skills for several years. A little more than a month ago I got my first part-time Junior WordPress Developer position that I could do from home. It was the foot in the door I needed and the plan was to do that and the station until the next opportunity came along. As luck would have it that opportunity came about two weeks later. Another WordPress shop based out of Granite Bay needed developers.

I’ll be splitting my time between the two and already have plenty of work to keep me busy. After I get settled I’ll do some of the Granite Bay work remote as well. I’m very excited that both jobs are WordPress related so I can continue to build on my skills and contribute to the community. Last fall I gave my first tech talk at WordCamp Sacramento. While I don’t have a talk for this years WordCamp I did join the organizational committee and will be managing the photographer volunteers.

With the new jobs I’ll be able to wake at a normal hour and have weekend off. And have weekends off. And have weekends off! Between my jobs at the movie theater and the tv stations I’ve never had weekends. Pearl and I are looking forward to having a similar schedule and even making weekend trips (I’m looking at you Santa Cruz!).

I’m very happy for the time and opportunities I’ve had, but it’s time to make a change and look towards the future.

Local Timings Application


In my day job working at a local television station I spend time in Master Control monitoring our five stations that we broadcast. Two of these are sub-channels that play out old movies and tv shows from a network feed. The network sends a pulse when its time for our local break to air and for the most part it works without problem.

But occasionally a break is missed.

We can get a PDF of that days log and find the exact time our break should roll from the affiliate portal. Then we have to search the log to find the line that is for the local break. Some people prefer to do this ahead of time and leave notes in the playlist so we know when a break is approaching and when it’s been missed.

To do so they would print out a ~30 page PDF and go through manually finding all the local times.

I knew this repetitive task was asking for some automation.

Basic Structure

Since the application was going to be so small I decided to start from scratch and not use any framework. I would use a simple form to upload the PDF file and then use PHP to work with the uploaded file.

I knew I needed to parse the PDF so I found pdfparser by Sebastien Malot. This takes the PDF file and converts it into one giant string.

Now I needed to search through that text and pull out all of the local break times.

The Regex

$regex = "/([0-9]{1,2}:[0-9]{2}:[0-9]{2})\s(AM|PM|XM)\s{0,1}\*{3}\s{0,3}\ *{1,2}LOCAL.*?([0-9]{1,2}:[0-9]{2})/";

The text that I would need to search for is:

8:18:03 AM *** *LOCAL AFFILIATE BREAK 2:00 ***

First I need to grab the time that break occurs, allowing for the first digit to be one or two numbers in length. Then I need to collect the AM, PM, or XM (side note: our logs begin at 4am so the hours from midnight until 4am are referred to as XM).

The stars and spaces after the time are not consistent across different days so I needed to allow for some variance in their number. I only search for the work LOCAL because some breaks are LOCAL/CABLE breaks which we also get, so I include the .*? regex to find everything until the next time.

Then I collect the length of the break similarly to the collecting of the first time.

Here is my final regex:

Some of the problems were found after a couple days of testing so I had to update it when the results were no longer consistent. I used preg_match_all to find all the matches and assign it to a new array that I could loop through to print to the screen.

Loading Spinner

At first I used a simple css spinner for the loading process. Because the PDF file is large it can take 5-10 seconds before the final results are printed. Since there was so much time I wanted to make a fancier loader and made this little guy:

See the Pen TV Color Bars Loading Screen by Anthony Skelton (@ajskelton) on CodePen.

I use a simple onClick javascript event that adds a full screen div with the above svg. It’s not vital to the project but it does make it fun.

The Code

If you want to see the project or use it for your own purpose check it out on github. Be warned I did a lot of it quickly and didn’t spend a lot of time cleaning up things. It works great so I don’t really need to go back to it unless I want to practice some refactoring.