8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/audiostream/time.rb', line 8
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
|