Musings of a dad with too much time on his hands and not enough to do. Wait. Reverse that.

Tag: tools (Page 17 of 35)

Windows PowerToys

There are a few good articles out there on Windows PowerToys–Microsoft’s return to authoring little, helpful utilities for those looking to work more effectively in their Windows environments.

As of this writing, three utilities come bundled with the project: FancyZones, PowerRename, and Shortcut Guide (although Shortcut Guide is less a utility and more a handy cheatsheet on the cool shortcuts you can trigger with the Windows key on your keyboard).

The tool I’m really looking forward to is PowerLauncher. This tool purports to be an application launcher on par with the likes of Launchy and WoX. Currently, I’m a big user of SlickRun. It’s handy and very flexible. If I can’t get SlickRun to perform a particular action, I can always wrap the action with a PowerShell or batch script and have SlickRun launch that. I’ve used SlickRun for years, but I think it’s high time Microsoft themselves provide a more flexible way to launch applications and other actions from the keyboard–there’s clearly a market for it.

I don’t see any timelines for the release of the utility, but I will be eagerly checking in on the github page for updates.

Tracking your reading time

I’ve alluded to my interest in reading a few times in the past. Several years ago, I made the switch from physical books to digital and use an Amazon Kindle as my main reading vehicle.

One frustration I have with the Kindle, though, is either its inability to track the reading time metrics I’m interested in collecting or its poor way of sharing those metrics with data nerds like me.

Earlier in the year, I decided to spend more than five minutes solving this problem and found out about Kindle FreeTime. Kindle FreeTime is an application on Kindle devices with the primary focus of getting kids to read. Parents can use FreeTime to decide what books their children can read and what minimum daily reading goals they want their children to meet. A side benefit of FreeTime, though, is that it captures a lot of the metrics I’m interested in in a SQLite database: all you have to do is plug your kindle into your workstation, download the database at system\freetime\freetime.db, and start exploring.

Dayinfo

One of the tables in the FreeTime database is dayinfo. This is probably a good place to start gathering some general reading metrics. Here’s how I went about digging into the data.

Load all the standard packages

In my notebook, I started by loading all the normal packages I use including the sqlite3 package:

import pandas as pd
import numpy as np
import sqlite3
from datetime import datetime
import matplotlib.pyplot as plt

%matplotlib inline

Load and clean the data from the table

Next, I queried the data from the dayinfo table and added a few helpful columns:

conn = sqlite3.connect('./data/freetime.db')
query = "SELECT * FROM dayinfo;"

df_dayinfo = pd.read_sql_query(query,conn)

# clean up fields and do some feature engineering
df_dayinfo['accessdate'] = pd.to_datetime(df_dayinfo.accessdate)
df_dayinfo['access_month'] = df_dayinfo.accessdate.dt.month
df_dayinfo['access_dow'] = df_dayinfo.accessdate.dt.dayofweek
df_dayinfo['read_mins'] = df_dayinfo.timeread / 60
df_dayinfo['read_hours'] = df_dayinfo.timeread / 3600

Calculate some preliminary metrics

Finally, I wanted to calculate my total reading time for the year 2019 and my average daily reading time. I only started using FreeTime in March 2019, so I had to pro-rate some of my calculations. Here’s what I came up with:

df_dayinfo_2019 = df_dayinfo[(df_dayinfo.accessdate > datetime(2019, 1, 1)) & (df_dayinfo.accessdate < datetime(2020, 1, 1))]
days_in_2019 = (df_dayinfo_2019.accessdate.max() - df_dayinfo_2019.accessdate.min()).days

print('From {0:%d %b %Y} to {1:%d %b %Y} ({2} days):'.format(df_dayinfo_2019.accessdate.min(), 
                                                             df_dayinfo_2019.accessdate.max(), days_in_2019))
print('I read {0:.2f} hours'.format(df_dayinfo_2019.read_hours.sum()))
print("That's an average of {0:.2f} minutes per day".format((df_dayinfo_2019.read_mins.sum())/days_in_2019))
From 10 Mar 2019 to 29 Dec 2019 (294 days):
I read 111.18 hours
That's an average of 22.69 minutes per day

Bah! Only 22 minutes reading time per day on average?! Well, I know one goal I’ll need to work on for 2020. Lets see what this data looks like in some charts:

fig, ax = plt.subplots(figsize=(10, 8))
df_dayinfo_2019[['access_month', 'read_hours']].sort_values('access_month').groupby('access_month').sum().plot.bar(ax=ax)
_ = ax.set_title('Hours Read by Month: {0:%d %b %Y} to {1:%d %b %Y}'.format(df_dayinfo_2019.accessdate.min(), 
                                                                            df_dayinfo_2019.accessdate.max()))
