Skip to content

Instantly share code, notes, and snippets.

@thisfred
Last active August 29, 2015 14:14
Show Gist options
  • Save thisfred/2a5113921dde2aecd0c4 to your computer and use it in GitHub Desktop.
Save thisfred/2a5113921dde2aecd0c4 to your computer and use it in GitHub Desktop.
"""Old as Balls."""
import sys
from datetime import datetime, timedelta
def main(birthday):
"""Generate a link to make you feel old."""
year, month, day = [int(part.strip()) for part in birthday.split('-')]
now = datetime.now()
birthdate = datetime(year, month, day)
halfway = birthdate + timedelta(days=(now - birthdate).days / 2)
return (
'http://musicbrainz.org/search?query=date:%d-%02d*'
'&type=release&limit=100&method=advanced' % (
halfway.year, halfway.month))
if __name__ == '__main__':
print main(sys.argv[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment