Podcast Episode Lengths

Series: sci November 11, 2018

I’m always curious about how episode lengths of various podcasts fluctuate over time. I’m also trying to get up to speed with Python3.

I decided to take a look at the episode lengths of the Crate and Crowbar to get a sense of how long it has been over the past few years.

Problems

It seems like the RSS feed for Crate and Crowbar doesn’t go back very far. I’m sure I could get all the files from Kane, but for now, I’m just using all the files I can access easily.

There are a couple of outlier episodes. Episode 147 was uploaded as a WAV file. A few are missing. A few have been renamed, or are named in a different scheme. For example: CCEp78.mp3, CCEp136testupload.mp3, and CCEp252-2.mp3. I didn’t bother accounting for these.

Thoughts

I learnt a lot about Python3 during this, but not a ton about C&C. The episodes are almost always longer than an hour, and have a lot of ups and downs on a weekly basis. I’d like to do more with this data in the future.

# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install mutagen
!{sys.executable} -m pip install urllib3

# Bringing it all together
import mutagen
from mutagen.easyid3 import EasyID3
def get_data(filename):
  analysis = mutagen.File(filename)
  try:
    id3 = EasyID3(filename)
    return [filename,
      str(id3['album']),
      str(id3['title']),
      str(id3['artist']),
      analysis.info.length/60,
      analysis.info.bitrate]
  except:
    try:
        return [filename,'','','',
      analysis.info.length/60,
      analysis.info.bitrate]
    except:
        return [filename,'','','',0,0]
files = ["CCChats-CultistSimulator.mp3",
"CCChats-DiscoElysium.mp3",
"CCChats-PhoenixPoint.mp3",
"CCChats-SunlessSkies.mp3",
"CCDnDEp001.mp3",
"CCDnDEp002.mp3",
"CCDnDEp003.mp3",
"CCDnDEp004.mp3",
"CCEp076.mp3",
"CCEp077.mp3"
...
]
# Download
import urllib3.request
for filename in files:
    print(str(filename))
    urllib.request.urlretrieve("https://www.pentadact.com/podcast/" + filename, filename)
data_container = []
for filename in files:
    print(str(filename))
    data = get_data(filename)
    data_container.append(data)
# Install a pip package in the current Jupyter kernel
import sys
!{sys.executable} -m pip install matplotlib
ep = []
leng = []
bitrate = []
for data in data_container:
    if (data[0][0:4] != 'CCEp'):
        continue
    if (data[4] == 0):
        continue
    ep.append(data[0][4:7])
    leng.append(data[4])
    bitrate.append(data[5])
import numpy as np

nep = np.asarray(ep[0:-7], dtype=int)
nlen = np.asarray(leng[0:-7], dtype=int)

def moving_average(a, n=3) :
    ret = np.cumsum(a, dtype=float)
    ret[n:] = ret[n:] - ret[:-n]
    return ret[n - 1:] / n

plt.plot(nep, nlen, label="Raw Data")
n = 10
nlen_avg = np.asarray(moving_average(leng[0:-7], n), dtype=int)
plt.plot(nep[n-2:-1], nlen_avg, label="10 Episode Average")

plt.ylim([0,210])
plt.xlim([70,len(nep)])
plt.title("C&C Episode Average Length")
plt.xlabel('Episode')
plt.ylabel('Minutes')
plt.legend()
plt.show()

png

# C&C Miniatures Monthly

mini_ep = []
mini_leng = []
mini_bitrate = []
for data in data_container:
    if (data[0][0:9] != 'CCMinisEp'):
        continue
    if (data[0][9:12] == 'Int'):
        continue
    if (data[0][9:12] == 'Spe'):
        continue
    if (data[4] == 0):
        continue
    mini_ep.append(data[0][9:12])
    mini_leng.append(data[4])
    mini_bitrate.append(data[5])

    
mini_nep = np.asarray(mini_ep, dtype=int)
mini_nlen = np.asarray(mini_leng, dtype=int)
n = 2
plt.plot(mini_nep, mini_nlen, label="Raw Data")
mini_nlen_avg = np.asarray(moving_average(mini_leng, n), dtype=int)
plt.plot(mini_nep[n-2:-1], mini_nlen_avg, label="2 Episode Average")
plt.ylim([0,250])
plt.xlim([1,len(mini_nep)])
plt.title("C&C Minis Average Length")
plt.legend()
plt.xlabel('Episode')
plt.ylabel('Minutes')
plt.show()

png

# Little Grey Cells

lgc_ep = []
lgc_leng = []
lgc_bitrate = []
for data in data_container:
    if (data[0][0:5] != 'LGCEp'):
        continue
    if (data[4] == 0):
        continue
    lgc_ep.append(data[0][5:8])
    lgc_leng.append(data[4])
    lgc_bitrate.append(data[5])

    
lgc_nep = np.asarray(lgc_ep, dtype=int)
lgc_nlen = np.asarray(lgc_leng, dtype=int)
n = 2
plt.plot(lgc_nep, lgc_nlen, label="Raw Data")
lgc_nlen_avg = np.asarray(moving_average(lgc_leng, n), dtype=int)
plt.plot(lgc_nep[n-2:-1], lgc_nlen_avg, label="2 Episode Average")
plt.ylim([0,90])
plt.xlim([1,len(lgc_nep)])
plt.title("Little Grey Cells Average Length")
plt.legend()
plt.xlabel('Episode')
plt.ylabel('Minutes')
plt.show()

png


built with , Jekyll, and GitHub Pages — read the fine print