# coding=gbk
import os
import re
import string

def 
(filename):
    # ÅÐ¶ÏÊÇ·ñÎªµçÓ°ÎÄ¼þ
    suffix = filename.split('.')[-1].lower()      # ÌáÈ¡ºó×º
    pattern = re.compile(r'mpg|mpeg|m2v|mkv|dat|vob|avi|wmv|rm|ram|rmvb|mov|avi|mp4|qt|viv')
    if pattern.search(suffix):  # Æ¥ÅäÊÇ·ñÎªµçÓ°¸ñÊ½
        return True
    else:
        return False

if __name__=='__main__':
    #  ±éÀúµ±Ç°Ä¿Â¼
    print '´¦ÀíÖÐ¡­¡­'
    cnt = 1
    for fp in os.listdir(os.getcwd()):
        if os.path.isfile(fp) and isMov(fp):  # ÊÇµçÓ°ÎÄ¼þ
            if fp[0]=='[':      # È¥µô¿ªÍ·µÄ[]
                index = fp.find(']')
                if index!=-1:
                    print '[%d] %s ==> %s'%(cnt,fp,fp[index+1:])
                    os.rename(fp,fp[index+1:])
                    fp = fp[index+1:]
                    cnt+=1
                    
            elif fp[:2]=='¡¾':   # È¥µô¿ªÍ·µÄ¡¾¡¿
                index = fp.find('¡¿')
                if index!=-1:
                    print '[%d] %s ==> %s'%(cnt,fp,fp[index+2:])
                    os.rename(fp,fp[index+2:])
                    fp = fp[index+2:]
                    cnt+=1
                    
            if fp[0] =='.' or fp[0]=='-':     # È¥µô¿ªÍ·µÄ'.' »ò '-'
                print '[%d] %s ==> %s'%(cnt,fp,fp[1:])
                os.rename(fp,fp[1:])
                
    if cnt==1:
        print 'Ã»ÓÐÐèÒª´¦ÀíµÄµçÓ°ÎÄ¼þ'
    else:
        print '´¦ÀíÍê±Ï'

isMov