Merge lp:~phill-ridout/openlp/ftw-json into lp:openlp/ftw-data
- ftw-json
- Merge into ftw-data
Proposed by
Phill
Status: | Superseded |
---|---|
Proposed branch: | lp:~phill-ridout/openlp/ftw-json |
Merge into: | lp:openlp/ftw-data |
Diff against target: |
434 lines (+412/-1) 3 files modified
download_3.0.json (+326/-0) scripts/hashgen.py (+1/-1) scripts/jsongen.py (+85/-0) |
To merge this branch: | bzr merge lp:~phill-ridout/openlp/ftw-json |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tomas Groth | Needs Fixing | ||
Raoul Snyman | Needs Fixing | ||
Review via email: mp+362981@code.launchpad.net |
This proposal has been superseded by a proposal from 2019-02-12.
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Tomas Groth (tomasgroth) wrote : | # |
2 minor things.
review:
Needs Fixing
lp:~phill-ridout/openlp/ftw-json
updated
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'download_3.0.json' |
2 | --- download_3.0.json 1970-01-01 00:00:00 +0000 |
3 | +++ download_3.0.json 2019-02-12 07:06:37 +0000 |
4 | @@ -0,0 +1,326 @@ |
5 | +{ |
6 | + "_comments": "The most recent version should be added to http://openlp.org/files/frw/download_3.0.json", |
7 | + "_meta": { |
8 | + "base_url": "https://get.openlp.org/ftw/", |
9 | + "bibles_dir": "bibles", |
10 | + "songs_dir": "songs", |
11 | + "themes_dir": "themes" |
12 | + }, |
13 | + "bibles": { |
14 | + "af": { |
15 | + "title": "Afrikaans", |
16 | + "translations": { |
17 | + "afr": { |
18 | + "file_name": "Afrikaans_Bybel.sqlite", |
19 | + "sha256": "d4f12ebbb35bf589e791200dd2f320cf89f894b53953724edb458570f47affcf", |
20 | + "title": "Afrikaanse Bybel" |
21 | + } |
22 | + } |
23 | + }, |
24 | + "ar": { |
25 | + "title": "العربية (Arabic)", |
26 | + "translations": { |
27 | + "kelh": { |
28 | + "file_name": "Ketab-EL-Hayat.sqlite", |
29 | + "sha256": "7b5d4c46fbd77477db0503b4565f1d558f6e29cf7e7e74f2ae48fbbe14766dde", |
30 | + "title": "Ketab EL Hayat" |
31 | + }, |
32 | + "sp": { |
33 | + "file_name": "Syriac_Peshitta_NT.sqlite", |
34 | + "sha256": "a7a1ccb205e8e0c92707344e90efbf0c8e60c8ad95eeb216c8b41ce23a231eef", |
35 | + "title": "Syriac Peshitta" |
36 | + }, |
37 | + "vd": { |
38 | + "file_name": "VanDyke-Without-Vowels.sqlite", |
39 | + "sha256": "b3d216b92c62954da7b69c27eb2872b1163f49fa290a23acc6cb3274d1f68f56", |
40 | + "title": "VanDyke Without Vowels" |
41 | + }, |
42 | + "vdv": { |
43 | + "file_name": "VanDyke-With-Vowels.sqlite", |
44 | + "sha256": "c1767d8bc2e6aff9097f63f3f9a15af134841ee3fdf40267adba3263f5a6ba0f", |
45 | + "title": "VanDyke With Vowels" |
46 | + } |
47 | + } |
48 | + }, |
49 | + "cz": { |
50 | + "title": "Čeština (Czech)", |
51 | + "translations": { |
52 | + "csp": { |
53 | + "file_name": "Cesky_studijni_preklad.sqlite", |
54 | + "sha256": "93885991c10d4ce71418c33b77cba7a321f7c66fe0d40edd7bd474160517d666", |
55 | + "title": "Český Studijní Překlad" |
56 | + }, |
57 | + "krl": { |
58 | + "file_name": "Kralicka_Bible_1613.sqlite", |
59 | + "sha256": "9d9e25e3361eeb9d550aea571aad55c4320b592ed28a4fa1cf4b0dad5ee382f4", |
60 | + "title": "Kralická Bible 1613" |
61 | + }, |
62 | + "prk": { |
63 | + "file_name": "Bible_Preklad_21_stoleti.sqlite", |
64 | + "sha256": "1fad90dc62bad7d246092dc4792eb39b89f910cf4fac0efd2bd35c69fcd89acf", |
65 | + "title": "Bible, Překlad 21. století" |
66 | + } |
67 | + } |
68 | + }, |
69 | + "de": { |
70 | + "title": "Deutsch", |
71 | + "translations": { |
72 | + "145": { |
73 | + "file_name": "Luther_1545.sqlite", |
74 | + "sha256": "965ca4df59fc6af80472be00fb9a92e1539792b42f2f7c368d9623d057293098", |
75 | + "title": "Luther 1545" |
76 | + }, |
77 | + "elb": { |
78 | + "file_name": "Elberfelder_1905.sqlite", |
79 | + "sha256": "32cf96da94be0df237584130df7b840b82828c753db0664393d354a4c7ac246b", |
80 | + "title": "Elberfelder" |
81 | + }, |
82 | + "l12": { |
83 | + "file_name": "Luther_1912.sqlite", |
84 | + "sha256": "2606b991f3254699cd236c6420b59789238118338e2778f7ed4c494861eb05ad", |
85 | + "title": "Luther 1912" |
86 | + }, |
87 | + "mb": { |
88 | + "file_name": "Menge_Bibel.sqlite", |
89 | + "sha256": "cad8ce0974e1b1823c8830738258941c95af2cf3a79dd3eb9e27659eb02fbdf6", |
90 | + "title": "Menge" |
91 | + } |
92 | + } |
93 | + }, |
94 | + "en": { |
95 | + "title": "English", |
96 | + "translations": { |
97 | + "asv": { |
98 | + "file_name": "ASV.sqlite", |
99 | + "sha256": "064637d15c1dd9940682460b8040f6fe1d025dd8f40637ca13c5fbdb14012d09", |
100 | + "title": "American Standard Version" |
101 | + }, |
102 | + "kjv": { |
103 | + "file_name": "KJV.sqlite", |
104 | + "sha256": "09e2d9d68777c75acc8b587b6be1f5253f86274774529e57a2902c14d9802d3d", |
105 | + "title": "King James Version" |
106 | + } |
107 | + } |
108 | + }, |
109 | + "eo": { |
110 | + "title": "Esperanto", |
111 | + "translations": { |
112 | + "esb": { |
113 | + "file_name": "Esperanto_Bible.sqlite", |
114 | + "sha256": "58c716f18382be192a077cb85934720315847e6b168340784df896d365ca495b", |
115 | + "title": "Esperanto Biblio" |
116 | + } |
117 | + } |
118 | + }, |
119 | + "es": { |
120 | + "title": "Español", |
121 | + "translations": { |
122 | + "lse": { |
123 | + "file_name": "Las_Sagradas_Escrituras.sqlite", |
124 | + "sha256": "c6654ef283f1139ba2b8d36238f38ad88a31b71599c79be3fad88db4350de939", |
125 | + "title": "Las Sagradas Escrituras" |
126 | + } |
127 | + } |
128 | + }, |
129 | + "fi": { |
130 | + "title": "Suomi", |
131 | + "translations": { |
132 | + "fi3338": { |
133 | + "file_name": "FI_33_38_OpenLP.sqlite", |
134 | + "sha256": "3a3dd8b5ec16a7cf5547f13b9ce4490e83ddc032b87b9a0efb383da6ab35fd70", |
135 | + "title": "33/38 - Vanha kirkkoraamattu" |
136 | + }, |
137 | + "fi92": { |
138 | + "file_name": "FI_92_OpenLP.sqlite", |
139 | + "sha256": "c0f0b0de574c65db60daa88b5f54d514901ae7bc86cf9933478d76575016a050", |
140 | + "title": "92 - Uusi kirkkoraamattu" |
141 | + }, |
142 | + "firk": { |
143 | + "file_name": "FI_Raamattu_Kansalle_OpenLP.sqlite", |
144 | + "sha256": "6982cb2b5b1061611211e62e8910289ff8702f934ddf785b7978524d3f8f9544", |
145 | + "title": "Raamattu Kansalle -käännös" |
146 | + } |
147 | + } |
148 | + }, |
149 | + "fr": { |
150 | + "title": "Français", |
151 | + "translations": { |
152 | + "lsb": { |
153 | + "file_name": "Louis_Segon_Bible.sqlite", |
154 | + "sha256": "8e548c384f92ee54ea46930a1547fcc574f039c3f8eaa918707f5692ceafc069", |
155 | + "title": "Louis Segon" |
156 | + } |
157 | + } |
158 | + }, |
159 | + "hu": { |
160 | + "title": "Magyar", |
161 | + "translations": { |
162 | + "ma": { |
163 | + "file_name": "Magyar_jford_t_s.sqlite", |
164 | + "sha256": "5509b117616e64da2486b71c344a4b58ec87634d29b0ddda528185fae19779d2", |
165 | + "title": "Magyar Újfordítású" |
166 | + } |
167 | + } |
168 | + }, |
169 | + "nl": { |
170 | + "title": "Nederlandse", |
171 | + "translations": { |
172 | + "sta": { |
173 | + "file_name": "Statenvertaling.sqlite", |
174 | + "sha256": "b2a699caff81c81ae11b705b09bfc85da832953ae28d838bef536e8a6c406822", |
175 | + "title": "Statenvertaling" |
176 | + } |
177 | + } |
178 | + }, |
179 | + "no": { |
180 | + "title": "Nederlandse", |
181 | + "translations": { |
182 | + "no1921": { |
183 | + "file_name": "Norsk-SMB-1921.sqlite", |
184 | + "sha256": "a7afc5b77cd54eb11c9b7d20813d56e164e935cf69ee0b38ae4126ce809a5fcd", |
185 | + "title": "Studentmållagsbibelen (1921)" |
186 | + }, |
187 | + "no1930": { |
188 | + "file_name": "Norsk-NB-1930.sqlite", |
189 | + "sha256": "641a3b52ed7fb8b2027703a1f7241577929ac97f91cf18c6e0ad9c235032b9f8", |
190 | + "title": "Norsk bokmål (1930)" |
191 | + } |
192 | + } |
193 | + }, |
194 | + "pt": { |
195 | + "title": "Português", |
196 | + "translations": { |
197 | + "jo": { |
198 | + "file_name": "Jo_o_Ferreira_de_Almeida_Atualizada.sqlite", |
199 | + "sha256": "ada5f15802a5c80cdf27ef188858d4c64e2a5d92b158c4bec7c5ca54e7cddcb1", |
200 | + "title": "João Ferreira de Almeida Atualizada" |
201 | + } |
202 | + } |
203 | + }, |
204 | + "ru": { |
205 | + "title": "Русский", |
206 | + "translations": { |
207 | + "rst": { |
208 | + "file_name": "RST.sqlite", |
209 | + "sha256": "86cf69addcbd93ea53842916bc7b90c77154415880b04c933679ea9dac1cf976", |
210 | + "title": "Синодальный перевод" |
211 | + } |
212 | + } |
213 | + }, |
214 | + "sv": { |
215 | + "title": "Slovak", |
216 | + "translations": { |
217 | + "ssv": { |
218 | + "file_name": "Sv_t_P_smo_Katol_cky_Preklad.sqlite", |
219 | + "sha256": "2d9ed24fe3eece4a20ecfb0228a92729d5d681bb8b65cb7f6dde18ca2839f5d8", |
220 | + "title": "Sväté Písmo (Katolícky Preklad)" |
221 | + } |
222 | + } |
223 | + }, |
224 | + "th": { |
225 | + "title": "ภาษาไทย", |
226 | + "translations": { |
227 | + "tkjv": { |
228 | + "file_name": "TKJV.sqlite", |
229 | + "sha256": "b053589c2d8f760556e5df2018d77b2bfda6c658e79835046d5e173ab2d341d9", |
230 | + "title": "พระคัมภีร์ภาษาไทยฉบับ KJV" |
231 | + } |
232 | + } |
233 | + }, |
234 | + "tl": { |
235 | + "title": "Tagalog", |
236 | + "translations": { |
237 | + "ang": { |
238 | + "file_name": "Ang_Dating_Biblia.sqlite", |
239 | + "sha256": "226b74a02323f56bb146e10e522e186d2387bbe2e3082b74297f1c97ce420673", |
240 | + "title": "Ang Dating" |
241 | + } |
242 | + } |
243 | + }, |
244 | + "uma": { |
245 | + "title": "Uma (Indonesia)", |
246 | + "translations": { |
247 | + "uma": { |
248 | + "file_name": "Uma_Version.sqlite", |
249 | + "sha256": "59ea6b77e246790794172cae0ecf70a34e59b602f0791d19789763faad12e368", |
250 | + "title": "Uma Version" |
251 | + } |
252 | + } |
253 | + } |
254 | + }, |
255 | + "songs": { |
256 | + "ar": { |
257 | + "file_name": "songs_ar.sqlite", |
258 | + "sha256": "2113f239e2c470d4d464f08e21008a7f77fd001bc01ebea3f6857852c2708712", |
259 | + "title": "Arabic" |
260 | + }, |
261 | + "de": { |
262 | + "file_name": "songs_de.sqlite", |
263 | + "sha256": "bff85ee11f7f7d667cd2867a639f59f15958d5df6ac0eeedf4da7cc4facd8165", |
264 | + "title": "Deutsch" |
265 | + }, |
266 | + "en": { |
267 | + "file_name": "songs_en.sqlite", |
268 | + "sha256": "8a5e862f0ce651a9ae8cc93c938b0bb5059f2380ac445096a346480e928bb045", |
269 | + "title": "English" |
270 | + }, |
271 | + "fi": { |
272 | + "file_name": "songs_fi.sqlite", |
273 | + "sha256": "601ac772d9a9a685059456186437aae128d5da30573ff08595c7f8752613a851", |
274 | + "title": "Suomi" |
275 | + }, |
276 | + "hu": { |
277 | + "file_name": "songs_hu.sqlite", |
278 | + "sha256": "1cd693f2c829eb6274dfce606cc52478cfdc6a05f00e07bdd20d0f72a18167e4", |
279 | + "title": "Magyar" |
280 | + }, |
281 | + "ru": { |
282 | + "file_name": "songs_ru.sqlite", |
283 | + "sha256": "1416c3e6b551c90c4e4cb797df368a617b7a5cfec814f0fad8882ab21024aee0", |
284 | + "title": "Русский" |
285 | + }, |
286 | + "th": { |
287 | + "file_name": "songs_th.sqlite", |
288 | + "sha256": "1066596a3941d2bcb1fad83ae81ccce146ea10ce73be57615e55f7cb02e2ceb7", |
289 | + "title": "ภาษาไทย" |
290 | + } |
291 | + }, |
292 | + "themes": { |
293 | + "bb": { |
294 | + "file_name": "BlueBurst.otz", |
295 | + "sha256": "6105626b6da8b358adb8eedb9da986f1149667a1bff324f8bd4549345d2fad56", |
296 | + "thumbnail": "BlueBurst.png", |
297 | + "title": "Blue Burst" |
298 | + }, |
299 | + "cl": { |
300 | + "file_name": "Clouds.otz", |
301 | + "sha256": "d28eafd838be33df58e7ff160d29b0c3ec7024927b62fa2308aa5b259f31d5ea", |
302 | + "thumbnail": "Clouds.png", |
303 | + "title": "Clouds" |
304 | + }, |
305 | + "geop": { |
306 | + "file_name": "Geo_Purple.otz", |
307 | + "sha256": "aee81f16183122d14c0ca9f7582d3adbe1eb8c932c635885fcfb2c50fc36c1aa", |
308 | + "thumbnail": "Geo_Purple.png", |
309 | + "title": "Geo Purple" |
310 | + }, |
311 | + "mot": { |
312 | + "file_name": "Moss_on_tree.otz", |
313 | + "sha256": "b3b9d286610f7639fedf21a04670f011801f79c06004d7d4295c947a0c584462", |
314 | + "thumbnail": "Moss_on_tree.png", |
315 | + "title": "Moss on tree" |
316 | + }, |
317 | + "swt": { |
318 | + "file_name": "Sea_with_trees.otz", |
319 | + "sha256": "66a9c831fa8c6805ba22502f2544469a717bf74c1f2a206a1b45e09b95493eed", |
320 | + "thumbnail": "Sea_with_trees.png", |
321 | + "title": "Sea with trees" |
322 | + }, |
323 | + "wt": { |
324 | + "file_name": "Wheat.otz", |
325 | + "sha256": "63fde97b7d35722c8fe06e1cfe8236e6d212d944d43c04f6b77f5156b83f5a3f", |
326 | + "thumbnail": "Wheat.png", |
327 | + "title": "Wheat" |
328 | + } |
329 | + } |
330 | +} |
331 | \ No newline at end of file |
332 | |
333 | === modified file 'scripts/hashgen.py' |
334 | --- scripts/hashgen.py 2017-03-07 18:42:08 +0000 |
335 | +++ scripts/hashgen.py 2019-02-12 07:06:37 +0000 |
336 | @@ -5,7 +5,7 @@ |
337 | ############################################################################### |
338 | # OpenLP - Open Source Lyrics Projection # |
339 | # --------------------------------------------------------------------------- # |
340 | -# Copyright (c) 2008-2015 OpenLP Developers # |
341 | +# Copyright (c) 2008-2019 OpenLP Developers # |
342 | # --------------------------------------------------------------------------- # |
343 | # This program is free software; you can redistribute it and/or modify it # |
344 | # under the terms of the GNU General Public License as published by the Free # |
345 | |
346 | === added file 'scripts/jsongen.py' |
347 | --- scripts/jsongen.py 1970-01-01 00:00:00 +0000 |
348 | +++ scripts/jsongen.py 2019-02-12 07:06:37 +0000 |
349 | @@ -0,0 +1,85 @@ |
350 | +#!/usr/bin/env python3 |
351 | +# -*- coding: utf-8 -*- |
352 | +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 |
353 | + |
354 | +############################################################################### |
355 | +# OpenLP - Open Source Lyrics Projection # |
356 | +# --------------------------------------------------------------------------- # |
357 | +# Copyright (c) 2008-2019 OpenLP Developers # |
358 | +# --------------------------------------------------------------------------- # |
359 | +# This program is free software; you can redistribute it and/or modify it # |
360 | +# under the terms of the GNU General Public License as published by the Free # |
361 | +# Software Foundation; version 2 of the License. # |
362 | +# # |
363 | +# This program is distributed in the hope that it will be useful, but WITHOUT # |
364 | +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # |
365 | +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # |
366 | +# more details. # |
367 | +# # |
368 | +# You should have received a copy of the GNU General Public License along # |
369 | +# with this program; if not, write to the Free Software Foundation, Inc., 59 # |
370 | +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # |
371 | +############################################################################### |
372 | +""" |
373 | +This script (re)generates a SHA256 hash for each file in the download_3.0.json file |
374 | +""" |
375 | +import json |
376 | +from hashlib import sha256 |
377 | +from pathlib import Path |
378 | + |
379 | +CONFIG_FILE_NAME = 'download_3.0.json' |
380 | + |
381 | +def hash_file(file_path, block_size=65536): |
382 | + """ |
383 | + Hash the given file block by block for memory efficiency |
384 | + |
385 | + :param pathlib.Path file_path: Path to file to hash. |
386 | + :param int block_size: Size of blocks to process the file in. |
387 | + :return: The sha256 hash of the file. |
388 | + :rtype: str |
389 | + """ |
390 | + with file_path.open(mode='rb') as file: |
391 | + print(f'Calculating hash for {file_path}') |
392 | + hasher = sha256() |
393 | + buf = file.read(block_size) |
394 | + while len(buf) > 0: |
395 | + hasher.update(buf) |
396 | + buf = file.read(block_size) |
397 | + return hasher.hexdigest() |
398 | + |
399 | + |
400 | +def main(): |
401 | + """ |
402 | + Parse the json resource file and calculate a hash for each file |
403 | + """ |
404 | + cfg_file_path = Path('..', CONFIG_FILE_NAME) |
405 | + if not cfg_file_path.exists(): |
406 | + print(f'Can\'t find {cfg_file_path}. You need to run hashgen.py from the scripts directory.') |
407 | + return False |
408 | + |
409 | + with cfg_file_path.open(mode='r', encoding='utf-8') as config_file: |
410 | + config = json.load(config_file) |
411 | + |
412 | + meta = config['_meta'] |
413 | + song_folder = Path('..', meta['songs_dir']) |
414 | + for lang in config['songs'].values(): |
415 | + song_db_path = song_folder / lang['file_name'] |
416 | + lang['sha256'] = hash_file(song_db_path) |
417 | + |
418 | + bible_folder = Path('..', meta['bibles_dir']) |
419 | + for lang in config['bibles'].values(): |
420 | + for translation in lang['translations'].values(): |
421 | + bible_db_path = bible_folder / translation['file_name'] |
422 | + translation['sha256'] = hash_file(bible_db_path) |
423 | + |
424 | + theme_folder = Path('..', meta['themes_dir']) |
425 | + for theme in config['themes'].values(): |
426 | + theme_db_path = theme_folder / theme['file_name'] |
427 | + theme['sha256'] = hash_file(theme_db_path) |
428 | + |
429 | + with cfg_file_path.open(mode='w', encoding='utf-8') as config_file: |
430 | + json.dump(config, config_file, sort_keys=True, indent=2, ensure_ascii=False) |
431 | + |
432 | + |
433 | +if __name__ == '__main__': |
434 | + main() |
Two things:
1. Please add a commit message or a description ^^
2. Your new JSON file is either "download_3.0.json" or "download_3.0.conf" depending on whether you look at the file name, or the constant on line 366 of the diff below. Please choose one.