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 +4 -4
- data/README.md +15 -11
- data/data/test.m3u +2 -2
- data/lib/audiostream/cli.rb +23 -14
- data/lib/audiostream/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 225988a58e7060a38d4095786a3eabb8eb87e743
|
4
|
+
data.tar.gz: 25687dc022c62848d7766308b0a2386363432080
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77c30e237d03326678e1656d2b49ef08fc39bdf8107db7122129c0bd938f28a7b6e6a60cd4c28b28929e910f26c2b5ea43c79a295396c12b3689281a532680ea
|
7
|
+
data.tar.gz: 6897a33710d0f491dc09c61de2295925bdce2974f227090cf4f00a4a5bc7704608b6115fa918b43ba618dc2c69bbcf91241c07c9820d62251380a638d4a44489
|
data/README.md
CHANGED
@@ -1,24 +1,28 @@
|
|
1
1
|
# Audiostream
|
2
2
|
|
3
|
-
|
3
|
+
AudioStream (C)2013 CompuTEK Industries. All Rights Reserved.
|
4
|
+
Licenced for usage and distribution under a BSD version 2 Licence.
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
6
|
+
Streaming Audio administration toolkit
|
8
7
|
|
9
|
-
|
8
|
+
## Installation
|
9
|
+
To install the gem type the following command in a new terminal:
|
10
10
|
|
11
|
-
|
11
|
+
$ gem install audiostream
|
12
12
|
|
13
|
-
|
13
|
+
## Usage
|
14
14
|
|
15
|
-
|
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
|
-
|
20
|
+
Usage:
|
21
|
+
audiostream time
|
18
22
|
|
19
|
-
|
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
|
-
|
3
|
-
|
2
|
+
DJ_Spooky_-_The_Secret_Doctrine.mp3
|
3
|
+
LukHash_-_TONIGHT.mp3
|
data/lib/audiostream/cli.rb
CHANGED
@@ -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
|
-
|
29
|
-
|
30
|
-
|
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
|
-
|
33
|
-
|
34
|
-
|
42
|
+
else
|
43
|
+
puts "Playlist could not be loaded."
|
44
|
+
end
|
35
45
|
end
|
36
|
-
|
46
|
+
|
37
47
|
private
|
38
48
|
|
39
|
-
def
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
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
|
data/lib/audiostream/version.rb
CHANGED