本文整理汇总了Python中FileIO.read_shots_from_csv方法的典型用法代码示例。如果您正苦于以下问题:Python FileIO.read_shots_from_csv方法的具体用法?Python FileIO.read_shots_from_csv怎么用?Python FileIO.read_shots_from_csv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileIO
的用法示例。
在下文中一共展示了FileIO.read_shots_from_csv方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: html_stuff
# 需要导入模块: import FileIO [as 别名]
# 或者: from FileIO import read_shots_from_csv [as 别名]
def html_stuff(stitched_shots, all_shots, outstitched_shots, ground_truth_file, filename1, filename2, output):
data_prefix = 0
data_vars1 = 'var jumpoffs = ['
data_vars2 = 'var all_scenes = ['
data_vars3 = 'var jo = ['
data_suffix = 0
#read ground truth for shot boundaries
ground_truth_data = FileIO.read_shots_from_csv(ground_truth_file)
#get start- and end-frames
last_element = stitched_shots[len(stitched_shots)-1]
for i in stitched_shots:
a,b = ground_truth_data[i[0]]
if i is not last_element:
data_vars1 += str(a) + ', '
else:
data_vars1 += str(a) + '];\n'
last_element = all_shots[len(all_shots)-1]
for shot in all_shots:
a,b = shot
if shot is not last_element:
data_vars2 += str(a) + ', '
else:
data_vars2 += str(a) + '];\n'
#get start- and end-frames
last_element = outstitched_shots[len(outstitched_shots)-1]
for i in outstitched_shots:
a,b = ground_truth_data[i]
if i is not last_element:
data_vars3 += str(a) + ', '
else:
data_vars3 += str(a) + '];\n'
#read prefix and suffix (html and javascript code)
with open(filename1, 'r') as f1:
data_prefix = f1.read()
f1.close()
with open(filename2, 'r') as f2:
data_suffix = f2.read()
f2.close()
string = data_prefix + data_vars1 + data_vars2 + data_vars3 + data_suffix
with open(output, 'w') as f:
f.write(string)
f.close()