Skip to content

Commit

Permalink
add sounds for hymns
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinjude committed Dec 27, 2019
1 parent f23d9b4 commit 960a885
Show file tree
Hide file tree
Showing 4 changed files with 4,260 additions and 3 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -588,12 +588,15 @@ You would notice a few patterns from those files
- Each verse in a hymn is separated with a line
- Each line in a chorus is preceeded with four lines

Watching for that pattern, a huge JSON file `content/db.json` is generated from the hymns. You can take a look of `makeDB.js` to see how `content/db.json` is generated. `categories.js` maps a category to hymn numbers. This is also used while generating `content/db.json`
Watching for that pattern, a huge JSON file `content/db.json` is generated from the hymns. You can take a look of `makeDB.js` to see how `content/db.json` is generated. `categories.js` and `sounds.js` maps a category to hymn numbers and holds the URL to the sound respectively for each hymn . This is also used while generating `content/db.json`.

## Contributions

If you run in any bug using this please feel free to open an issue or [catch me on twitter](www.twitter.com/marvinjudehk) to make it faster

## Issue
**A few sounds are missing!! Yes i know. I'll add them once I get it.**

If you find any other issue or some typo in the hymns, you can contact me or edit the associated hymn in the `Hymns` directory and open a PR. Once merged, a new json file will be generated for use by the API and can also be downloaded [here](`https://gospel-hymns.herokuapp.com/downloads)


If you find some typo in the hymns, you can contact me or edit the associated hymn in the `Hymns` directory and open a PR. Once merged, a new json file will be generated for use by the API and can also be downloaded [here](`https://gospel-hymns.herokuapp.com/downloads)
3,793 changes: 3,792 additions & 1 deletion content/db.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions makeDB.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const fs = require("fs");
const categories = require("./categories");
const sounds = require("./sounds");
let DB = {};

fs.readdir(`${__dirname}/Hymns`, (err, files) => {
Expand All @@ -12,6 +13,7 @@ fs.readdir(`${__dirname}/Hymns`, (err, files) => {
const title = getHymnTitle(file);
const titleWithHymnNumber = getTitleWithHymnNumber(file);
const category = getCategory(Number(number));
const sound = getSound(Number(number));

// ADD HYMNS
DB = {
Expand All @@ -24,6 +26,7 @@ fs.readdir(`${__dirname}/Hymns`, (err, files) => {
titleWithHymnNumber,
chorus,
verses,
sound,
category
}
}
Expand Down Expand Up @@ -89,3 +92,7 @@ function getHymnTitle(fileName) {
.join(" ")
.trim();
}

function getSound(hymnNumber) {
return sounds[hymnNumber] ? sounds[hymnNumber] : "";
}
Loading

0 comments on commit 960a885

Please sign in to comment.