Class: Show

Inherits:
Object
  • Object
show all
Defined in:
lib/deadlist/models/show.rb

Overview

Object to handle Show data and the array of Track objects to be used in downloading.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(show_id, format) ⇒ Show



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/deadlist/models/show.rb', line 5

def initialize(show_id, format)
    @show_id = show_id
    @format = format
    @name = nil
    @date = nil
    @location = nil
    @venue = nil
    @duration = nil
    @transferred_by = nil
    @url = nil
    @tracks = nil

    set_show_info
end

Instance Attribute Details

#available_formatsObject (readonly)

Returns the value of attribute available_formats.



3
4
5
# File 'lib/deadlist/models/show.rb', line 3

def available_formats
  @available_formats
end

#dateObject (readonly)

Returns the value of attribute date.



3
4
5
# File 'lib/deadlist/models/show.rb', line 3

def date
  @date
end

#durationObject (readonly)

Returns the value of attribute duration.



3
4
5
# File 'lib/deadlist/models/show.rb', line 3

def duration
  @duration
end

#locationObject (readonly)

Returns the value of attribute location.



3
4
5
# File 'lib/deadlist/models/show.rb', line 3

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/deadlist/models/show.rb', line 3

def name
  @name
end

#tracksObject (readonly)

Returns the value of attribute tracks.



3
4
5
# File 'lib/deadlist/models/show.rb', line 3

def tracks
  @tracks
end

#transferred_byObject (readonly)

Returns the value of attribute transferred_by.



3
4
5
# File 'lib/deadlist/models/show.rb', line 3

def transferred_by
  @transferred_by
end

#venueObject (readonly)

Returns the value of attribute venue.



3
4
5
# File 'lib/deadlist/models/show.rb', line 3

def venue
  @venue
end

Instance Method Details

#download_tracks(path) ⇒ Object

Initializes a Downloader and passes track details



21
22
23
24
25
26
27
28
29
30
# File 'lib/deadlist/models/show.rb', line 21

def download_tracks(path)
    dl = Downloader.new(path, @format)
    download_url = dl.download_url_for_show(@show_id)

    @tracks.each do |track|
        dl.get(download_url, track)

        puts "⚡️ #{track.pos} - #{track.title} downloaded successfully"
    end
end