audiostream 0.1.2 → 0.1.4

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: f4a8ed4b589f5958e5177e7ea29e67858f834508
4
- data.tar.gz: a46f66da55490bb36b4e1268184a74e02183fa58
3
+ metadata.gz: 225988a58e7060a38d4095786a3eabb8eb87e743
4
+ data.tar.gz: 25687dc022c62848d7766308b0a2386363432080
5
5
  SHA512:
6
- metadata.gz: 3cdc42e0a49c1f43fe7bba7676a237a43c61747a1feb654df3112d998e7e8e279f1e59fcd946d7e7e08a4ff8509647444af4a1c5e4caeae75a7425cad4af1b3e
7
- data.tar.gz: 5cae4ea21dda29284ae79bb6f9f4c827d7d6c2fb698961e9d0c7bb76d0f135f759d2822f9505c4efd6fe2371ab088ef0c181d5127d17ec7af602bbfb50bec89a
6
+ metadata.gz: 77c30e237d03326678e1656d2b49ef08fc39bdf8107db7122129c0bd938f28a7b6e6a60cd4c28b28929e910f26c2b5ea43c79a295396c12b3689281a532680ea
7
+ data.tar.gz: 6897a33710d0f491dc09c61de2295925bdce2974f227090cf4f00a4a5bc7704608b6115fa918b43ba618dc2c69bbcf91241c07c9820d62251380a638d4a44489
data/README.md CHANGED
@@ -1,24 +1,28 @@
1
1
  # Audiostream
2
2
 
3
- TODO: Write a gem description
3
+ AudioStream (C)2013 CompuTEK Industries. All Rights Reserved.
4
+ Licenced for usage and distribution under a BSD version 2 Licence.
4
5
 
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
6
+ Streaming Audio administration toolkit
8
7
 
9
- gem 'audiostream'
8
+ ## Installation
9
+ To install the gem type the following command in a new terminal:
10
10
 
11
- And then execute:
11
+ $ gem install audiostream
12
12
 
13
- $ bundle
13
+ ## Usage
14
14
 
15
- Or install it yourself as:
15
+ Commands:
16
+ audiostream help # Display the application help text.
17
+ audiostream help [COMMAND] # Describe available commands or one specific command
18
+ audiostream time # Display the play time of an audio file.
16
19
 
17
- $ gem install audiostream
20
+ Usage:
21
+ audiostream time
18
22
 
19
- ## Usage
23
+ Options:
24
+ -p, [--playlist=PLAYLIST] # m3u playlist to parse
20
25
 
21
- TODO: Write usage instructions here
22
26
 
23
27
  ## Contributing
24
28
 
data/data/test.m3u CHANGED
@@ -1,3 +1,3 @@
1
1
  #EXTM3U
2
- ./DJ_Spooky_-_The_Secret_Doctrine.mp3
3
- ./LukHash_-_TONIGHT.mp3
2
+ DJ_Spooky_-_The_Secret_Doctrine.mp3
3
+ LukHash_-_TONIGHT.mp3
@@ -22,27 +22,36 @@ Licenced for usage and distribution under a BSD version 2 Licence.
22
22
  method_option :playlist, :aliases => "-p", :desc => "m3u playlist to parse"
23
23
 
24
24
  def time
25
+
26
+ help(:time) if options[:playlist].nil?
25
27
  @filepath = "#{options[:playlist]}"
26
28
 
27
29
  if File.exists?(@filepath) then
28
- read_m3u(@filepath) do
29
- @mp3 = Mp3Info.new(@filepath)
30
- puts Time.at(@mp3.length).gmtime.strftime('%R:%S')
30
+ File.open(@filepath).each do |item|
31
+ @item=item.chomp
32
+
33
+ next if /^#EXT(M3U|INF:).*$/.match(@item)
34
+ puts "Reading #{@item}"
35
+
36
+ if File.exists?(@item) then
37
+ puts "#{@item}: #{playtime(@item)}"
38
+ else
39
+ puts "Error: File #{@item} not found"
40
+ end
31
41
  end
32
- else
33
- help(:time)
34
- end
42
+ else
43
+ puts "Playlist could not be loaded."
44
+ end
35
45
  end
36
-
46
+
37
47
  private
38
48
 
39
- def read_m3u(path, &block)
40
- File.open(@filepath).each do |item|
41
- next if /^#EXT(M3U|INF:).*$/.match(item)
42
- next unless File.exists?(item)
43
-
44
- block.call
45
- end
49
+ def playtime(path)
50
+ Time.at(mp3(path).length).gmtime.strftime('%R:%S')
51
+ end
52
+
53
+ def mp3(path)
54
+ return Mp3Info.new path
46
55
  end
47
56
  end
48
57
  end
@@ -2,7 +2,7 @@ module Audiostream
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- TINY = 2
5
+ TINY = 4
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.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dwight Spencer