本文整理汇总了Python中timer.Timer.getTime方法的典型用法代码示例。如果您正苦于以下问题:Python Timer.getTime方法的具体用法?Python Timer.getTime怎么用?Python Timer.getTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类timer.Timer
的用法示例。
在下文中一共展示了Timer.getTime方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compress
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import getTime [as 别名]
def compress():
"""
compress temp docstring
"""
hb_nice = int(read_value('nice'))
hb_cli = read_value('com')
hb_out = read_value('temp_output')
hb_api = HandBrake()
if not hb_api.findProcess():
if hb_api.loadMovie():
print "Encoding and compressing %s" % hb_api.getMovieTitle()
stopwatch = Timer()
if hb_api.convert(args=hb_cli, nice=hb_nice, output=hb_out):
print "Movie was compressed and encoded successfully"
stopwatch.stop()
print ("It took %s minutes to compress %s"
%
(stopwatch.getTime(), hb_api.getMovieTitle()))
else:
stopwatch.stop()
print "HandBrake did not complete successfully"
else:
print "Queue does not exist or is empty"
else:
print "Process already running skipper"
示例2: rip
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import getTime [as 别名]
def rip():
"""
Main function for ripping
Does everything
Returns nothing
"""
log = Logger("rip", read_value("debug"))
mkv_save_path = read_value("save_path")
mkv_tmp_output = read_value("temp_output")
mkv_api = makeMKV(read_value("min_length"), read_value("cache_MB"), read_value("handbrake"), read_value("debug"))
log.debug("Autoripper started successfully")
log.debug("Checking for DVDs")
dvds = mkv_api.findDisc(mkv_tmp_output)
log.debug("%d DVDs found" % len(dvds))
if len(dvds) > 0:
# Best naming convention ever
for dvd in dvds:
mkv_api.setTitle(dvd["discTitle"])
mkv_api.setIndex(dvd["discIndex"])
movie_title = mkv_api.getTitle()
if not os.path.exists("%s/%s" % (mkv_save_path, movie_title)):
os.makedirs("%s/%s" % (mkv_save_path, movie_title))
mkv_api.getDiscInfo()
stopwatch = Timer()
if mkv_api.ripDisc(mkv_save_path, mkv_tmp_output):
stopwatch.stop()
log.info("It took %s minutes to complete the ripping of %s" % (stopwatch.getTime(), movie_title))
else:
stopwatch.stop()
log.info("MakeMKV did not did not complete successfully")
log.info("See log for more details")
log.debug("Movie title: %s" % movie_title)
else:
log.info("Movie folder %s already exists" % movie_title)
else:
log.info("Could not find any DVDs in drive list")
示例3: rip
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import getTime [as 别名]
def rip():
"""
rip temp docstring
"""
mkv_save_path = read_value('save_path')
mkv_min_length = int(read_value('min_length'))
mkv_cache_size = int(read_value('cache_MB'))
mkv_tmp_output = read_value('temp_output')
use_handbrake = bool(read_value('handbrake'))
mkv_api = makeMKV()
dvds = mkv_api.findDisc(mkv_tmp_output)
if (len(dvds) > 0):
# Best naming convention ever
for dvd in dvds:
mkv_api.setTitle(dvd["discTitle"])
mkv_api.setIndex(dvd["discIndex"])
movie_title = mkv_api.getTitle()
if not os.path.exists('%s/%s' % (mkv_save_path, movie_title)):
os.makedirs('%s/%s' % (mkv_save_path, movie_title))
stopwatch = Timer()
if mkv_api.ripDisc(path=mkv_save_path,
length=mkv_min_length,
cache=mkv_cache_size,
queue=use_handbrake,
output=mkv_tmp_output):
stopwatch.stop()
print ("It took %s minutes to complete the ripping of %s"
%
(stopwatch.getTime(), movie_title))
else:
stopwatch.stop()
print "MakeMKV did not did not complete successfully"
print "Movie title: %s" % movie_title
else:
print "Movie folder %s already exists" % movie_title
else:
print "Could not find any DVDs in drive list"
示例4: Timer
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import getTime [as 别名]
if PROWL:
try:
prowl.add("makeMKV", "Start Rip - " + movieTitle, movieTitle, 1, None, None)
except:
pass
stopwatch = Timer()
if MKVapi.ripDisc(
path=MKV_SAVE_PATH, length=MKV_MIN_LENGTH, cache=MKV_CACHE_SIZE, queue=USE_HANDBRAKE, output=MKV_TEMP_OUTPUT
):
stopwatch.stop()
rip_summary = "It took %s minutes to complete the ripping of %s" % (stopwatch.getTime(), movieTitle)
print rip_summary
if PROWL:
try:
prowl.add("makeMKV", "Done Rip - " + movieTitle, rip_summary, 1, None, None)
except:
pass
fnames = listdir("%s/%s" % (MKV_SAVE_PATH, movieTitle))
# Strip the _t00 from the first file, it makes for a nicer import in to mythtv.
if len(fnames) > 0:
rename(
"%s/%s/%s" % (MKV_SAVE_PATH, movieTitle, fnames[0]),
"%s/%s/%s" % (MKV_SAVE_PATH, movieTitle, fnames[0].replace("_t00", "")),
)
if MYTHTV:
os.system("mythutil --scanvideos")
示例5: Timer
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import getTime [as 别名]
if (MKVapi.findDisc(MKV_TEMP_OUTPUT)):
movieTitle = MKVapi.getTitle()
if not os.path.exists('%s/%s' % (MKV_SAVE_PATH, movieTitle)):
os.makedirs('%s/%s' % (MKV_SAVE_PATH, movieTitle))
stopwatch = Timer()
if MKVapi.ripDisc(path=MKV_SAVE_PATH,
length=MKV_MIN_LENGTH,
cache=MKV_CACHE_SIZE,
queue=USE_HANDBRAKE,
output=MKV_TEMP_OUTPUT):
stopwatch.stop()
print ("It took %s minutes to complete the ripping of %s"
%
(stopwatch.getTime(), movieTitle))
else:
stopwatch.stop()
print "MakeMKV did not did not complete successfully"
else:
print "Movie folder already exists, will not overwrite."
else:
print "Could not find valid DVD in drive list"
示例6: HandBrake
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import getTime [as 别名]
config = ConfigParser.RawConfigParser()
config.read("%s/../settings.cfg" % REAL_PATH)
HB_NICE = config.getint("HANDBRAKE", "nice")
HB_CLI = config.get("HANDBRAKE", "com")
HB_OUT = config.get("HANDBRAKE", "temp_output")
#
# CODE
#
hb = HandBrake()
if not hb.findProcess():
if hb.loadMovie():
print "Encoding and compressing %s" % hb.getMovieTitle()
stopwatch = Timer()
if hb.convert(args=HB_CLI, nice=HB_NICE, output=HB_OUT):
print "Movie was compressed and encoded successfully"
stopwatch.stop()
print ("It took %s minutes to compress %s" % (stopwatch.getTime(), hb.getMovieTitle()))
else:
stopwatch.stop()
print "HandBrake did not complete successfully"
else:
print "Queue does not exist or is empty"
else:
print "Process already running skipper"
示例7: HandBrake
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import getTime [as 别名]
HB_NICE = config.getint('HANDBRAKE', 'nice')
HB_CLI = config.get('HANDBRAKE', 'com')
HB_OUT = config.get('HANDBRAKE', 'temp_output')
#
# CODE
#
hb = HandBrake()
if not hb.findProcess():
if hb.loadMovie():
print "Encoding and compressing %s" % hb.getMovieTitle()
stopwatch = Timer()
if hb.convert(args=HB_CLI, nice=HB_NICE, output=HB_OUT):
print "Movie was compressed and encoded successfully"
stopwatch.stop()
print ("It took %s minutes to compress %s"
%
(stopwatch.getTime(), hb.getMovieTitle()))
else:
stopwatch.stop()
print "HandBrake did not complete successfully"
else:
print "Queue does not exist or is empty"
else:
print "Process already running skipper"
示例8: int
# 需要导入模块: from timer import Timer [as 别名]
# 或者: from timer.Timer import getTime [as 别名]
w, h = image.getbbox()[2:]
height = int(float(width) / w * h)
return image.resize((width, height))
path = raw_input("Input the photo path:")
tempDir = join(path, "Temp")
if not isdir(tempDir):
mkdir(tempDir)
timer = Timer()
timer.begin()
list = listdir(path)
num = len(list) - 1
done = 0
print "all is %s files" % (num)
for item in listdir(path):
imagePath = join(path, item)
newPath = join(tempDir, item)
if isfile(imagePath):
im = Image.open(imagePath)
resizeImage(im, 800).save(newPath)
done += 1
print "%s is done, left %s..." % (newPath, num - done)
timer.end()
print timer.getTimeString()
avg = timer.getTime() / num
print "%s average for each" % (avg)