Last active
August 29, 2015 14:14
-
-
Save thisfred/2a5113921dde2aecd0c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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