Skip to content

Commit

Permalink
Imported resurse crestine songs based on rc_authors_to_process.txt an…
Browse files Browse the repository at this point in the history
…d rc_ids_to_process.txt.
  • Loading branch information
ioanlucut committed Oct 2, 2023
1 parent 31548c1 commit 6586ff2
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 89 deletions.
55 changes: 53 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
name: 'CI (Continuous Integration) & Auto Update Songs Meta'

on: [pull_request]
on: [ pull_request ]

jobs:
PathsFilter:
runs-on: ubuntu-latest
outputs:
rcOutput: ${{ steps.filter.outputs.rcImportsHaveChanged }}
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}

- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
rcImportsHaveChanged:
- 'temp-runners/rc_authors_to_process.txt'
- 'temp-runners/rc_ids_to_process.txt'
Build:
needs: PathsFilter
runs-on: ubuntu-latest
steps:
- name: Clone repository
Expand All @@ -25,8 +44,39 @@ jobs:
CI: true
FORCE_COLOR: 2

AutoImportFromRC:
needs: [ Build, PathsFilter ]
runs-on: ubuntu-latest
if: needs.PathsFilter.outputs.rcOutput == 'true'
steps:
- name: Checkout bes-lyrics-parser repo
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT_BES_PROJECTS }}
repository: ioanlucut/bes-lyrics-parser
path: bes-lyrics-parser
sparse-checkout: |
out
- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: Import from RC (if not exists already)
run: |
npm i && npm run import:rc:ci
git config user.name github-actions
git config user.email [email protected]
git add -A
git diff --quiet && git diff --staged --quiet || git commit -am "[Bot] I have imported the resurse crestine songs based on the rc_authors_to_process.txt and rc_ids_to_process.txt."
git push
env:
CI: true
FORCE_COLOR: 2

AutoUpdateMeta:
needs: Build
needs: AutoImportFromRC
runs-on: ubuntu-latest
steps:
- name: Clone repository
Expand All @@ -52,6 +102,7 @@ jobs:
>
>
skip-checks: true"
git push
env:
CI: true
FORCE_COLOR: 2
2 changes: 1 addition & 1 deletion .github/workflows/deploy_to_gdrive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
node-version: 20.x

- name: Run GDrive remote deployment from bes-propres7-migrator
working-directory: ./bes-propres7-migrator
working-directory: bes-propres7-migrator
run: |
npm i && npm run convert:remote
env:
Expand Down
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 && npm run reprocess:filename && npm run reprocess:content && npm run format",
"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
12 changes: 7 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export * from './types.js';
export * as contentReplacerReprocessor from './contentReplacerReprocessor.js';
export * as contentStructureReprocessor from './contentStructureReprocessor.js';
export * as lyricsFileNameReprocessor from './lyricsFileNameReprocessor.js';
export * from './charsStatsCollector.js';
export * from './constants.js';
export * from './contentStructureValidator.js';
export * from './core.js';
export * from './constants.js';
export * as lyricsFileNameReprocessor from './lyricsFileNameReprocessor.js';
export * as contentStructureReprocessor from './contentStructureReprocessor.js';
export * as contentReplacerReprocessor from './contentReplacerReprocessor.js';
export * from './songParser.js';
export * from './songPrinter.js';
export * from './types.js';
19 changes: 11 additions & 8 deletions temp-runners/importSongsFromRcByAuthors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,26 @@ import recursive from 'recursive-readdir';
import pMap from 'p-map';
import { 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,
parse,
print,
} from '../src/index.js';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

dotenv.config();

const RC_BASE = '/Users/ilucut/WORK/BES/bes-lyrics-parser';
const RC_DIR = `${RC_BASE}/out/resurse_crestine`;
const CANDIDATES_DIR = `/Users/ilucut/WORK/BES/bes-lyrics/candidates`;
const RC_DIR = `${path.join(
__dirname,
'../../',
'bes-lyrics-parser',
)}/out/resurse_crestine`;

const CANDIDATES_DIR = './candidates';

const rcAuthorPathsToProcess = fsExtra
.readFileSync(`${__dirname}/rc_authors_to_process.txt`)
Expand Down Expand Up @@ -49,7 +54,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 All @@ -66,8 +71,6 @@ const runFor = async (songsDirs: string[]) => {
console.log(
`Skip processing the song with RC ID ${rcSongAST.rcId} as we have it in our system.`,
);
console.log(NEW_LINE);

return;
}

Expand Down
15 changes: 8 additions & 7 deletions temp-runners/importSongsFromRcByIds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,24 @@ 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,
parse,
print,
} from '../src/index.js';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

dotenv.config();

const IN_LYRICS_PARSER = '../bes-lyrics-parser';
const IN_LYRICS_PARSER = path.join(__dirname, '../../', 'bes-lyrics-parser');
const IN_LYRICS_PARSER_GENERATED_RC_SONGS = `${IN_LYRICS_PARSER}/out/resurse_crestine`;

const OUT_CANDIDATES_RC_DIR = './candidates/resurse_crestine_raw';

const RC_IDS_TO_PROCESS = fsExtra
Expand Down Expand Up @@ -56,7 +58,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 All @@ -71,8 +74,6 @@ const runFor = async (songsDirs: string[]) => {
console.log(
`Skip processing the song with RC ID ${rcSongAST.rcId} as we have it in our system.`,
);
console.log(NEW_LINE);

return;
}

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 6586ff2

Please sign in to comment.