Class: SabnzbdPlusApi::UnannouncedComplete

Inherits:
Object
  • Object
show all
Defined in:
lib/sabnzbd_plus/api/unannounced_complete.rb

Overview

Get all of the slots which are in history and that have not yet been announced

Instance Method Summary (collapse)

Constructor Details

- (UnannouncedComplete) initialize(mapper = SabnzbdPlusModel::Mapper.new)

Load the mapper, empty the list of announced nzo ids

Parameters:

  • mapper (SabnzbdPlusModel::Mapper) (defaults to: SabnzbdPlusModel::Mapper.new)

    defaults to new SabnzbdPlusModel::Mapper



14
15
16
17
# File 'lib/sabnzbd_plus/api/unannounced_complete.rb', line 14

def initialize(mapper = SabnzbdPlusModel::Mapper.new)
  @announced_nzos = []
  @mapper = mapper
end

Instance Method Details

- (Array<HistorySlot>) process

Get all of the slots which are in history and that have not yet been announced

Returns:

  • (Array<HistorySlot>)

See Also:



25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/sabnzbd_plus/api/unannounced_complete.rb', line 25

def process
  return_array = []
  history = @mapper.history
  
  history.slots.each { |slot|
    unless @announced_nzos.include? slot.nzo_id
      return_array = return_array << slot
      @announced_nzos = @announced_nzos << slot.nzo_id
    end
  }

  return return_array
end