OSDN Git Service

renamed read-seigas to load-seigas
[tdcgexplorer/nimono-crawlers.git] / bin / load-thumbs.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 'thumb'
9 require 'nicovideo'
10
11 nv = Nicovideo.new
12
13 def nv.tag_search_and_get_thumbinfo(tag_name)
14   video_ids = tag_search(tag_name)
15   video_ids.each do |video_id|
16     puts video_id
17     td = get_thumbinfo(video_id)
18     thumb = Thumb.find(td.video_id) || Thumb.new(:key => td.video_id)
19     thumb.title = td.title
20     thumb.description = td.description
21     thumb.save
22   end
23 end
24
25 nv.tag_search_and_get_thumbinfo("MMDデータ配布あり")
26 nv.tag_search_and_get_thumbinfo("MMDモデル配布あり")
27 nv.tag_search_and_get_thumbinfo("MMDモーション配布あり")