#!/usr/bin/python

import urllib2
import os

wiki_url = "http://www.solfege.org"
images = [
    "Theory-intervals-1.png",
    "Theory-intervals-2.png",
    "Theory-intervals-3.png",
    "Theory-intervals-4.png",
    "Theory-intervals-1-nl.png",
    "Theory-intervals-2-nl.png",
    "Theory-intervals-3-nl.png",
    "Theory-intervals-4-nl.png",
    "Theory-intervals-1-fr.png",
    "Theory-intervals-2-fr.png",
    "Theory-intervals-3-fr.png",
    "Theory-intervals-4-fr.png"
    ]

def get_image(image):
    """ image->filename.png"""
    u = urllib2.urlopen(wiki_url + "/uploads/SolfegeDocsLily/" + image)
    i = u.read()
    print "downloaded:", image
    u.close()
    outfile = file(os.path.join("online-docs", "png", image), "w")
    outfile.write(i)
    outfile.close()

for image in images:
    get_image(image)
