import string
import sys
import os


# this program fixes a list of files 
# which contains a bad link

BADLINK = "https://www.youtube.com/playlist?list=PLoROMvodv4rMQd1ZcAY9zzP3oWa3m_hFti"

GOODLINK = "https://www.youtube.com/playlist?list=PLoROMvodv4rMQd1ZcAY9zzP3oWa3m_hFt"



files = sys.argv[1:]
for f in files:
	#make backup
	os.system('cp '+ f + ' ' + f +'.bak')

	#read in file
	fd = open( f, 'r')
	st = fd.read()
	fd.close()

	#fix the bad link
	st = string.replace( st, BADLINK, GOODLINK)
	
	#truncate, write, and close the file
	fd = open(f, 'w')
	fd.write( st )
	fd.close()

