OSDN Git Service

save src
[tdcgexplorer/nimono-crawlers.git] / bin / scrap-bowl.rb
1 #!ruby
2 # encoding: utf-8
3 $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
4 $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../app/models')
5 require 'connection'
6 require 'site'
7 require 'arc'
8 require 'pmd'
9 require 'vmd'
10 require 'x'
11 require 'thumb'
12 require 'bowl'
13
14 site = Site.find('mmdbowl')
15
16 for number in 745..1045
17   code = "dl#{number}"
18   bowl_class = (number > 650) ? Bowl20110904 : Bowl
19   bowl = bowl_class.new(code)
20   unless File.exist?(bowl.src_path)
21     puts "PASS: src #{code} not found"
22     next
23   end
24   bowl.load
25   next if bowl.removed?
26
27   name = bowl.name
28   summary = bowl.summary
29   size = '0KB'
30   date = '01/01/01(Mon),00:00:00'
31   origname = bowl.origname
32   locked = bowl.locked?
33
34   arc = site.create_arc(name, summary, size, date, origname, locked)
35   unless File.exist?(bowl.arc_path)
36     puts "PASS: arc #{code} not found"
37     next
38   end
39   bowl.load
40   arc.create_entries("/Volumes/uploader/arc/#{site.code}/#{name}") unless locked
41   puts
42 end