/tinyletter

The Programs of the Week We Were Covered in a Heat Dome

This Week’s Program: July 18 - July 22

Stay cool out there friends. Make sure to stay hydrated on your Pokéwalks.

ab426b18ef39f45e52e8aa21488d533f0075ecc3

Feels so good to be back in Clojure! Here, at the end of the gen-song function, I do some core.async acrobatics so that the returning channel now returns a map of a bunch of the data used to generate the song.

0be52164506f1919125517ceb090d35403cfd492

In the make-recording macro, I now return a pair: the path to the recorded wav file, and that song data pulled out from the channel. Then, in my upload-to-s3 function, I merge the song data with some previous stuff and use that as the metadata for the s3 object. Now the s3 object knows everything about its own generation.

I also throw in a try/catch block — my first time using this with Clojure. If for whatever reason I get an error from the Forecast API, I log the error and continue song generation.

I tried shuffling logging functions around, but reverted that work.

b4b433c6d3404365f634d33d92b3ba91847ab171

I make sure that my CloudFormation Custom Resource that I use to establish the GitHub hook uses the deployment event, to ensure that auto-deployment works.

8527521a929a2f0fbf70d4426d777c4deda348db

I make it so that the first arg I pass to the main function is threaded through the application. This will be the s3 bucket for uploading songs.

cfc2e859a91b81dc45cfc4537181bea88caf8ab9

I make sure that when I do a CloudFormation delete, it retains the s3 bucket using the DeletionPolicy attribute. There might be songs in there!

536b2fabf6da85a61c36851dae29ea060655f68e

After creating the GitHub hook, I use its URL for CloudFormation’s resource ID attribute.

96ce7f68bf3322d2bae35a18d6fc4988ab855fa2

Now that I retain the hook URL as a CloudFormation resource, I can use that URL to issue a DELETE call to the GitHub API to clean up the hook when I delete the stack.

41eece52a18cc3d2839e220ae6a292840c8ee5c5

I ask for the Forecast API key in the params for CloudFormation.

More here to come. Still uncommitted: my experiments with cron. Next week, I’ll finish those experiments and have songs being generated on the regular. I have some more tweaks I want to make on the application and then comes what I anticipate will be quite challenging: getting those songs out from the s3 bucket and onto social media.

💦 Mark