本文整理汇总了Python中track.Track.from_xml_file方法的典型用法代码示例。如果您正苦于以下问题:Python Track.from_xml_file方法的具体用法?Python Track.from_xml_file怎么用?Python Track.from_xml_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类track.Track
的用法示例。
在下文中一共展示了Track.from_xml_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_from_xml
# 需要导入模块: from track import Track [as 别名]
# 或者: from track.Track import from_xml_file [as 别名]
def update_from_xml(self, fnames, tz):
if len(fnames) == 0: return
tot_time = 0.0
tot_dist = 0.0
print>>sys.stderr, "Updating from xml files... "
for fname in fnames:
track = Track.from_xml_file(fname, tz)[0]
if track is None: continue
start_time = track.get_start_time_as_str()
if start_time in self.data: continue
tot_dist += track.dist
tot_time += track.duration
self.data[start_time] = track
print>>sys.stderr, "Added new track", start_time
if tot_time > 0:
hours = int(tot_time) / int(60)
mins = tot_time - hours * 60
print>>sys.stderr, "Updated %.2f miles, %.0f hrs %.0f mins" % (tot_dist, hours, mins)
else: print>>sys.stderr, "No tracks added"
self.sorted_keys = sorted(self.data.keys())