Skip to content

Commit

Permalink
Refactor importSongsFromRcByAuthors and importSongsFromRcByIds to use…
Browse files Browse the repository at this point in the history
… COLON constant.
  • Loading branch information
ioanlucut committed Oct 2, 2023
1 parent 31548c1 commit adc8e42
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 69 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"reprocess:filename": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./bin/lyricsFileNameReprocessorRunner.ts",
"import:rc:by-authors": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./temp-runners/importSongsFromRcByAuthors.ts",
"import:rc:by-ids": "node --no-warnings=ExperimentalWarning --loader ts-node/esm ./temp-runners/importSongsFromRcByIds.ts",
"import:rc:ci": "npm run import:rc:by-authors && npm run import:rc:by-ids",
"build:ci": "npm run lint && npm run test && npm run verify",
"meta:ci": "npm run reprocess:filename && npm run reprocess:content && npm run verify && npm run format"
},
Expand Down
3 changes: 2 additions & 1 deletion temp-runners/importSongsFromRcByAuthors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { fileURLToPath } from 'url';
import { parse } from '../src/songParser.js';
import { print } from '../src/songPrinter.js';
import {
COLON,
logFileWithLinkInConsole,
logProcessingFile,
NEW_LINE,
Expand Down Expand Up @@ -49,7 +50,7 @@ const runFor = async (songsDirs: string[]) => {
const allRcIds = allSongsInRepo.map(({ rcId }) => rcId).filter(Boolean);

await pMap(rcAuthorPathsToProcess, async (pathConfig) => {
const [counts, composer, authorPath] = pathConfig.split(':');
const [counts, composer, authorPath] = pathConfig.split(COLON);
const dirToImportFrom = `${RC_DIR}/${authorPath}`;
(await readFiles(dirToImportFrom)).forEach(
({ contentAsString, filePath, fileName }) => {
Expand Down
6 changes: 4 additions & 2 deletions temp-runners/importSongsFromRcByIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@ import fsExtra from 'fs-extra';
import dotenv from 'dotenv';
import recursive from 'recursive-readdir';
import pMap from 'p-map';
import { flatten } from 'lodash-es';
import { first, flatten } from 'lodash-es';
import { fileURLToPath } from 'url';
import { parse } from '../src/songParser.js';
import { print } from '../src/songPrinter.js';
import {
COLON,
logFileWithLinkInConsole,
logProcessingFile,
NEW_LINE,
Expand Down Expand Up @@ -56,7 +57,8 @@ const runFor = async (songsDirs: string[]) => {
.map(({ rcId }) => rcId)
.filter(Boolean);

await pMap(RC_IDS_TO_PROCESS, async (rcSongIdToImport) => {
await pMap(RC_IDS_TO_PROCESS, async (rcSongIdLine) => {
const rcSongIdToImport = first(rcSongIdLine.split(COLON)) as string;
const filePath = RC_INDEX[rcSongIdToImport] as string;
const contentAsString = fsExtra
.readFileSync(filePath.replace('./', `${IN_LYRICS_PARSER}/`))
Expand Down
65 changes: 0 additions & 65 deletions temp-runners/rc_authors_to_process.txt
Original file line number Diff line number Diff line change
@@ -1,67 +1,2 @@
10:BBSO:Bbso
10:Excelsis Worship:Excelsis_worship
10:Excelsis Worship:Excelsis_worship
10:Omega:Omega
10:William J. Gaither:William_j_gaither
11:Callatis Praise:Callatis_praise
11:Eldad:Eldad
11:Florin Mesaroș:Florin_mesaros
11:Messis:Messis
11:Ramona Ibănescu:Ramona_ibanescu
12:Grup Eldad:Grup_eldad
12:Ionuţ Crăciun:Ionut_craciun
13:Andreea Popoi:Andreea_popoi
14:Emma Repede:Emma_repede
14:Sunny Tranca:Sunny_tranca
17:Ami şi Crista:Ami_si_crista
18:Ekklesia:Ekklesia
18:Grupul Eldad:Grupul_eldad
2:Armonix:Armonix
2:Bbso Baia Mare:Bbso_baia_mare
3:Adi Lup:Adi_lup
3:Ahava:Ahava
3:Alin, Emima Timofte:Alin_emima_timofte
3:Avalon:Avalon
3:Biserica Betania Dublin:Biserica_betania_dublin
3:Grupul Ava:Grupul_ava
3:Ioan Panican:Ioan_panican
3:Kari Jobe:Kari_jobe
4:Born again:Born_again
4:Casting Crowns:Casting_crowns
4:Damaris Cauneac:Damaris_cauneac
4:Elim Harmony Band:Elim_harmony_band
4:Harvest Arad:Harvest_arad
4:Iovan Miclea:Iovan_miclea
4:Sanctus Pro Deo:Sanctus_pro_deo
5:Adi Kovaci:Adi_kovaci
5:Agape:Agape
5:Betania Worship Dublin:Betania_worship_dublin
5:Contrast:Contrast
5:Eliza Pirosca:Eliza_pirosca
5:Marius Pop, Naomi Borota:Marius_pop_naomi_borota
5:Marius Pop:Marius_pop
5:Ruben Filoti:Ruben_filoti
5:Samuel Bratu:Samuel_bratu
5:Speranța_pentru_copii:Sperantapentrucopii
5:Utu Şuteu:Utu_suteu
5:William H.Doane:William_hdoane
6:Chris Tomlin:Chris_tomlin
6:Diana Pup:Diana_pup
6:Ekklesia Arad:Ekklesia_arad
6:Flaviu Mitar:Flaviu_mitar
6:Ioan Timofte:Ioan_timofte
6:Profides:Profides
6:Shalom:Shalom
6:Traian Dorz si Nicolae Moldoveanu:Traian_dorz_si_nicolae_moldoveanu
7:Andreea Mois:Andreea_mois
7:Andreea şi Andrei Mois:Andreea_si_andrei_mois
7:David Lela:David_lela
7:Dolores:Dolores
7:Laud:Laud
7:Michael W. Smith:Michael_w_smith
7:Not an idol:Not_an_idol
8:Grupul Speranta:Grupul_speranta
8:Tabara 477:Tabara
9:Adonia:Adonia
9:Chris:Chris
9:Dan Muncaciu:Dan_muncaciu
1 change: 0 additions & 1 deletion temp-runners/rc_ids_to_process.txt
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
212152

0 comments on commit adc8e42

Please sign in to comment.