lib/import/match_mover.rb in tracksperanto-1.9.8 vs lib/import/match_mover.rb in tracksperanto-1.9.9
- old
+ new
@@ -10,14 +10,14 @@
def self.distinct_file_ext
".rz2"
end
- def parse(io)
+ def stream_parse(io)
trackers = []
detect_format(io)
- extract_trackers(io)
+ extract_trackers(io) { |t| send_tracker(t) }
end
private
def detect_format(io)
@@ -27,14 +27,12 @@
w, h, _ = last_line.scan(/(\d+)/).flatten
@width, @height = w.to_i, h.to_i
end
def extract_trackers(io)
- tracks = []
while(line = io.gets) do
- tracks << extract_track(line, io) if line =~ /^pointTrack/
+ yield(extract_track(line, io)) if line =~ /^pointTrack/
end
- tracks
end
def extract_track(start_line, io)
tracker_name = start_line.scan(/\"([^\"]+)\"/).flatten[0]
report_progress("Extracting tracker #{tracker_name}")
\ No newline at end of file