OSDN Git Service

load arcs bowl
[tdcgexplorer/nimono-crawlers.git] / bin / load-arcs.rb
index 2a77130..ae45bdb 100644 (file)
@@ -1,9 +1,12 @@
 #!ruby
-# vim: fileencoding=utf-8
+# encoding: utf-8
 $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
 require 'connection'
 require 'location'
 require 'arc'
+require 'pmd'
+require 'vmd'
+require 'x'
 require 'scrap'
 
 location_code = ARGV.shift || 'mmd'
@@ -12,14 +15,16 @@ unless location
   puts "location not found."
   exit
 end
-
-scrap = Scrap.find_by_location(location.code)
+scrap = Scrap.find_by_location_code(location.code)
 
 ent = "/Volumes/uploader/src/#{location.code}/index.html"
 open(ent) do |f|
   while line = f.gets
     if scrap.match(line)
-      location.create_arc *scrap.row
+      name, summary, size, date, origname, locked = scrap.row
+      arc = location.create_arc(name, summary, size, date, origname, locked)
+      arc.create_zip_entries("/Volumes/uploader/arc/#{location.code}/#{name}") unless locked
+      puts
     end
   end
 end