OSDN Git Service

update bowlroll.net
authornomeu <nomeu@users.sourceforge.jp>
Tue, 6 Sep 2011 16:35:44 +0000 (01:35 +0900)
committernomeu <nomeu@users.sourceforge.jp>
Tue, 6 Sep 2011 16:35:44 +0000 (01:35 +0900)
bin/mmdbowl-idx.rb
lib/bowl.rb
spec/bowl_spec.rb

index e8a2039..61da7bd 100644 (file)
@@ -8,7 +8,9 @@ require 'bowl'
 Bowl.save_rss
 
 Bowl.each_code_in_rss do |code|
-  bowl = Bowl.new(code)
+  number = /dl(\d+)\z/.match(code)[1].to_i
+  bowl_class = (number > 650) ? Bowl20110904 : Bowl
+  bowl = bowl_class.new(code)
   if bowl.save_src
     puts "saved src #{code}"
   else
index 022f8b7..36ae3d0 100644 (file)
@@ -153,3 +153,23 @@ class Bowl
     true
   end
 end
+
+# 2011-09-04 update bowlroll.net
+class Bowl20110904 < Bowl
+
+  def summary
+    %r(<meta property="og:title" content="(.+?)">).match(@source)[1]
+  end
+
+  def tabs
+    keywords.split(/,/)[1..-1]
+  end
+
+  def keywords
+    %r(<meta name="keywords" content="(.+?)">).match(@source)[1]
+  end
+
+  def origname
+    %r(<h3><b>ファイル名</b>&nbsp;:&nbsp;(.+?)</h3>).match(@source)[1]
+  end
+end
index c5350d5..f8bcba5 100644 (file)
@@ -1,6 +1,28 @@
 require 'lib/bowl'
 $KCODE = 'U'
 
+describe 'Bowl20110904', 'arc dl671' do
+  subject { Bowl20110904.new('dl671') }
+  before do
+    subject.load
+  end
+  its "code" do
+    should == 'dl671'
+  end
+  its "extname" do
+    should == 'zip'
+  end
+  its "summary" do
+    should == 'デリンジャーver.1.00'
+  end
+  its "tabs" do
+    should == %w[ MikuMikuDance MMDアクセサリ MMDモデル ]
+  end
+  its "origname" do
+    should == 'デリンジャー.zip'
+  end
+end
+
 describe 'Bowl', 'arc dl140' do
   subject { Bowl.new('dl140') }
   before do