Skip to content

Commit

Permalink
Add remote upload capability
Browse files Browse the repository at this point in the history
  • Loading branch information
ioanlucut committed Aug 10, 2023
1 parent 825cc90 commit 78601cb
Show file tree
Hide file tree
Showing 27 changed files with 1,571 additions and 109 deletions.
2 changes: 0 additions & 2 deletions .env

This file was deleted.

4 changes: 4 additions & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
TZ=Europe/Bucharest
LOCAL_SOURCE_DIR=../bes-lyrics/verified
LOCAL_OUT_DIR=./out_temp_for_local
CONNECT_TO_G_DRIVE=false
7 changes: 5 additions & 2 deletions .env.remote
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
SOURCE_DIR=../bes-lyrics/verified
OUT_DIR=/Users/ilucut/WORK/BES/CLOUD DATA/ProPresenter_Generated/ProPresenter_Generated_Version_10
TZ=Europe/Bucharest
LOCAL_SOURCE_DIR=../bes-lyrics/verified
LOCAL_OUT_DIR=./out_temp_for_remote
GDRIVE_ROOT_FOLDER_ID=1jjGoKWLbYskXWsCcOgjtQiynCUs-lslB
CONNECT_TO_G_DRIVE=true
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#### Motivation and context

<!--- Why is this change required? -->

#### Checklist:

- [x] I covered my changes with tests
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on: [pull_request]

jobs:
Build:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Use Node.js 20.x
uses: actions/setup-node@v3
with:
node-version: 20.x

- name: Install dependencies
run: npm i

- name: Build
run: npm run test
env:
CI: true
FORCE_COLOR: 2
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
node_modules/
.idea
pp7-songs
out_temp_for_local
.env.debug
out_temp_for_remote
5 changes: 0 additions & 5 deletions .run/Run migrator.run.xml

This file was deleted.

8 changes: 8 additions & 0 deletions .run/[Debug] Run converter.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[Debug] Run converter" type="NodeJSConfigurationType" node-parameters="--require ts-node/register --require dotenv/config" path-to-js-file="runner.ts" working-dir="$PROJECT_DIR$">
<envs>
<env name="DOTENV_CONFIG_PATH" value="./.env.debug" />
</envs>
<method v="2" />
</configuration>
</component>
5 changes: 5 additions & 0 deletions .run/[Local] Run converter.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="[Local] Run converter" type="NodeJSConfigurationType" node-parameters="--require ts-node/register" path-to-js-file="runner.ts" working-dir="$PROJECT_DIR$">
<method v="2" />
</configuration>
</component>
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,26 @@ Domn al veșniciei, în veci! Amin!
- Assuming that the following config is fine:

```dotenv
SOURCE_DIR=directory-with-txt-songs
OUT_DIR=directory-with-pro-songs
LOCAL_SOURCE_DIR=directory-with-txt-songs
LOCAL_OUT_DIR=directory-with-pro-songs
```

Simply run the `npm run migrate:local`
Simply run the `npm run convert:local`

### How to customize the runner

- Pass the following env variables with your source and out directories

```dotenv
SOURCE_DIR=directory-with-txt-songs
OUT_DIR=directory-with-pro-songs
LOCAL_SOURCE_DIR=directory-with-txt-songs
LOCAL_OUT_DIR=directory-with-pro-songs
```

- Use the `migrateSongsToPP7Format` method to do the conversion as follows:
- Use the `convertSongsToPP7FormatLocally` method to do the conversion as follows:

```typescript
import dotenv from 'dotenv';
import { Config, migrateSongsToPP7Format } from './';
import { Config, convertSongsToPP7FormatLocally } from './';
import { Presentation_CCLI } from './proto/presentation';
import { Graphics_Text_Attributes_Font } from './proto/graphicsData';

Expand Down Expand Up @@ -87,10 +87,9 @@ const CONFIG = {
'A macro name for referencing the macro id in the first intro blank slide',
};

migrateSongsToPP7Format({
sourceDir: process.env.SOURCE_DIR as string,
outDir: process.env.OUT_DIR as string,
clearOutputDirFirst: true,
convertSongsToPP7FormatLocally({
sourceDir: process.env.LOCAL_SOURCE_DIR as string,
baseLocalDir: process.env.LOCAL_OUT_DIR as string,
config: CONFIG,
});
```
Expand Down
7 changes: 7 additions & 0 deletions environment.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ declare global {
interface ProcessEnv {
CANDIDATES_DIR: string;
VERIFIED_DIR: string;
GDRIVE_ROOT_FOLDER_ID: string;
CONNECT_TO_G_DRIVE: string;

// Injected from GH Secrets
GDRIVE_BES_CLIENT_ID: string;
GDRIVE_BES_CLIENT_SECRET: string;
GDRIVE_BES_CLIENT_REFRESH_TOKEN: string;
}
}
}
Expand Down
Loading

0 comments on commit 78601cb

Please sign in to comment.