Class: Show
- Inherits:
-
Object
- Object
- Show
- 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
-
#available_formats ⇒ Object
readonly
Returns the value of attribute available_formats.
-
#date ⇒ Object
readonly
Returns the value of attribute date.
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#tracks ⇒ Object
readonly
Returns the value of attribute tracks.
-
#transferred_by ⇒ Object
readonly
Returns the value of attribute transferred_by.
-
#venue ⇒ Object
readonly
Returns the value of attribute venue.
Instance Method Summary collapse
-
#download_tracks(path, format) ⇒ Object
Initializes a Downloader and passes track details.
-
#has_format?(requested_format) ⇒ Boolean
Returns whether or not a given format is available for this show.
-
#initialize(download_url) ⇒ Show
constructor
A new instance of Show.
Constructor Details
#initialize(download_url) ⇒ Show
Returns a new instance of Show.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/deadlist/models/show.rb', line 5 def initialize(download_url) @show_link = download_url @name = nil @date = nil @location = nil @venue = nil @duration = nil @transferred_by = nil @available_formats = [] @tracks = nil set_show_info end |
Instance Attribute Details
#available_formats ⇒ Object (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 |
#date ⇒ Object (readonly)
Returns the value of attribute date.
3 4 5 |
# File 'lib/deadlist/models/show.rb', line 3 def date @date end |
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
3 4 5 |
# File 'lib/deadlist/models/show.rb', line 3 def duration @duration end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
3 4 5 |
# File 'lib/deadlist/models/show.rb', line 3 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/deadlist/models/show.rb', line 3 def name @name end |
#tracks ⇒ Object (readonly)
Returns the value of attribute tracks.
3 4 5 |
# File 'lib/deadlist/models/show.rb', line 3 def tracks @tracks end |
#transferred_by ⇒ Object (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 |
#venue ⇒ Object (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, format) ⇒ Object
Initializes a Downloader and passes track details
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/deadlist/models/show.rb', line 25 def download_tracks(path, format) dl = Downloader.new(path, format) @tracks.each do |track| track_link = track.url_for_format(format) dl.get(track.pos, track.name, track_link) puts "⚡️ #{track.pos} - #{track.name} downloaded successfully" end end |
#has_format?(requested_format) ⇒ Boolean
Returns whether or not a given format is available for this show
20 21 22 |
# File 'lib/deadlist/models/show.rb', line 20 def has_format?(requested_format) @tracks[0].has_format?(requested_format) end |