module TTWatcher::TorrentAgent
Public Class Methods
search(torrent_name, params = {})
click to toggle source
TorrentAgent#search
Resolves where exactly to search torrents.
@param [String] torrent_name
Torrent name (minimal length: 3 chars).
@param [Hash] params @option params [Array<Symbol, String>, Symbol, String] :sites
List of sites where we looking for torrent. By default it search everywhere ("rutor", "unionpeer", "zooqle", "megashara").
@return [Array<Torrent>]
Array (homogeneous) with torrents. Can be empty if nothing was found.
# File sources/ttwatcher/torrent_agent.rb, line 21 def self.search(torrent_name, params = {}) list = TorrentList.new site_names = params[:from].nil? ? Sites.list : Array(params[:from]) site_names.each do |name| site = Sites.fetch_torrent_site name new_torrents = site.new.find_torrent torrent_name list += new_torrents if new_torrents end return list.to_a end