OSDN Git Service

added
authornomeu <nomeu@users.sourceforge.jp>
Thu, 18 Oct 2012 04:50:51 +0000 (13:50 +0900)
committernomeu <nomeu@users.sourceforge.jp>
Thu, 18 Oct 2012 04:50:51 +0000 (13:50 +0900)
bin/crawl-bowl.rb [new file with mode: 0644]
bin/scrap-bowl.rb [new file with mode: 0644]

diff --git a/bin/crawl-bowl.rb b/bin/crawl-bowl.rb
new file mode 100644 (file)
index 0000000..87d4d02
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/bin/ruby
+# download from bowlroll.net
+# http://bowlroll.net/up/
+
+$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
+require 'bowl'
+
+for number in 745..1045
+  code = "dl#{number}"
+  bowl_class = (number > 650) ? Bowl20110904 : Bowl
+  bowl = bowl_class.new(code)
+  unless File.exist?(bowl.src_path)
+    puts "PASS: src #{code} not found"
+    next
+  end
+  bowl.load
+  if bowl.save_arc
+    puts "saved arc #{code}"
+  else
+    puts "PASS: arc #{code} exists (or locked or removed)"
+  end
+end
diff --git a/bin/scrap-bowl.rb b/bin/scrap-bowl.rb
new file mode 100644 (file)
index 0000000..712439c
--- /dev/null
@@ -0,0 +1,42 @@
+#!ruby
+# encoding: utf-8
+$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
+$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../app/models')
+require 'connection'
+require 'site'
+require 'arc'
+require 'pmd'
+require 'vmd'
+require 'x'
+require 'thumb'
+require 'bowl'
+
+site = Site.find('mmdbowl')
+
+for number in 755..1045
+  code = "dl#{number}"
+  bowl_class = (number > 650) ? Bowl20110904 : Bowl
+  bowl = bowl_class.new(code)
+  unless File.exist?(bowl.src_path)
+    puts "PASS: src #{code} not found"
+    next
+  end
+  bowl.load
+  next if bowl.removed?
+
+  name = bowl.name
+  summary = bowl.summary
+  size = '0KB'
+  date = '01/01/01(Mon),00:00:00'
+  origname = bowl.origname
+  locked = bowl.locked?
+
+  arc = site.create_arc(name, summary, size, date, origname, locked)
+  unless File.exist?(bowl.arc_path)
+    puts "PASS: arc #{code} not found"
+    next
+  end
+  bowl.load
+  arc.create_entries("/Volumes/uploader/arc/#{site.code}/#{name}") unless locked
+  puts
+end