Python

Day Grouping in the Chat Log Parser!

Finally, I’ve added a feature to my chat log parser to group messages by day. It’s something I’ve wanted to be able to do for a while now. This took a bit of work to add a new data structure and update the HTML Jinja2 templates. But now the base of it is done and if I want, I can customise the styles.

Screenshot of Chat Log with day grouping

Oh hey Sunny!

Originally, I tried to do the day grouping inside the Jinja2 templates, but this proved rather difficult – I ended up spending hours in the library trying to work out nested loops inside a templating language. Eventually, I realised I should perform the day grouping on the data structure instead, so I just loop over each day, then created the minute bundles inside.

Technical Info!

Creating the day grouping in the ChatLog data structure turned out to be surprisingly easy:

Continue reading →

Posted by Anthony in chat log parser

Urban Dictionary Analysis Tool

A fun little exercise I’ve been doing is a statistical and language analysis tool to analyse Urban Dictionary.  The idea for the project came about when it was pointed out that my own name was on UD and I realised that many of the definitions were of a sexual nature or offering praise to the holder of the name. I suspect that people are adding definitions of either their own name, or their partners or relatives. I thought it would be fun to programmatically analyse the various definitions and group them by content, maybe also ranking the most popular keywords or other interesting statistics.

The finished (though I’ll add to it overtime) product is available here: https://www.acarrick.com/urban_stats

screenshot of Urban Stats tool.

Continue reading for some technical details….

Continue reading →

Posted by Anthony

Quick Project: Movies Database/Google Form

For a long time, I’ve wanted to create a database of the movies I have. Because I have movies scattered around on various media, I’d like to be able to point friends to a site where they can see all the movies I have, and I can look up to see what media it is available on. In my case, I have a PVR, a PVR on the Mac, some DVDs, and movies I’ve bought off Google Play.

Eventually, I realised that Google Forms just saves to a Google Sheets spreadsheet and I could use this spreadsheet to find the location, or share a link to it so my friends can pick a movie. I also figured that I could somehow script the act of responding to the Google Form or otherwise populate the data, reading the list of recordings on my Mac PVR from the filesystem.

After a bit of searching around, I came across this Reddit thread, How can I use Python to submit a Google Form (or write to a response spreadsheet)? which suggested the easiest way to submit the Google Form. With a bit of Python magic, I created a simple script to read the files and folders in a directory, and submit them straight to the Google Form!

Read on to find out how!

Continue reading →

Posted by Anthony in Short Projects

Short Project: Chat Log Parser

I’m using Viber to communicate with someone, and we have many chats. So I looked into Viber’s chat backup capability. I found that Viber has two backups — one that you can restore, and one that you can email. It turns out that the email-able backup is actually in CSV. And so I realised I could parse it very easily with Python; and use a templating module such as Jinja2 or Mako, format it into an easy to read HTML page.

Continue reading →

Posted by Anthony in chat log parser