Fixtures live is a Fixture and League tracking website for thousands of sports clubs accross the country. This application uses Beautiful Soup to extract a teams recent results or upcoming fixtures from Fixtures Live. These are then added to an template, creating an image that is ready to be posted to social media to let your followers know of all your successes (or if you were robbed by the umpire 😬 )
Using containers Provided an isolated environment for the installation of chrome and chrome drivers without having to worry about any conflicts with existing packages on your machine. This is something I've often struggled with in the past when getting started with Beautiful Soup, and it has put me off exploring other projects. The overhead of getting started with this solutions is much less.
I've used docker, other container engines are avaiable 🙂
The Dockerfile has 3 main processes
The initial large run block handles the installing of chrome and chrome drivers.
If you're running this in the future, you may need to check that the latest chrome stable release is compatible with the chromedriver version in use.
Copying in and installing python dependencies before we copy in app source code increases the number of layer hash matches we'll get, and means we don't have to redownload all these dependencies every time we update some code in the app. These dependencies are only redownloaded when there is a new python requirement or a change in a higher level layer.
-e WHATSON_URL=https://w.fixtureslive.com/club/826/whats-on/Chertsey-Thames-Valley
The URL of the what's on Fixtures Live page the app targets
-e TYPE=fixtures
Must be one of 'fixtures' or 'results'
-e TEMPLATE=image.png
When this variable is passed, an image will only be created for this template. Otherwise an image will be created for each of the templates in your templates folder.
-v /your/dir:/templates
This folder contains all of your image templates
-v /your/dir:/output
This directory is where the images are going to be saved
-v /your/TeamMap.yml:/TeamMap.yml
This YAML file contains a map of the team name as it appears in Fixtures live to how you want it to appear in your image.
-v /your/this_weeks_teams.yml:/this_weeks_teams.yml
This contains a list of the teams you want to include in the image, one of the few parts of the process that I'm yet to automate.
It is needed for the case the a team was not playing this week but their results are still visible from last weeks games.
Image Sie - 1080px by 1080px
While the app will technically work with images of any size, text placement will not dynamically adjust to different sized images. Therefore I would recommend sticking to 1080px^2, which is a good resolution for a social media post.
This is an example fixtures post generated by the the application.