kja 0.1.4 → 0.2.0

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 +29 -5
  5. metadata +7 -7
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58eab7e173815f14823d340b841006386ed41617
4
- data.tar.gz: 788a8dca39d274d68e4a0171c3cabb4acb259ae3
3
+ metadata.gz: a494c0ef1730b6813f9f86b400f24cd93882a2dc
4
+ data.tar.gz: 58270c1e3e31f06251481c8fccc74e192af24cfe
5
5
  SHA512:
6
- metadata.gz: 42540c77cf106ef243fc4a5695bc6c76dd316813a2818785b2eb511180aaa515792b722e60e5f5c55bed0b396942897671d67453d08b42e674d0df238b529cdf
7
- data.tar.gz: ab59e32e8f1e82481c80a7a8fe6a6ecd5656a40e972007299c705204f60d7b8043f7e045f67ff84eb95f6fcde4afab39d0840ce7398b01133022990e28e8443d
6
+ metadata.gz: daf2bd34d8f5e627b55b69d033949f1f549f7c1aae99c3a5579df21d87c27e43abe0d72c274b039dfbd162e5e43b34759b3bfd210ca2d86e8fb2e0832ffbfe8f
7
+ data.tar.gz: 9dd62dd936930c8dde16ea6a80dbb988b406e2c6d09f2c5a4f3a3c8c31e06a531907e0bc09ccb4c8b47b9f05b0c49f16b03c409313cb3208865d14c23ae6b9a1
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/kja.rb CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  # file: kja.rb
4
4
 
5
+ require 'dynarex'
5
6
  require 'tempfile'
6
- require 'rxfhelper'
7
+
7
8
 
8
9
  # description: Intended for use with the kj gem
9
10
  #
@@ -30,17 +31,25 @@ class Kja
30
31
  @ogg_baseurl, @audio_player = ogg_baseurl, audio_player
31
32
 
32
33
  end
33
-
34
- def speak(s)
34
+
35
+ def duration(s)
35
36
 
36
37
  book_no, book_title, chapter_no, verse_no = \
37
38
  s.downcase.match(/^(?:(\d) )?([\w ]+) (\d+):(\d+)/).captures
38
39
 
39
40
  book_title = book_no + '_' + book_title if book_no
40
41
  chapter_title = book_title + '_' + chapter_no
41
- verse_title = chapter_title + '_' + verse_no
42
+ url = @ogg_baseurl + '/' + File.join(book_title, chapter_title, 'dir.xml')
43
+
44
+ dx = Dynarex.new url
45
+ ogg = dx.find_by_name chapter_title + '_' + verse_no + '.ogg'
46
+ ogg.description[/\d+\.\d+$/].to_f
42
47
 
43
- ogg_filepath = File.join(book_title, chapter_title, verse_title + '.ogg')
48
+ end
49
+
50
+ def speak(s)
51
+
52
+ ogg_filepath = fetch_ogg_filepath(s)
44
53
  url = @ogg_baseurl + '/' + ogg_filepath
45
54
  audio, _ = RXFHelper.read(url)
46
55
 
@@ -53,6 +62,21 @@ class Kja
53
62
  system command
54
63
 
55
64
  end
65
+
66
+ private
67
+
68
+
69
+ def fetch_ogg_filepath(s)
70
+
71
+ book_no, book_title, chapter_no, verse_no = \
72
+ s.downcase.match(/^(?:(\d) )?([\w ]+) (\d+):(\d+)/).captures
73
+
74
+ book_title = book_no + '_' + book_title if book_no
75
+ chapter_title = book_title + '_' + chapter_no
76
+ verse_title = chapter_title + '_' + verse_no
77
+
78
+ File.join(book_title, chapter_title, verse_title + '.ogg')
79
+ end
56
80
 
57
81
  end
58
82
 
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
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,28 +31,28 @@ cert_chain:
31
31
  6po/R2bxzT2Ocy3UuAO73694J87w11m8wbDcPnntL7WYMh/hhGiyfKmTU2eThu0G
32
32
  FeRxNrmBTWCnjg==
33
33
  -----END CERTIFICATE-----
34
- date: 2017-06-11 00:00:00.000000000 Z
34
+ date: 2017-06-14 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
- name: rxfhelper
37
+ name: dynarex
38
38
  requirement: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '0.4'
42
+ version: '1.7'
43
43
  - - ">="
44
44
  - !ruby/object:Gem::Version
45
- version: 0.4.2
45
+ version: 1.7.22
46
46
  type: :runtime
47
47
  prerelease: false
48
48
  version_requirements: !ruby/object:Gem::Requirement
49
49
  requirements:
50
50
  - - "~>"
51
51
  - !ruby/object:Gem::Version
52
- version: '0.4'
52
+ version: '1.7'
53
53
  - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: 0.4.2
55
+ version: 1.7.22
56
56
  description:
57
57
  email: james@jamesrobertson.eu
58
58
  executables: []
metadata.gz.sig CHANGED
Binary file