kja 0.2.0 → 0.2.1

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 +16 -14
  5. metadata +2 -2
  6. metadata.gz.sig +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a494c0ef1730b6813f9f86b400f24cd93882a2dc
4
- data.tar.gz: 58270c1e3e31f06251481c8fccc74e192af24cfe
3
+ metadata.gz: bbd132952cb33ec1613e40b1b8931844eafc764f
4
+ data.tar.gz: 32d80038c1c73e32d674a781e76cbe89cb375f38
5
5
  SHA512:
6
- metadata.gz: daf2bd34d8f5e627b55b69d033949f1f549f7c1aae99c3a5579df21d87c27e43abe0d72c274b039dfbd162e5e43b34759b3bfd210ca2d86e8fb2e0832ffbfe8f
7
- data.tar.gz: 9dd62dd936930c8dde16ea6a80dbb988b406e2c6d09f2c5a4f3a3c8c31e06a531907e0bc09ccb4c8b47b9f05b0c49f16b03c409313cb3208865d14c23ae6b9a1
6
+ metadata.gz: 10ecbf62143ede9cfb272fc26ec985a6c43ed6255505e850a6dd0c76ff28af93d0b23a25a7e5f6cdd06d06bf59d69fd1df1b33d4d8f3b9b3cc15ddc43a768079
7
+ data.tar.gz: 6a8b94e96cad8efe9096c09fb956827d30ea5cfd4a11e6a1c733e95d65e5d01c882809b6cc1707f816eba76072550c279ce9cc4fd1cbfa14d038109241b41a17
Binary file
data.tar.gz.sig CHANGED
Binary file
data/lib/kja.rb CHANGED
@@ -33,12 +33,9 @@ class Kja
33
33
  end
34
34
 
35
35
  def duration(s)
36
-
37
- book_no, book_title, chapter_no, verse_no = \
38
- s.downcase.match(/^(?:(\d) )?([\w ]+) (\d+):(\d+)/).captures
39
-
40
- book_title = book_no + '_' + book_title if book_no
41
- chapter_title = book_title + '_' + chapter_no
36
+
37
+ book_title, chapter_title, verse_no = fracture(s)
38
+
42
39
  url = @ogg_baseurl + '/' + File.join(book_title, chapter_title, 'dir.xml')
43
40
 
44
41
  dx = Dynarex.new url
@@ -54,9 +51,7 @@ class Kja
54
51
  audio, _ = RXFHelper.read(url)
55
52
 
56
53
  tmpfile = Tempfile.new('kva')
57
- file = File.new(tmpfile.path,'w')
58
- file.puts audio
59
- file.close
54
+ File.write tmpfile.path, audio
60
55
 
61
56
  command = @audio_player + ' ' + tmpfile.path
62
57
  system command
@@ -65,14 +60,21 @@ class Kja
65
60
 
66
61
  private
67
62
 
68
-
69
- def fetch_ogg_filepath(s)
70
-
63
+ def fracture(s)
64
+
71
65
  book_no, book_title, chapter_no, verse_no = \
72
- s.downcase.match(/^(?:(\d) )?([\w ]+) (\d+):(\d+)/).captures
66
+ s.downcase.match(/(?:(\d) )?([\w ]+) (\d+):(\d+)$/).captures
73
67
 
68
+ book_title.gsub!(/\s/,'_')
74
69
  book_title = book_no + '_' + book_title if book_no
75
70
  chapter_title = book_title + '_' + chapter_no
71
+
72
+ return [book_title, chapter_title, verse_no]
73
+ end
74
+
75
+ def fetch_ogg_filepath(s)
76
+
77
+ book_title, chapter_title, verse_no = fracture(s)
76
78
  verse_title = chapter_title + '_' + verse_no
77
79
 
78
80
  File.join(book_title, chapter_title, verse_title + '.ogg')
@@ -85,4 +87,4 @@ if __FILE__ == $0 then
85
87
  kja = Kja.new(audio_player: '/usr/bin/ogg123 -q')
86
88
  kja.speak(ARGV[0])
87
89
 
88
- end
90
+ 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.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  6po/R2bxzT2Ocy3UuAO73694J87w11m8wbDcPnntL7WYMh/hhGiyfKmTU2eThu0G
32
32
  FeRxNrmBTWCnjg==
33
33
  -----END CERTIFICATE-----
34
- date: 2017-06-14 00:00:00.000000000 Z
34
+ date: 2017-07-11 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: dynarex
metadata.gz.sig CHANGED
Binary file