kja 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/kja.rb +64 -0
- metadata +3 -2
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58eab7e173815f14823d340b841006386ed41617
|
4
|
+
data.tar.gz: 788a8dca39d274d68e4a0171c3cabb4acb259ae3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42540c77cf106ef243fc4a5695bc6c76dd316813a2818785b2eb511180aaa515792b722e60e5f5c55bed0b396942897671d67453d08b42e674d0df238b529cdf
|
7
|
+
data.tar.gz: ab59e32e8f1e82481c80a7a8fe6a6ecd5656a40e972007299c705204f60d7b8043f7e045f67ff84eb95f6fcde4afab39d0840ce7398b01133022990e28e8443d
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/kja.rb
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# file: kja.rb
|
4
|
+
|
5
|
+
require 'tempfile'
|
6
|
+
require 'rxfhelper'
|
7
|
+
|
8
|
+
# description: Intended for use with the kj gem
|
9
|
+
#
|
10
|
+
# e.g.
|
11
|
+
|
12
|
+
=begin
|
13
|
+
|
14
|
+
require 'kj'
|
15
|
+
bible = Kj::Bible.new
|
16
|
+
|
17
|
+
s = bible.books[0].chapters[0].verses[0].title
|
18
|
+
|
19
|
+
kja = Kja.new(player: '/usr/bin/ogg123 -q')
|
20
|
+
kja.speak(s)
|
21
|
+
|
22
|
+
=end
|
23
|
+
|
24
|
+
|
25
|
+
class Kja
|
26
|
+
|
27
|
+
def initialize(audio_player: '/usr/bin/ogg123 -q',
|
28
|
+
ogg_baseurl: 'http://rorbuilder.info/r/ruby/kja/ogg')
|
29
|
+
|
30
|
+
@ogg_baseurl, @audio_player = ogg_baseurl, audio_player
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def speak(s)
|
35
|
+
|
36
|
+
book_no, book_title, chapter_no, verse_no = \
|
37
|
+
s.downcase.match(/^(?:(\d) )?([\w ]+) (\d+):(\d+)/).captures
|
38
|
+
|
39
|
+
book_title = book_no + '_' + book_title if book_no
|
40
|
+
chapter_title = book_title + '_' + chapter_no
|
41
|
+
verse_title = chapter_title + '_' + verse_no
|
42
|
+
|
43
|
+
ogg_filepath = File.join(book_title, chapter_title, verse_title + '.ogg')
|
44
|
+
url = @ogg_baseurl + '/' + ogg_filepath
|
45
|
+
audio, _ = RXFHelper.read(url)
|
46
|
+
|
47
|
+
tmpfile = Tempfile.new('kva')
|
48
|
+
file = File.new(tmpfile.path,'w')
|
49
|
+
file.puts audio
|
50
|
+
file.close
|
51
|
+
|
52
|
+
command = @audio_player + ' ' + tmpfile.path
|
53
|
+
system command
|
54
|
+
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
|
59
|
+
if __FILE__ == $0 then
|
60
|
+
|
61
|
+
kja = Kja.new(audio_player: '/usr/bin/ogg123 -q')
|
62
|
+
kja.speak(ARGV[0])
|
63
|
+
|
64
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kja
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -58,7 +58,8 @@ email: james@jamesrobertson.eu
|
|
58
58
|
executables: []
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
|
-
files:
|
61
|
+
files:
|
62
|
+
- lib/kja.rb
|
62
63
|
homepage: https://github.com/jrobertson/kja
|
63
64
|
licenses:
|
64
65
|
- MIT
|
metadata.gz.sig
CHANGED
Binary file
|