Ordered alphabet entries by name.
Mac/Win fix so that backup files would not be saved under new name when only change was character case.
Fixed SRT parsing so it properly distinguishes between a bad token name and a bad alphabet name.
1 parent f6df53b commit 5f1259d05704fbc1e1b339fdbf346cf2ef6dec21
@tundra tundra authored on 7 Apr 2010
Showing 1 changed file
View
12
tren.py
 
PROGNAME = "tren.py"
BASENAME = PROGNAME.split(".py")[0]
PROGENV = BASENAME.upper()
RCSID = "$Id: tren.py,v 1.216 2010/04/05 20:35:28 tundra Exp $"
RCSID = "$Id: tren.py,v 1.217 2010/04/07 18:36:55 tundra Exp $"
VERSION = RCSID.split()[2]
 
# Copyright Information
 
TOKMWDAY : ("", "ST_MTIME", "tm_wday"),
TOKMYEAR : ("%04d", "ST_MTIME", "tm_year")
}
 
# Alphabets - The User Can Add To These
# Alphabets - The user can add to these on the command line
 
ALPHABETS = {
 
BINARY : ["0", "1"],
DECIMAL : ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
 
OCTAL : ["0", "1", "2", "3", "4", "5", "6", "7"],
 
HEXLOWER : ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"],
 
HEXUPPER : ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"],
LOWERUPPER : ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p",
"q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F",
"G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V",
"W", "X", "Y", "Z"],
 
OCTAL : ["0", "1", "2", "3", "4", "5", "6", "7"],
 
UPPER : ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
"Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" ],
 
# Create the backup unless we've been told not to
 
if ProgramOptions[BACKUPS]:
 
bkuname = newname + ProgramOptions[EXISTSUFFIX]
bkuname = oldname + ProgramOptions[EXISTSUFFIX]
InfoMsg(indent + iRENFORCED % fullnew)
self.__RenameIt(pathname, newname, bkuname)
 
else:
 
found = False
for seqtoken in self.SortViews.keys() + [ORDERBYADATE, ORDERBYCDATE, ORDERBYMDATE]:
 
if token.startswith(seqtoken):
if token.split(ALPHADELIM)[0] == (seqtoken):
 
token, field = token[:len(seqtoken)], token[len(seqtoken):]
found = True
break