Generate the Python apparatus for automatic rename commands based on cdImage.cue

xiaoxiao2021-03-06  131

#! / usr / bin / python

# - * - CODING: CP936 - * -

#############################################################

# Written by caocao # #

# caocao@eastday.com # #

# http://nethermit.yeah.net #

#############################################################

Import sys

IMPORT RE

IMPORT STRING

Print "Written by Caocao"

Print "caocao@eastday.com"

Print "http://nethermit.yeah.net"

Print

if len (sys.argv)! = 2:

Print "Usage: Python Ren.ape.py FilePath"

Sys.exit (1)

TRY:

fp = Open (sys.argv [1])

Except Ioerror:

Print "Can't load file from" sys.argv [1] "/ NPLEASE MAKE SURE THIS file exists."

Sys.exit (1)

ContentList = fp.readlines ()

fp.close ()

i = 1

For ContentLine In ContentList:

MatchObject = Re.Search ("^ Title * /" (. ) / "$", ContentLine, Re.I)

if MatchObject! = None:

IF i <10:

Rownum = "0% D"% i

Else:

Rownum = "% D"% i

i = 1

Print "REN" ROWNUM ". APE" ROWNUM "." String.Replace (MatchObject.group (1), "," ") ". APE "

转载请注明原文地址:https://www.9cbs.com/read-99843.html

New Post(0)