end
end
+ def locked_path_re
+ @_locked_path_re ||=
+ locked_path_pattern ? Regexp.new(Regexp.escape(url) + locked_path_pattern) : nil
+ end
+
def path_pattern
case self.code
when 'mmd', 'mmd3dcu'
end
end
+ def path_re
+ @_path_re ||=
+ path_pattern ? Regexp.new(Regexp.escape(url) + path_pattern) : nil
+ end
+
def generate_locked_arc_code(name)
case self.code
when 'mmd'
thumbs.each do |thumb|
# puts "# #{thumb.video_id}"
sites.each do |site|
- path_re = Regexp.new(Regexp.escape(site.url) + site.path_pattern)
- if md = path_re.match(thumb.description)
+ if md = site.path_re.match(thumb.description)
name = md[1]
code, extname = site.generate_arc_code_and_extname(name)
puts [ thumb.video_id, "", code ].join("\t")
link(thumb, code)
end
- next unless site.locked_path_pattern
- locked_path_re = Regexp.new(Regexp.escape(site.url) + site.locked_path_pattern)
- if md = locked_path_re.match(thumb.description)
+ next unless site.locked_path_re
+ if md = site.locked_path_re.match(thumb.description)
name = md[1]
code = site.generate_locked_arc_code(name)
puts [ thumb.video_id, "locked", code ].join("\t")