kja 0.3.0 → 0.3.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/lib/kja.rb +25 -17
  4. data.tar.gz.sig +0 -0
  5. metadata +1 -1
  6. metadata.gz.sig +3 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cf0f96cfdf4fabf09605e847917fea00ccd6d2e422653d2f5c654c4401a4d929
4
- data.tar.gz: 117cae0553d930f9a1fe67fb632aa62ae608d191f708a6d67669c1b9045bdb26
3
+ metadata.gz: 1228c3a17d36ddc53f837e4e8d5b4000dd9554d38f621dc2495e3b03f6da64ac
4
+ data.tar.gz: da86bc75e88decc6d04a799dfc25dc645a7c515b0a2bbbf9fcf0cae1a68e7c8c
5
5
  SHA512:
6
- metadata.gz: 45143316db18a8a22201d1bdabcd374c967f42f7d3ffa9a1a9e493e0424575378f253daaaca0e238b36c40baf24875fb2620e0e53c1b22753e58cd115ebabcac
7
- data.tar.gz: 0ad0b442e3d3cdedd23e99087057fcbe244f955d133f8d80fdb4d10bd8b74e6bccd42d27d3aecb10ca959a0a28dd9d408f05b8fbdc92174d44f97304046307db
6
+ metadata.gz: f252c1900dc380411faed4fe482d1279c1599279e7d01133abd07be300b33cfc6e0036b403db8707431b4dbeef5e2b324fd82f5cfc0dbcda175a8bae92f83f85
7
+ data.tar.gz: 8f9395c86fc703766d69df3c1c1d378c925d59344885f07d4d1a46380ce0264f03859b7618dc3ccdb160899c0ed4d24f2cb5606eb9ed531e68b074bcabc734b7
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/kja.rb CHANGED
@@ -6,6 +6,7 @@ require 'dynarex'
6
6
  require 'tempfile'
7
7
  require 'rxfreader'
8
8
  require 'kj_reading'
9
+ require 'easyaudio_utils'
9
10
 
10
11
 
11
12
  # description: Intended for use with the kj gem
@@ -36,19 +37,6 @@ class Kja
36
37
 
37
38
  end
38
39
 
39
- def download_ogg(s)
40
-
41
- ogg_filepath = fetch_ogg_filepath(s)
42
- url = @ogg_baseurl + '/' + ogg_filepath
43
- audio, _ = RXFReader.read(url)
44
-
45
- tmpfile = Tempfile.new('kva')
46
- File.write tmpfile.path + '.ogg', audio
47
-
48
- return tmpfile.path + '.ogg'
49
-
50
- end
51
-
52
40
  def duration(s)
53
41
 
54
42
  book_title, chapter_title, verse_no = fracture(s)
@@ -61,6 +49,9 @@ class Kja
61
49
 
62
50
  end
63
51
 
52
+ # e.g. speak 'Eze 18, 30..32'
53
+ # plays the audio of the title requested
54
+ #
64
55
  def speak(title)
65
56
 
66
57
  a = KjReading.verses title
@@ -75,7 +66,9 @@ class Kja
75
66
 
76
67
  end
77
68
 
78
-
69
+ # e.g. download 'Eze 18, 30..32'
70
+ # downloads the audio as an ogg file
71
+ #
79
72
  def download(s, outfile=nil)
80
73
 
81
74
  puts 'downloading ...' if @debug
@@ -88,10 +81,12 @@ class Kja
88
81
 
89
82
  puts 'converting to wav: ' + downloads.inspect if @debug
90
83
 
84
+ dir = File.dirname(Tempfile.new.path)
85
+
91
86
  wavfiles = downloads.map do |oggfile|
92
87
 
93
88
  wavfile = oggfile.sub(/\.ogg$/,'.wav')
94
- EasyAudioUtils.new(oggfile, wavfile).convert
89
+ EasyAudioUtils.new(oggfile, wavfile, working_dir: dir).convert
95
90
  sleep 1.4
96
91
  File.basename(wavfile)
97
92
 
@@ -103,8 +98,8 @@ class Kja
103
98
  #
104
99
  fullwavfile = Tempfile.new('kva').path + '.wav'
105
100
  puts 'creating fullwavfile:' + fullwavfile.inspect if @debug
106
- EasyAudioUtils.new(out: fullwavfile, working_dir: \
107
- File.dirname(fullwavfile)).concat(wavfiles, sample_rate: 22050)
101
+ EasyAudioUtils.new(out: fullwavfile, working_dir: dir).concat(wavfiles,
102
+ sample_rate: 22050)
108
103
 
109
104
  # convert wav to ogg
110
105
  #
@@ -118,6 +113,19 @@ class Kja
118
113
 
119
114
  private
120
115
 
116
+ def download_ogg(s)
117
+
118
+ ogg_filepath = fetch_ogg_filepath(s)
119
+ url = @ogg_baseurl + '/' + ogg_filepath
120
+ audio, _ = RXFReader.read(url)
121
+
122
+ tmpfile = Tempfile.new('kva')
123
+ File.write tmpfile.path + '.ogg', audio
124
+
125
+ return tmpfile.path + '.ogg'
126
+
127
+ end
128
+
121
129
  def fracture(s)
122
130
 
123
131
  book_no, book_title, chapter_no, verse_no = \
data.tar.gz.sig CHANGED
Binary file
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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
@@ -1 +1,3 @@
1
- �%�
1
+ �e���=� L�I�qo���8��,�ļ���[���Ts5b�!��g��$�^^���6��A�K�,�}GN3a&^Dd�����,�To?��n#�(Oe�3uf=�E����RNR90��^'�`m�B>X
2
+ k���S)��$}Qm�|Hi�r�q o�[�W�an�4jlS_�q�^��
3
+ ��$�WJ�)�Qa��c�l��A+�^��#H��n�]�S]1ZåK���2�0p"�"m���iVڢ-F���r �w��L�ho �VO1Y�W�R;M@��Y�v���ӠcN2����g�^r��U?���#�~8�()�r�0+&>�3�w1ǻ\�kb��⑋�O�F���}^;�(R�$���-.g�=��[��