#input file
fin = open("data.txt", "rt")
#output file to write the result to
fout = open("index.html", "wt")
#newstr = string
#for each line in the input file


fout.write("<!DOCTYPE html><html lang=\"en\">")
fout.write("<head><title>Media</title></head><Body>")
fout.write("<B>Online Resources</B>")
fout.write("<P><a href=\"https://youtu.be/pGXcNeqB36c\">Summer Dreams</a>")
fout.write("<P><a href=\"https://youtu.be/FNga2xXxmTU\">Broadway in the park & The Sidemore's Cabin</a>")
fout.write("<P><a href=\"https://youtu.be/zENuIDmiWr8\">5 Good Reasons at Lemonade Fair</a>")
fout.write("<P><a href=\"https://youtu.be/SgS2p9sqGLc\">Have a Good Day - For Jacob</a>")

fout.write("<P><a href=\"https://soundcloud.com/schweettweet/5-good-reasons-clips\">FiveGoodReason Clips</a>")
fout.write("<P><a href=\"https://soundcloud.com/schweettweet/oh-minnesota-2\">Oh Minnesota</a>")
fout.write("<P><a href=\"https://soundcloud.com/schweettweet/it-isnt-you\">It Isn't You</a> <P> -- This is based off a Short Story about a child being watched over by a benevolent ghost after escaping from a bad situation at home.")
fout.write("<P><a href=\"https://soundcloud.com/schweettweet/head-in-the-sand\">Keeping Your Head In the Sand - From Young Mr. Scrooge</a>")
fout.write("<P><a href=\"https://soundcloud.com/schweettweet/when-angels-sing2\">When Angels Sing - From Young Mr. Scrooge</a>")

fout.write("<P><a href=\"https://soundcloud.com/schweettweet/the-truth\">The Truth Wherever it May Lead - From The Miraculous Dissappearance of Marilyn Moo</a>")
fout.write("<P><a href=\"https://soundcloud.com/schweettweet/summer-dreams\">Summer Dreams</a>")


fout.write("<P><a href=\"https://soundcloud.com/schweettweet/jacobs-song-venus-fly-trap-21\">Explicit Language - Jacob Wachtler's Venus Fly Trap</a>")

fout.write("<P><a href=\"https://youtu.be/4AyJgvwLO6U\">Dad's Family History Photographs</a>")
fout.write("<P><a href=\"https://youtu.be/nBg80kLB_Ao\">Great Grandma Brion Playing Piano</a>")
fout.write("<P><a href=\"https://youtu.be/64t8TsYl4ds\"> Grandma Irenes Birthday Video</a>")
fout.write("<><a href=\"https://www.reddit.com/user/schweettweet\">Reddit Writing</a>")

fout.write("<P><a href=\"https://youtu.be/2ZQFApNRhqI\">Peter Pan Clips from St Ben's</a>")
fout.write("<P><a href=\"https://youtu.be/iQmx7iHEOXI\">The Spooky House of Colony Circle</a>")
fout.write("<P><a href=\"https://youtu.be/LKpFUiUiM7A\">J-Cubed</a>")
fout.write("<P><a href=\"https://youtu.be/YdRnHZWgrjo\">Jacob and Scott - Conversations with Dad</a>")


fout.write("<P><a href=\"https://youtu.be/Yb_KV2Gq1Ak\">Jacob Solving Rubic's Cube Underwater</a>")
fout.write("<P><a href=\"https://youtu.be/1H2EFpaVFws\">Greg's HighSchool Play - Afterwards</a>")

fout.write("<P><a href=\"https://youtu.be/WsiJiOf71uU\">Summer 2012</a>")
fout.write("<P><a href=\"https://youtu.be/7jmr6Y-EloY\">Jacob's Five Best pranks</a>")
fout.write("<P><a href=\"https://youtu.be/Qi40UX0S3eM\">General Summer 2012 Cabin</a>")



fout.write("<P><a href=\"https://youtu.be/28ovm9NsQD8\">Jacob Talking about Pyrite</a>")
fout.write("<P><a href=\"https://youtu.be/tHPJ42POoOo\">Washington Day 2 and 3</a>")
fout.write("<P><a href=\"https://youtu.be/5Sf7q643E4s\">Washington Day 1</a>")

fout.write("<P><a href=\"https://youtu.be/6Hyfh5lCFIw\">New York Summer 2012 Day One</a>")
fout.write("<P><a href=\"https://youtu.be/gXIYbAKoyd4\">New York Summer 2012 Day One Part II</a>")
fout.write("<P><a href=\"https://youtu.be/Df4hza97hW4\">New York Summer 2012 Day One Part III</a>")

for line in fin:
	#read replace the string and write to output file
	#fout.write(line.replace('|', '<h ref="'))
	splitline = line.split("|",2)
	
	for sline in splitline:
		newstr = str("<p><a href=\"./")
		newstr = newstr + sline + "\">" + sline + "</a><p>"
		#newstr = str("<p><href=", splitline,"\">", splitline, "</a><p>")
		fout.write(newstr)
#close input and output files
fout.write("</body>")
fin.close()
fout.close()