module AudioStream::PlaylistTime
Public Instance Methods
time()
click to toggle source
# 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
Private Instance Methods
playtime(path)
click to toggle source
# File lib/audiostream/time.rb, line 32 def playtime(path) Time.at(self.mp3(path).length).gmtime.strftime('%R:%S') end