Class: AudioStream::CLI

Inherits:
Thor
  • Object
show all
Includes:
Helpers, Thor::Actions
Defined in:
lib/audiostream/cli.rb

Instance Method Summary collapse

Methods included from Helpers

#mp3

Instance Method Details



15
16
17
18
19
20
21
22
# File 'lib/audiostream/cli.rb', line 15

def banner
  puts <<-EOL
AudioStream (C)2013 CompuTEK Industries. All Rights Reserved.
Licenced for usage and distribution under a BSD version 2 Licence.

  EOL
  help
end

#timeObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/audiostream/cli.rb', line 32

def time

  help(:time) if options[:playlist].nil?
  @filepath = "#{options[:playlist]}"
  
  if File.exists?(@filepath) then
	File.open(@filepath).each do |item|
	  @item=item.chomp

	  next if /^#EXT(M3U|INF:).*$/.match(@item)
	  if File.exists?(@item) then
 @total_time << playtime(@item)
 puts "#{@item}: #{playtime(@item)}"
	  else
        puts "Error: File #{@item} not found"
      end
    end
  else
  	puts "Playlist could not be loaded."
  end
end

#versionObject



25
26
27
# File 'lib/audiostream/cli.rb', line 25

def version
	puts AudioStream::VERSION
end