Skip to content

Instantly share code, notes, and snippets.

View wesdoyle's full-sized avatar
🪴

Wes Doyle wesdoyle

🪴
View GitHub Profile
@wesdoyle
wesdoyle / main.py
Created September 10, 2016 16:29
Main method for python histogram tool
def main():
descStr = """
This program creates a histogram of track year from an XML playlist file
exported from iTunes.
"""
parser = argparse.ArgumentParser(description=descStr)
group = parser.add_mutually_exclusive_group()
group.add_argument('--years', dest='plFile', required=False)
args = parser.parse_args()
@wesdoyle
wesdoyle / plotYearHisto.py
Last active September 10, 2016 17:32
Method to plot year histogram from iTunes playlist
def plotYearHisto(fileName):
"""
Plot year histogram using XML playlist from iTunes.
"""
plist = plistlib.readPlist(fileName)
tracks = plist['Tracks']
years = []
for trackId, track in tracks.items():
try:
years.append(track['Year'])
@wesdoyle
wesdoyle / gist:96a96dac34f9ab19cc032a037087e7f7
Last active September 10, 2016 16:26
Import Python modules
import argparse
from matplotlib import pyplot as plt
import plistlib
import numpy as np