_ = ax.set_xlabel('Month')
_ = ax.set_ylabel('Hours')
My monthly reading totals starting in March: May was a good month
fig, ax = plt.subplots(figsize=(10, 8))
df_dayinfo_2019[['access_dow', 'read_hours']].sort_values('access_dow').groupby('access_dow').sum().plot.bar(ax=ax)
_ = ax.set_title('Hours Read by Day of Week: {0:%d %b %Y} to {1:%d %b %Y}'.format(df_dayinfo_2019.accessdate.min(), 
                                                                                  df_dayinfo_2019.accessdate.max()))
_ = ax.set_xlabel('Day of Week')
_ = ax.set_ylabel('Hours')

_ = ax.set_xticklabels(['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'])

I read the most on Wednesdays. That makes sense because most of my Wednesday evenings in Spring are sitting in the parking lot outside a bandroom while my kid practices with his middle school orchestra. I get a lot of reading time in on those days.

There are other tables in the database including details on each of the books that I’ve read over the year. Hopefully, at some point, I’ll dig in to those details, as well. But for now, this data is sufficient to get me motivated to read more in 2020.

One big 2019 accomplishment

I’ve blogged in the past about the importance of recording your family events and periodically consolidating that work into a polished product for the world–or at least your family and friends–to see.

To that end, I’m now on my twelfth year of creating an annual family video where I painstakingly go through a year’s worth of family pictures, video, artwork, and awards to highlight my family’s accomplishments in an 80 minute montage of clips and fun segues. Here’s a short summary of that work:

My works average about 84 minutes year after year. You may also notice the missing years 2007 and 2008. After all the effort I expelled compiling my 2006 video, I spent the next two years saying, “never again”! I convinced myself to jump back into the fray in 2009 and kept at it ever since.

What sort of effort are we talking about?

I haven’t tabulated the total hours of effort I invest into culling my media for the few minutes of baskets, goals, and solos, but my efforts do span several weeks and consume much of my end-of-year vacation days.

Typically, I start with an outline–a text file. I start going through the year’s worth of media I’ve collected and note the major scenes or sections: for example, basketball season, soccer season, instrumental/choir recitals, family vacation, birthday celebrations, etc. Once I’ve decided on my scenes, I try to decide on how to order them in my outline. For the most part, I try to stick to a chronological order, but if I find that one of my children is the focus in multiple back-to-back scenes, I will try to intersperse those scenes with others that focus on another child, so as to dispel any sense of favoritism in the final product.

Once I have my outline, I wrap it with intro and outro scenes. These scenes allow me a small level of creativity. For my intros, I try to mimic one you might see in a television show or movie. I find some snazzy music bed, play a quick sequence of photos of the family members with fancy transitions over it, and end the quick 30 second intro with a nifty title of the video: something about our family and our goings-on over the year.

Again attempting to mimic conventional outros in the mainstream, I try to find an upbeat, family-friendly song and run a bunch of photos of the members from the year on top of it. I do forgo the credits piece as I tend to be the producer, directory, key grip, and best boy all in one.

With my outline set, the real work begins watching hours of footage to pull out just the highlights. In years past, I would work through the outline in order: building my intro scene and working all the way through to my outro scene. This year, though, I decided to work out-of-order, trying to knock out some of the harder scenes first. I think this proved to be pretty successful and I’ll probably take the same approach next year.

How much media do you really have?

Maybe next year, I’ll try to tally up the minutes and hours I spend assembly the final product. Starting with this year, though, I decided I wanted to at least tally up the number of hours and minutes of raw footage I must sift through to do my work. To do this, I needed to find an easy way to collect duration times of all my media files.

When I wrote my Music to Drive By solution, I wrote a PowerShell script that, in part, tallied up the duration of all the MP3 files it wrote to my thumb drive as an output to the console. That script is soooo slow. Surely there have been new, speedier innovations in capturing media file durations in both PowerShell and Windows since then. Nope. None that I can find, anyway.

WSL, ftw

So, I decided to see what I could do in the Windows Subsystem for Linux. There are many options out there and I decide to give the MediaInfo utility a try based on this helpful post. MediaInfo can only look at one media file at a time, but that same post included some very helpful Bash code to let me loop through directories of my media files and total their durations in miliseconds. Here’s, roughly, the Bash script I came up with:

let total_duration_ms=0
for media_file in /mnt/extdrv/qsync_backup/Videos/2019/*/*/*.{mp3,mp4,mov,wav,MP3,MP4,MOV,WAV}; do
        if [ -f "$media_file" ]; then
                total_duration_ms=$(expr $total_duration_ms + $(mediainfo --Inform="General;%Duration%" "$media_file"))
        fi
done
echo $total_duration_ms

One other item I should note: I house my media files on external hard drives. Getting WSL to see my external hard drive was simple once I mounted it. This post aided in that regard.

So, how much raw footage did I have to work with this year?

25.4 hours

I trimmed over twenty five hours down to an 82 minute family video. Well, less than that, actually, as a good 7-8 minutes of the video was probably still shots and transitions. So, yes, I consider this one of my accomplishments this year.

« Older posts Newer posts »

© 2024 DadOverflow.com

Theme by Anders NorenUp ↑