Class: AllTracks

Inherits:
Object
  • Object
show all
Defined in:
lib/live_set/live_set_all_tracks.rb

Instance Method Summary collapse

Constructor Details

#initialize(tracks) ⇒ AllTracks

Returns a new instance of AllTracks.



2
3
4
5
# File 'lib/live_set/live_set_all_tracks.rb', line 2

def initialize(tracks)
  @tracks = tracks
  @track_instances = tracks.map { |track| LiveAudioTrack.new track }
end

Instance Method Details

#all_frozenObject



7
8
9
# File 'lib/live_set/live_set_all_tracks.rb', line 7

def all_frozen
  @track_instances.all?(&:frozen)
end

#messageObject



11
12
13
14
15
16
17
# File 'lib/live_set/live_set_all_tracks.rb', line 11

def message
  if @tracks.empty?
    'No tracks'
  else
    summary + '  ' + @track_instances.map { |x| x.show_track(all_frozen) }.join("\n  ") # rubocop:disable Style/StringConcatenation
  end
end

#summaryObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/live_set/live_set_all_tracks.rb', line 19

def summary
  all_frozen_msg = all_frozen ? ' (All are frozen)'.yellow : ''
  push_warning = all_frozen ? '' : "\nWarning: some tracks are not frozen, so this set should not be transferred to Push 3 Standalone.".red
  total_size = @track_instances.sum(&:track_size)
  size_warning = if total_size >= 2_000_000_000
                   "\nWarning: This set is too large to be frozen and too large too large to transfer to Push 3 Standalone.".red
                 else
                   ''
                 end
  total_set_size = "Total set size: #{human_file_size total_size}".yellow
  "    \#{total_set_size}\#{size_warning}\#{push_warning}\n    \#{@track_instances.count} tracks\#{all_frozen_msg}:\n  END_MSG\nend\n"