Class: Saber::Tracker::BIB
Constant Summary collapse
- FIELDS =
{ "applications" => { "TorrentFile" => :file_upload, "Scene" => :checkbox, "Title" => :text, "Tags" => :text, "Image" => :text, "Description" => :text, "Anonymous" => :checkbox, "Notify" => :checkbox, }, "articles" => { "TorrentFile" => :file_upload, "Authors" => :text, "Title" => :text, "Pages" => :text, "Year" => :text, "YearTo" => :text, "Complete" => :checkbox, "Format" => :text, "Language" => :text, "Tags" => :text, "Image" => :text, "Description" => :text, "Anonymous" => :checkbox, "Notify" => :checkbox, }, "autobooks" => { "TorrentFile" => :file_upload, "Authors" => :text, "Title" => :text, "ISBN" => :text, "Publishers" => :text, "Year" => :text, "Format" => :select_list_text, "Language" => :select_list_text, "Tags" => :text, "Image" => :text, "Description" => :text, "Anonymous" => :checkbox, "Notify" => :checkbox, }, "comics" => { "TorrentFile" => :file_upload, "Scene" => :checkbox, "Authors" => :text, "Artists" => :text, "Title" => :text, "Publishers" => :text, "Pages" => :text, "Year" => :text, "YearTo" => :text, "Complete" => :checkbox, "Format" => :select_list_text, "Language" => :select_list_text, "Tags" => :text, "Image" => :text, "Description" => :text, "Anonymous" => :checkbox, "Notify" => :checkbox, }, "ebooks" => { "TorrentFile" => :file_upload, "Scene" => :checkbox, "Authors" => :text, "Title" => :text, "ISBN" => :text, "Publishers" => :text, "Pages" => :text, "Year" => :text, "Format" => :select_list_text, "Language" => :select_list_text, "Retail" => :checkbox, "Tags" => :text, "Image" => :text, "Description" => :text, "Anonymous" => :checkbox, "Notify" => :checkbox, }, "journals" => { "TorrentFile" => :file_upload, "Scene" => :checkbox, "Title" => :text, "Pages" => :text, "Year" => :text, "YearTo" => :text, "Complete" => :checkbox, "Format" => :select_list_text, "Language" => :select_list_text, "Tags" => :text, "Image" => :text, "Description" => :text, "Anonymous" => :checkbox, "Notify" => :checkbox, }, "magazines" => { "TorrentFile" => :file_upload, "Scene" => :checkbox, "Title" => :text, "Pages" => :text, "Year" => :text, "YearTo" => :text, "Complete" => :checkbox, "Format" => :select_list_text, "Language" => :select_list_text, "Tags" => :text, "Image" => :text, "Description" => :text, "Anonymous" => :checkbox, "Notify" => :checkbox, } }
- @@POPULATE_TYPES =
%w[ebook audiobook]
- @@BASE_URL =
"http://bibliotik.org"- @@LOGIN_CHECK_PATH =
used by login-with-cookie to check if it’s succeed.
"/conversations"
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#do_upload(file, info) ⇒ Boolean
Upload one torrent file to the site.
Methods inherited from Base
can_populate?, inherited, #initialize, #login, #populate, #upload
Constructor Details
This class inherits a constructor from Saber::Tracker::Base
Instance Method Details
#do_upload(file, info) ⇒ Boolean
Upload one torrent file to the site.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/saber/tracker/bib.rb', line 142 def do_upload(file, info) info["TorrentFile"] = "#{file}.torrent" agent.get("/upload/#{info.type}") {|p| ret = p.form_with(action: "") {|f| FIELDS[info.type].each {|k,t| f.set(t, "#{k}Field", info[k]) } }.submit # error if return path is "/upload/<type>" if ret.uri.path == "/upload/#{info.type}" msg = nil if (err=ret.at("//*[@id='formerrorlist']")) # convert html to markdown for pretty print. msg = ReverseMarkdown.parse(err) else msg = ret.body end Saber.ui.error "ERROR:\n#{msg}" return false else return true end } end |