audiostream 0.1.11 → 0.1.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 228789b0580e0e917ea19779515e39bf0cc61c20
4
- data.tar.gz: d0ebbf21956dbce53a71df2760c42ad9e4fa508b
3
+ metadata.gz: 82ee69009ca5646e4bc2a21a55503b462eced91f
4
+ data.tar.gz: a6d60220d73bfe946a7ed783fef56d05b68d26fe
5
5
  SHA512:
6
- metadata.gz: 5bac7cdc47e4d5036892037318680ae570f13f37e4ee0a98f42b4ec8325ad9619effaefdd03a201a5b4c002c293c3a1ff2a7de9ba306538c6b6b1325eeed9cdc
7
- data.tar.gz: 40cdd9236c75ab4ad90e343d67dcde24e1b3c1e6f4401745d94c6f4c9b7c0cbaaf31eca080286c9027e90506c7fbc7a17325a0b56a5e89f60cc99ca96d776b7e
6
+ metadata.gz: 6347b03da91450adfa985cbc8d0348f431da5eb0aacfdabd7975e9d958ae4253e6833a73e5af2c1c024d4f00918faad636afece8be1384cf2ae3fa3a4526f8a1
7
+ data.tar.gz: e30ce93a52101f76ae72655add8570181c94df1a4a51ba3077415af09b92f7d9a3f90465a2504a1c12492d4fa4266e7daad6fdae74ad698dbb5676a32b4df85e
@@ -1,9 +1,10 @@
1
- require 'audiostream/time'
1
+ require 'audiostream/helpers'
2
2
  require 'thor'
3
3
 
4
4
  module AudioStream
5
5
  class CLI < Thor
6
6
  include Thor::Actions
7
+ include AudioStream::Helpers
7
8
 
8
9
  default_task :banner
9
10
 
@@ -25,6 +26,35 @@ Licenced for usage and distribution under a BSD version 2 Licence.
25
26
  puts AudioStream::VERSION
26
27
  end
27
28
 
28
- include AudioStream::PlaylistTime
29
+ desc "time", "Display the play time of an audio file."
30
+ method_option :playlist, :aliases => "-p", :desc => "m3u playlist to parse"
31
+
32
+ def time
33
+
34
+ help(:time) if options[:playlist].nil?
35
+ @filepath = "#{options[:playlist]}"
36
+
37
+ if File.exists?(@filepath) then
38
+ File.open(@filepath).each do |item|
39
+ @item=item.chomp
40
+
41
+ next if /^#EXT(M3U|INF:).*$/.match(@item)
42
+ if File.exists?(@item) then
43
+ @total_time << playtime(@item)
44
+ puts "#{@item}: #{playtime(@item)}"
45
+ else
46
+ puts "Error: File #{@item} not found"
47
+ end
48
+ end
49
+ else
50
+ puts "Playlist could not be loaded."
51
+ end
52
+ end
53
+
54
+ private
55
+
56
+ def playtime(path)
57
+ Time.at(mp3(path).length).gmtime.strftime('%R:%S')
58
+ end
29
59
  end
30
60
  end
@@ -1,5 +1,3 @@
1
- require 'audiostream/helpers'
2
-
3
1
  module AudioStream
4
2
  module PlaylistTime
5
3
  include AudioStream::Helpers
@@ -2,7 +2,7 @@ module Audiostream
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 11
5
+ TINY = 12
6
6
 
7
7
  def self.to_s
8
8
  [MAJOR, MINOR, TINY].join(".")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audiostream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dwight Spencer