Class | RDtitle |
In: |
rdstyle.rb
|
Parent: | Object |
RDのネットdeナビにログインし、データを取得する。
host ホスト名 user ユーザー名 password パスワード
# File rdstyle.rb, line 62 def initialize(host, user, password) # RDhttpクラスを初期化して @rdhttp = RDhttp.new(host, user, password) @db = Array.new @dbf = Array.new @db_n2m = Hash.new # get_rootにより全タイトル情報を取得する get_root() set_no2member() end
タイトルの変更 memberはRDmemberオブジェクト newtitleは新規タイトル文字列
# File rdstyle.rb, line 134 def change_title(member, newtitle) src = @rdhttp.getcontents(member.uri) if src =~ /^ERROR/ raise src end cform = parse_chapter(src) cform.change_title(newtitle) response = @rdhttp.post_cform(cform) response = Kconv.tosjis(response.gsub(/\\r|\\n/, "")) if response =~ /正常に登録/ or response =~ /actfnc\(\)/ member.title = newtitle end return response # STDERR << "[RDtitle] ERROR on change_title\n" # exit #end end
チャプターを取得する
# File rdstyle.rb, line 125 def get_chapter(no) #STDERR << @db[1].uri << "\n" src = @rdhttp.getcontents(@db[1].uri) parse_chapter(src) end
ルートタイトル一覧の取得とフォルダ内のファイルも取得 データは@db等に格納される
# File rdstyle.rb, line 94 def get_root src = @rdhttp.getcontents("/title/b_title.htm") #エラー時は,エラーを発生させて終了 if src =~ /^ERROR/ raise src end case @rdhttp.rdtype when "x5" get_root_rdx5(src) when "x3" get_root_rdx3(src) end end