本文整理汇总了Python中video.Video.get_all方法的典型用法代码示例。如果您正苦于以下问题:Python Video.get_all方法的具体用法?Python Video.get_all怎么用?Python Video.get_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类video.Video
的用法示例。
在下文中一共展示了Video.get_all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add_hash
# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import get_all [as 别名]
def add_hash():
SqlClass.turn_off_commits()
videos = Video.get_all()
tags = [video.get_tags() for video in videos]
# We need to get all the frame info before
# we erase the video table!
for tag_ls in tags:
for tag in tag_ls:
tag._populate_frame_dict()
for video in videos:
if not video.present():
self.log.error("Not all videos are present, cannot upgrade database!")
return False
[video.remove() for video in videos]
Video.remove_table()
Video.table_setup()
for i, video in enumerate(videos):
video.video_hash = \
hash_video(self.get_absolute_path(video.video_path))
Video.add(video)
for tag in tags[i]:
self.log.info("Adding tag %s in video %s" %(tag, video.video_path))
Tag.tag_add(tag)
SqlClass.turn_on_commits()
self.conn.commit()
return True
示例2: get_parent_video
# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import get_all [as 别名]
def get_parent_video(self):
from video import Video #need to keep this here to avoid circular import...
vids = Video.get_all(filter_str="WHERE id=%d" % self.vid)
if len(vids) != 1:
self.log.error("ERROR: invalid parent video")
return None
else:
return vids[0]
示例3: get_frames
# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import get_all [as 别名]
def get_frames(self, vision_enable=True):
melements = get_registered_elements()
frame_count = 0
for vid in Video.get_all():
tgs = vid.get_tags()
if len(tgs) > 0:
self.log.info("Loading video id %d" % vid.id)
if(self.parent != None):
self.parent.video_box.load_video(vid)
# XXX The below sleep was added to prevent a "Bus Error"
# XXX when running a test with a lot of disabled tags - Alex S.
# TODO FIX
sleep(0.1)
for tag in filter(lambda t: t.active, tgs):
frame_list = tag.get_frame_list()[::self.skip]
if len(frame_list) > 0:
#Carry out testing on this tag
self.log.info("Testing tag #%d (%d frames)" % (tag.id, len(frame_list)))
frame_list.sort()
tag.clear_test_results()
if vision_enable:
if not melements.has_key(tag.mission_element):
self.log.warning("Skipping tag %s; not a mission element." % tag.mission_element)
continue
m_element = melements[tag.mission_element]()
m_element.init() #Turn on vision for this mission element
for frame in frame_list:
#The test of the frame
if vision_enable:
yield frame, tag, m_element
else:
yield frame, tag
frame_count += 1
self.status_callback(frame_count)
if self.has_aborted():
break
if vision_enable:
m_element.deinit() #Turn off vision for this mission element
self.log.info("Waiting for module shutdown")
sleep(1) # We sleep here because vision will reset the enabled flag if vision is stopped and started too qucikly
# This happens if we immediately stop and start the same vision module
# TODO: Refactor to fix this (or fix this behavior in vision)
# Testing could potentially time out if a vision module does not shut down within
# this period
if self.has_aborted():
break
if self.has_aborted():
break
示例4: populate_info
# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import get_all [as 别名]
def populate_info(self):
self.total_frames = 0
for vid in Video.get_all():
tgs = vid.get_tags()
for tag in tgs:
if tag.active:
frame_list = tag.get_frame_list()[::self.skip_value]
self.total_frames += len(frame_list)
print("Frames to process: %d" % self.total_frames)
示例5: load_db
# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import get_all [as 别名]
def load_db(x):
self.log.info("Loading %s" % x)
db = Database(x)
if db is None or db.error:
self.log.error("Failed to load database %s" % x)
return (None, None)
d = dict()
for v in Video.get_all():
d[v] = v.get_tags()
return (d, db)
示例6: hash_to_vid
# 需要导入模块: from video import Video [as 别名]
# 或者: from video.Video import get_all [as 别名]
def hash_to_vid(self, hsh):
vds = Video.get_all(filter_str = "WHERE video_path=\"%s\"" % hsh)
if len(vds) != 1:
self.log.error("UNIQUE VIDEO ASSUMPTION INCORRECT") #TODO: assert?
raise Exception()
return vds[0]