kja 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data.tar.gz.sig +0 -0
  4. data/lib/kja.rb +64 -0
  5. metadata +3 -2
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9bac364d42036e01ddfb66da6bc3321eed5fca55
4
- data.tar.gz: 19894deab21a8b76c04a2e22d8462b459f33e71d
3
+ metadata.gz: 58eab7e173815f14823d340b841006386ed41617
4
+ data.tar.gz: 788a8dca39d274d68e4a0171c3cabb4acb259ae3
5
5
  SHA512:
6
- metadata.gz: 85b9db04e93540fea8bad211fda3db49ad1574ab9ef3464d840746432d5da2e85371728d1eb83723db2939c815c5e0aecd667ceab6ccc1b91fd9ad551b56ce77
7
- data.tar.gz: 3faa62c30244ce7685ef370aa99670edbe1426b15f1aef8dce5d4fde6480614e3c815851d6b298103fc53e418681737c6e50fbc73893b7428410cdc85c73fdf4
6
+ metadata.gz: 42540c77cf106ef243fc4a5695bc6c76dd316813a2818785b2eb511180aaa515792b722e60e5f5c55bed0b396942897671d67453d08b42e674d0df238b529cdf
7
+ data.tar.gz: ab59e32e8f1e82481c80a7a8fe6a6ecd5656a40e972007299c705204f60d7b8043f7e045f67ff84eb95f6fcde4afab39d0840ce7398b01133022990e28e8443d
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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.3
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