#! /usr/bin/python

"""
#------------
#Usage
#------------

Command Line:
Adjust the following for locations of the files/stripper_2013 

python stripper_2013.py fileName.ma fileName2.ma fileNameX.ma

Maya:
Place in your scripts directory and run this

import stripper_2013
stripper_2013.main(" C:/Path/To/Your/File.ma ")
"""

#Created by Dhruv Govil                 http://www.dgovil.com  dhruvagovil@gmail.com
#Based on script by Dave Girard        http://polygonspixelsandpaint.tumblr.com/post/28629598569

import sys,os,re

def main(files):
        for file in files:
                if file.endswith('.ma'):
                        filePath = os.path.realpath(file)
                        out_fname = filePath.rpartition('.ma')[0]+'_2012_compatible.ma'
                        
                        f=open(filePath)
                        lines=f.readlines()
                        f.close()

                        outFile = open(out_fname, 'w')
                        for line in lines:
                                outFile.write(re.sub('-ch [0-9]* ', '', line))
                        outFile.close()


if __name__=='__main__':
        sys.exit(main(sys.argv))