#50: create invest-signal indicators and signal

(ACCEPTED)

--HG--
branch : sandbox
This commit is contained in:
Andreas
2010-02-27 21:46:15 +00:00
parent e985f59bb9
commit 4f9469e222

View File

@@ -6,7 +6,13 @@ import os
import re
import logging
mylog = logging.getLogger('batch_rename')
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s',
datefmt='%H:%M:%S')
LOG = logging.getLogger()
class Usage(Exception):
def __init__(self, message):
@@ -23,7 +29,7 @@ class Error(Exception):
def main(argv = None):
if argv == None:
argv = sys.argv
mylog.info("starting [%s]" % (argv[0],))
LOG.info("starting [%s]" % (argv[0],))
try:
try:
opts, args = getopt.getopt(argv[1:], "h", ["help"])
@@ -31,32 +37,29 @@ def main(argv = None):
except getopt.error, msg:
raise Usage(msg)
# more code, unchanged
p = re.compile("Star\.Trek\.The\.Next\.Generation.(.*?)\.(.*)\.(DVDRip-.*)\.\[tvu.org.ru\]\.avi")
tng = "e:\\share\\movies\\star trek tng"
os.chdir(tng)
# p = re.compile("Star\.Trek\.The\.Next\.Generation.(.*?)\.(.*)\.(DVDRip-.*)\.\[tvu.org.ru\]\.avi")
p = re.compile("Shaun\.The\.Sheep\..*\.(.*)\.DVDRip\.XviD-WPi\.\[tvu\.org\.ru\]\.avi")
# tng = r"c:\Dokumente\Eigene Videos\Shaun the Sheep"
tng = "."
# os.chdir(tng)
for (dirpath, dirnames, filenames) in os.walk(tng):
for f in filenames:
mot = re.match(p, f)
if mot is not None:
# print mot.group()
print mot.groups()
ver = mot.group(1)
title0 = mot.group(2)
# print mot.groups()
title0 = mot.group(1)
title1 = title0.replace('.', ' ')
nf = "Star Trek TNG - %s - %s - %s.divx.avi" % (ver, title1, mot.group(3))
nf = r"%s - DVDRip [tvu.org.ru].avi" % (title1,)
# os.rename(f, nf)
print 'ren "%s" "%s"' % (f, nf)
except Error, err:
mylog.error(err.message)
LOG.error(err.message)
return 1
except Usage, err:
mylog.error(err.message)
mylog.error("for help use --help")
LOG.error(err.message)
LOG.error("for help use --help")
return 2
if __name__ == '__main__':
logging.basicConfig(level=logging.DEBUG,
format='%(asctime)s.%(msecs)03d %(levelname)-8s %(message)s',
datefmt='%H:%M:%S')
sys.exit(main())