Class: SabnzbdPlusApi::UnannouncedActive
- Inherits:
-
Object
- Object
- SabnzbdPlusApi::UnannouncedActive
- Defined in:
- lib/sabnzbd_plus/api/unannounced_active.rb
Overview
Get the items in the current queue that haven't been announced yet that have a status of Downloading
Re-announces if the status changes from downloaded and then back again.
Instance Method Summary (collapse)
-
- (UnannouncedActive) initialize(mapper = SabnzbdPlusModel::Mapper.new)
constructor
Load the mapper.
-
- (Array<Slot>) process
Get the items in the current queue that haven't been announced yet that have a status of Downloading.
Constructor Details
- (UnannouncedActive) initialize(mapper = SabnzbdPlusModel::Mapper.new)
Load the mapper
13 14 15 16 |
# File 'lib/sabnzbd_plus/api/unannounced_active.rb', line 13 def initialize(mapper = SabnzbdPlusModel::Mapper.new) @mapper = mapper @announced_nzos = [] end |
Instance Method Details
- (Array<Slot>) process
Get the items in the current queue that haven't been announced yet that have a status of Downloading
Re-announces if the status changes from downloaded and then back again.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/sabnzbd_plus/api/unannounced_active.rb', line 25 def process return_array = [] @mapper.current_queue.slots.each { |slot| unless @announced_nzos.include? slot.nzo_id if slot.status == "Downloading" return_array = return_array << slot @announced_nzos << slot.nzo_id else @announced_nzos.delete slot.nzo_id end end } return return_array end |