OSDN Git Service

added
authornomeu <nomeu@users.sourceforge.jp>
Sun, 25 Jul 2010 21:45:00 +0000 (06:45 +0900)
committernomeu <nomeu@users.sourceforge.jp>
Sun, 25 Jul 2010 21:45:00 +0000 (06:45 +0900)
bin/mmd3dcu-idx.rb [new file with mode: 0644]

diff --git a/bin/mmd3dcu-idx.rb b/bin/mmd3dcu-idx.rb
new file mode 100644 (file)
index 0000000..b1f669f
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/ruby
+# download from mikumikudance
+# http://3dcustom.net/MMDuploader/upload.html
+
+$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
+require 'sn_uploader'
+
+def each_filename(text)
+  file_href = './src/'
+  file_re = Regexp.new(Regexp.escape(file_href) + '(.+?)\.html')
+  text.scan(/href="(.+?)"/) do |href, |
+    if md = file_re.match(href)
+      yield md[1]
+    end
+  end
+end
+
+uploader = SnUploader.new
+uploader.host = "3dcustom.net"
+uploader.root_path = "/MMDuploader"
+uploader.base_html = "upload.html"
+uploader.local_dir = '/Volumes/uploader/arc/mmd3dcu'
+body = uploader.get_base
+open('/Volumes/uploader/src/mmd3dcu/index.html', 'w'){ |f| f.puts body }
+each_filename(body) do |filename|
+  exist = uploader.local_file_exist?(filename)
+  puts [ filename, exist ? 'exist' : 'download' ].join("\t")
+  uploader.download_file(filename) unless exist
+end