Class: Saber::Tracker2::BIB
Constant Summary collapse
- BASE_URL =
"http://bibliotik.org"
- TYPES =
{ "application" => "applications", "article" => "articles", "audiobook" => "audiobooks", "comic" => "comics", "ebook" => "ebooks", "journal" => "journals", "magazine" => "magazines" }
- FIELDS =
{ "application" => { torrent_file: "//input[@name='TorrentFileField']", scene: "//input[@name='SecneField']", title: "//input[@name='TitleField']", tags: "//input[@name='TagsField']", image: "//input[@name='ImageField']", description: "//textarea[@name='DescriptionField']", anonymous: "//input[@name='AnonymousField']", notify: "//input[@name='NotifyField']" }, "article" => { torrent_file: "//input[@name='TorrentFileField']", authors: "//input[@name='AuthorsField']", title: "//input[@name='TitleField']", pages: "//input[@name='PagesField']", year: "//input[@name='YearField']", yearto: "//input[@name='YearToField']", complete: "//input[@name='CompleteField']", format: "//select[@name='FormatField']", language: "//select[@name='LanguageField']", tags: "//input[@name='TagsField']", image: "//input[@name='ImageField']", description: "//textarea[@name='DescriptionField']", anonymous: "//input[@name='AnonymousField']", notify: "//input[@name='NotifyField']" }, "autobook" => { torrent_file: "//input[@name='TorrentFileField']", authors: "//input[@name='AuthorsField']", title: "//input[@name='TitleField']", isbn: "//input[@name='IsbnField']", publisher: "//input[@name='PublishersField']", year: "//input[@name='YearField']", format: "//select[@name='FormatField']", language: "//select[@name='LanguageField']", tags: "//input[@name='TagsField']", image: "//input[@name='ImageField']", description: "//textarea[@name='DescriptionField']", anonymous: "//input[@name='AnonymousField']", notify: "//input[@name='NotifyField']" }, "comic" => { torrent_file: "//input[@name='TorrentFileField']", scene: "//input[@name='SceneField']", authors: "//input[@name='AuthorsField']", artists: "//input[@name='ArtistsField']", title: "//input[@name='TitleField']", publisher: "//input[@name='PublishersField']", pages: "//input[@name='PagesField']", year: "//input[@name='YearField']", yearto: "//input[@name='YearToField']", complete: "//input[@name='CompleteField']", format: "//select[@name='FormatField']", language: "//select[@name='LanguageField']", tags: "//input[@name='TagsField']", image: "//input[@name='ImageField']", description: "//textarea[@name='DescriptionField']", anonymous: "//input[@name='AnonymousField']", notify: "//input[@name='NotifyField']" }, "ebook" => { torrent_file: "//input[@name='TorrentFileField']", scene: "//input[@name='SceneField']", authors: "//input[@name='AuthorsField']", title: "//input[@name='TitleField']", isbn: "//input[@name='IsbnField']", publisher: "//input[@name='PublishersField']", pages: "//input[@name='PagesField']", year: "//input[@name='YearField']", format: "//select[@name='FormatField']", language: "//select[@name='LanguageField']", retail: "//input[@name='RetailField']", tags: "//input[@name='TagsField']", image: "//input[@name='ImageField']", description: "//textarea[@name='DescriptionField']", anonymous: "//input[@name='AnonymousField']", notify: "//input[@name='NotifyField']" }, "journal" => { torrent_file: "//input[@name='TorrentFileField']", scene: "//input[@name='SceneField']", title: "//input[@name='TitleField']", pages: "//input[@name='PagesField']", year: "//input[@name='YearField']", yearto: "//input[@name='YearToField']", complete: "//input[@name='CompleteField']", format: "//select[@name='FormatField']", language: "//select[@name='LanguageField']", tags: "//input[@name='TagsField']", image: "//input[@name='ImageField']", description: "//textarea[@name='DescriptionField']", anonymous: "//input[@name='AnonymousField']", notify: "//input[@name='NotifyField']" }, "magazine" => { torrent_file: "//input[@name='TorrentFileField']", scene: "//input[@name='SceneField']", title: "//input[@name='TitleField']", pages: "//input[@name='PagesField']", year: "//input[@name='YearField']", yearto: "//input[@name='YearToField']", complete: "//input[@name='CompleteField']", format: "//select[@name='FormatField']", language: "//select[@name='LanguageField']", tags: "//input[@name='TagsField']", image: "//input[@name='ImageField']", description: "//textarea[@name='DescriptionField']", anonymous: "//input[@name='AnonymousField']", notify: "//input[@name='NotifyField']" } }
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
inherited, #initialize, #upload
Constructor Details
This class inherits a constructor from Saber::Tracker2::Base
Instance Method Details
#new_upload(info) ⇒ Object
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
# File 'lib/saber/tracker2/bib.rb', line 135 def new_upload(info) agent.goto "#{BASE_URL}/upload/#{info[:upload_type2]}" check_login %r~/upload/#{info[:upload_type2]}~ form = agent.form(action: "") FIELDS[info[:upload_type]].each {|key, selector| form.set2(selector, info[key]) } form.submit() if agent.url =~ %r~/upload/#{info[:upload_type2]}~ err = agent.element(xpath: "//*[@id='formerrorlist']") msg = err.exists? ? ReverseMarkdown.parse(err.html) : agent.text Saber.ui.error "ERROR: #{msg.to_s.strip}\n" return false else return true end end |
#process_info!(info) ⇒ Object
157 158 159 160 |
# File 'lib/saber/tracker2/bib.rb', line 157 def process_info!(info) info[:complete] = (info[:type] == "Pack") info[:description] = "#{info[:release_description].strip}\n\n#{info[:description]}" end |