Class: Autoaudio::Feed

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, Mongoid::Timestamps
Defined in:
lib/autoaudio/feed.rb

Class Method Summary collapse

Class Method Details

.makeObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/autoaudio/feed.rb', line 21

def self.make
  feeds = parse
  feeds.each do |f|
    unless Feed.where(album_title: f[:album]).exists?
      feed = Feed.create(
        :release_date      => f[:date],
        :release_number    => f[:release_number],
        :genre             => f[:genre],
        :genre_formatted   => format_string(f[:genre]),
        :album_title       => f[:album],
        :downloaded        => false,
        :download_attempts => 0,
        :download_method   => nil,
        :audio_format      => test_audio_format(f[:album]),
        :nzb               => nil,
        :nzb_opened        => false,
        :nfo               => nil,
        :zip               => nil,
        :zip_uploaded_url  => nil
      )
      feed.save
    end
  end
end