My Music Listening Habits for March 2020

So, not a particularly exciting month in Music. Despite actual effort on my part, Sigrid still tops the chart by a large margin. Tessa Violet comes in second. I actually watched both of these artists doing online live(ish) shows due to the Corona-virus. Though the Sigrid segment of the Twitch Stream event was pre recorded and not actually live. Tessa Violet has been doing some live shows on Youtube.

The soundtracks for Gris and Journey both make a return. They are both pretty similar in feel and are really great for “general distraction free listening”. Lindsey Sterling also falls into this category really.

In newer releases, Dua Lipa has released the full Future Nostalgia album and it’s pretty good. Good enough to already make it up into this monthly list. I’ve also been trying to give Taylor Swift’s Lover another go, though it just isn’t doing it for me.

Lastly, and kind of out of left field is the Gin Blossoms. The Gin Blossoms are performing in town in a few months and I was listening to them as a bit of a refresher to help decide if I wanted to try to get tickets. At this point, with all the COVID mess, the show will probably get cancelled anyway, but I opted for no, for now. I do enjoy Gin Blossoms, but at the moment, not enough to go to a show.

In general my music listening is down a bit as I’ve been listening to more Podcasts again. Mostly This Week in Tech, Windows Weekly, and WTF@TFW which finally started putting out episodes again.

Varsity Blues, 1999 – 4/5

I really enjoy this movie. It’s not even particularly great of a film but I just really enjoy it. I think mostly it’s the music is great and the shots during the football game segments.

Tracking Covid-19 into a database using Python

At some point I need to do a little write up on my Home Dashboard Project, it’s inspired quite a few minor projects such as this one to make little web widgets. The dashboard is the simple part, it’s just dumping a database query into a table. Honestly, the script was easy too, because I adapted it from another script I built recently.

With COVID-19 all over the news, I wanted to add some stats to my dashboard for my state. Not so much because there aren’t already 1000 other places to get the numbers, but more to see if I could do it. The hardest part was finding a feed to stats. Then I found CovidTracking.com. Which has a nice little API. I then set to work adapting another script to pull from this API to dump stats for Illinois into the database. I am only interested in Illinois, but the script is built so the user can put a list of states into an array, and then it will loop through and add them all to the database.

The script is below, but this also requires some set up in SQL. Nothing complicated, mostly INT fields. an id as an int and primary key, negative_cases, positive_cases, and deaths, all as INT, state as a varchar with a length of 2, though technically the length is optional, then finally date_stamp as a DATETIME field with a default value of the current timestamp. The DATETIME isn’t directly touched here, but it makes it easier to manipulate the data later.

The code also requires you enter your database credentials. I’ve nammed my table “il_covid_stats, but you can change that to whatever you want down below in the “SQL = “INSERT….” line. I’ll leave it up to you what to do with the data, I pull mine into a PHP page.

Anyway, here is the python code:

# Python Covid Star Tracking to SQL
# use of json package
# Sample URL: https://covidtracking.com/api/states?state=IL

import json
import requests
import time
import MySQLdb

mydb = MySQLdb.connect(
  host="localhost",
  user="YOUR_DB_USERNAME",
  passwd="YOUR_DB_PASSWORD",
  database="YOUR_DB_NAME"
)
mycursor = mydb.cursor()
user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'

#States to check as an Array, two letter abbreviations
states = ['IL']

def data_getter(statename):
  ####when reading from remote URL
  url = 'https://covidtracking.com/api/states?state='+statename

  user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'
  headers = {'User-Agent': user_agent}
  response = requests.get(url,headers=headers)
  html = response.content
  statedata = json.loads(html)

  pos_cases = (statedata['positive'])
  neg_cases = (statedata['negative'])
  deaths = (statedata['death'])

  vals = (pos_cases,neg_cases,deaths,statename)

  mysqlinsert(vals)

def mysqlinsert(vals):
  ## This database name and columns can be changed but should be pre made in your database
  SQL = "INSERT INTO il_covid_stats (positive_cases, negative_cases, deaths, state) VALUES (%s, %s, %s, %s)"
  mycursor.execute(SQL, vals)
  mydb.commit()

# Loop through URLs for each state
for i in states:
  data_getter(i)