Skip to content

Commit

Permalink
Merge branch 'gui'
Browse files Browse the repository at this point in the history
  • Loading branch information
jersou committed Oct 4, 2024
2 parents 4e8cf7b + b980ee7 commit 9662111
Show file tree
Hide file tree
Showing 293 changed files with 43,321 additions and 628 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish

on:
push:
branches:
- main

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- run: npx jsr publish
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
/.idea/inspectionProfiles
/.idea/sonarlint/
/.idea/
/gui/node_modules/
/gui/src-tauri/target/
/gui/dist
/gui/.vite
3 changes: 3 additions & 0 deletions .idea/deno.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions .idea/misc.xml

This file was deleted.

6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
### v?.?.? / ????.??.??

- feat: Studio Pack Generator GUI !
- feat: json config file
- update dependencies, refactor, use jsr

### v0.4.4 / 2024.10.02

- feat: now support split by season with many new options by @farfromrefug. See
Expand Down
103 changes: 78 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Examples:

## Optional dependencies

**[Windows release](https://github.com/jersou/studio-pack-generator/releases) of
studio-pack-generator embeds these tools in zip file, and use Windows TTS
instead of picoTTS (unless you have WSL and picoTTS installed).**

- **ffmpeg** : used to extract images from story mp3 files, increase volume of
files, convert to the right format.
<br>→ Use `--skip-audio-convert` and `--skip-extract-image-from-mp3` to avoid
Expand All @@ -39,10 +43,6 @@ Examples:
Install optional dependencies :
`sudo apt update && sudo apt install -y ffmpeg libttspico-utils imagemagick`

[Windows release](https://github.com/jersou/studio-pack-generator/releases) of
studio-pack-generator embeds these tools in zip file, and use Windows TTS
instead of picoTTS (unless you have WSL and picoTTS installed).

Use "-miva" option to skip all generations that use these tools.

## Install studio-pack-generator
Expand All @@ -56,30 +56,21 @@ or studio-pack-generator-aarch64-apple "my story folder or a rss url"
or studio-pack-generator-x86_64-apple "my story folder or a rss url"
```

### Or use [Deno](https://deno.land/)
#### Or clone the repo and run with [Deno](https://deno.land/) :

This project is written in Typescript for [deno](https://deno.land/) runtime.
Install deno : https://deno.land/#installation

#### Run from web directly (will be cached for the next launches) :

```
deno run -A https://raw.githubusercontent.com/jersou/studio-pack-generator/main/studio_pack_generator.ts "my story folder or a rss url"
```

#### Or install with deno :
Install deno : https://deno.land/

```
deno install --name studio-pack-generator -A --unstable -f https://raw.githubusercontent.com/jersou/studio-pack-generator/main/studio_pack_generator.ts
→ and then run : studio-pack-generator "my story folder or a rss url"
git clone https://github.com/jersou/studio-pack-generator
cd studio-pack-generator
deno -A studio_pack_generator.ts "my story folder or a rss url"
```

#### Or clone the repo and run with deno :
#### Or run from web directly (will be cached for the next launches) :

```
git clone https://github.com/jersou/studio-pack-generator
cd studio-pack-generator
deno run -A studio_pack_generator.ts "my story folder or a rss url"
deno -A jsr:@jersou/studio-pack-generator "my story folder or a rss url"
```

## Story folder structure
Expand Down Expand Up @@ -203,7 +194,13 @@ The "super pack" will look like :
- Image formats : png, jpg, bmp.
- Audio formats : mp3, ogg, opus, wav.
## Usage
## GUI
TODO
no RSS
## CLI usage
```
deno run -A studio_pack_generator.ts [options] <story path | RSS URL> convert a folder or a RSS URL to Studio pack
Expand All @@ -218,13 +215,12 @@ Options:
-o, --output-folder zip output folder [string]
-c, --seek-story cut the beginning of stories: 'HH:mm:ss' format or 'N' sec [string]
-v, --skip-audio-convert skip convert audio (and skip increase volume) [boolean] [default: false]
-j, --skip-image-convert skip convert image [boolean] [default: false]
-j, --skip-image-convert skip image convert [boolean] [default: false]
-a, --skip-audio-item-gen skip audio item generation [boolean] [default: false]
-m, --skip-extract-image-from-mp3 skip extract item image from story mp3 [boolean] [default: false]
-i, --skip-image-item-gen skip image item generation [boolean] [default: false]
--image-item-gen-font font used for image item generation [string] [default: "Arial"]
--thumbnail-from-first-item generate thumbnail from first item instead of first chapter
[boolean] [default: false]
--thumbnail-from-first-item gen thumbnail from first item instead of first chapter [boolean] [default: false]
-s, --skip-not-rss skip all except download RSS files [boolean] [default: false]
--rss-split-length RSS will be split in parts of N length [number] [default: 10]
--rss-split-seasons RSS create different packs per season [boolean] [default: false]
Expand All @@ -243,6 +239,9 @@ Options:
--coqui-tts-language-idx coqui TTS language_idx [string] [default: "fr"]
--coqui-tts-speaker-idx coqui TTS speaker_idx [string] [default: "Abrahan Mack"]
-x, --extract extract a zip pack (reverse mode) [boolean] [default: false]
-u, --gui open GUI (on localhost:5555) [boolean] [default: false]
--port port of GUI server [number] [default: 5555]
--config-file json config file [string]
```

Separate options by spaces, ex :
Expand All @@ -268,6 +267,8 @@ Separate options by spaces, ex :
- Option to add 1 sec of silence at the beginning and end of sound files.
- Option to skip the beginning of stories.
- Zip Pack aggregation
- OpenAI & Coqui TTS
- a GUI

### Overwrite metadata

Expand All @@ -294,7 +295,7 @@ To use OpenAI TTS, use `--use-open-ai-tts` option, and you must set the API key:
- or use --open-ai-api-key parameter
- or enter the key when the program prompt

## reverse process : extract pack from zip
## Reverse process : extract pack from zip

Extract a file stucture from zip pack :

Expand All @@ -317,6 +318,58 @@ studio-pack-generator -x -o output/dir 2-full.zip
Note: it doesn't work well with "menu" nodes and with pack without "question"
stage.
## json config file
The parameters can be imported from a json file with :
```
--config-file=<json file path>
```
File format (all the properties are optionals) :
```json
{
"addDelay": false,
"autoNextStoryTransition": false,
"selectNextStoryAtEnd": false,
"nightMode": false,
"skipAudioConvert": false,
"skipImageConvert": false,
"skipAudioItemGen": false,
"skipExtractImageFromMp3": false,
"skipImageItemGen": false,
"skipNotRss": false,
"skipRssImageDl": false,
"skipWsl": false,
"skipZipGeneration": false,
"useOpenAiTts": false,
"lang": "fr-FR",
"outputFolder": "/tmp/",
"seekStory": "1",
"openAiApiKey": "",
"openAiModel": "tts-1",
"openAiVoice": "onyx",
"gui": false,
"imageItemGenFont": "Arial",
"thumbnailFromFirstItem": false,
"rssSplitLength": 10,
"rssSplitSeasons": false,
"rssMinDuration": 0,
"rssUseImageAsThumbnail": false,
"useThumbnailAsRootImage": false,
"useCoquiTts": false,
"coquiTtsModel": "tts_models/multilingual/multi-dataset/xtts_v2",
"coquiTtsLanguageIdx": "fr",
"coquiTtsSpeakerIdx": "Abrahan Mack",
"port": 5555
}
```
At the end of the generation, a file `0-config.json` will be written in the
story folder. It can be use for the next run :
`studio_pack_generator --config-file="<story path>/0-config.json" "<story path>"`
## Development
Some dev command are listed in the deno.json file :
Expand Down
40 changes: 29 additions & 11 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,33 @@
{
"version": "0.5.0",
"license": "MIT",
"name": "@jersou/studio-pack-generator",
"tasks": {
"bundle": "deno bundle studio_pack_generator.ts dist/studio_pack_generator.js",
"fmt": "deno fmt --ignore=vendor,dist,.cov_profile,tmp,gui",
"fmt": "deno fmt --ignore=gui/assets_bundle.json,gui/frontend,tmp,dist,.cov_profile,vendor",
"gen-bin": "./gen-bin.sh",
"gen-cov": "rm -rf .cov_profile && deno test --coverage=.cov_profile -A && deno coverage .cov_profile --lcov --exclude=vendor > .cov_profile/cov_profile.lcov && genhtml -o .cov_profile/html .cov_profile/cov_profile.lcov",
"lint": "deno lint --ignore=vendor,dist,tmp,gui",
"pre-commit": "deno fmt --ignore=vendor,dist,tmp,gui --check && deno lint --ignore=vendor,dist && deno test -A --ignore=vendor,dist --no-check",
"pre-commit-fast": "deno run -A pre-commit-fast.ts",
"start": "deno run -A --unstable studio_pack_generator.ts",
"test": "deno test -A --ignore=vendor,dist,.cov_profile,tmp,gui",
"test-watch": "deno test -A --watch --unstable",
"vendor": "rm -rf vendor/; deno vendor --config .empty-config.json --force studio_pack_generator.ts deps.ts test_deps.ts pre-commit-fast.ts; echo '{\n}' > .empty-config.json"
}
"gen-cov": "rm -rf .cov_profile && deno test --ignore=gui/assets_bundle.json,gui/frontend,tmp,dist,.cov_profile,vendor --coverage=.cov_profile -A && deno coverage .cov_profile --lcov > .cov_profile/cov_profile.lcov && genhtml -o .cov_profile/html .cov_profile/cov_profile.lcov",
"check": "deno check studio_pack_generator.ts",
"lint": "deno lint --ignore=gui/assets_bundle.json,gui/frontend,tmp,dist,.cov_profile,vendor",
"pre-commit": "deno task fmt --check && deno task lint && deno task test && deno task check",
"start": "deno run -A --unstable studio_pack_generator.ts",
"test": "deno test -A --ignore=gui/assets_bundle.json,gui/frontend,tmp,dist,.cov_profile,vendor",
"test-watch": "deno test -A --watch --unstable --ignore=gui/assets_bundle.json,gui/frontend,tmp,dist,.cov_profile,vendor"
},
"imports": {
"@david/dax": "jsr:@david/dax@^0.42.0",
"@es-toolkit/es-toolkit": "jsr:@es-toolkit/es-toolkit@^1.23.0",
"@jersou/clite": "jsr:@jersou/clite@^0.5.0",
"@std/assert": "jsr:@std/assert@^1.0.6",
"@std/encoding": "jsr:@std/encoding@^1.0.5",
"@std/fmt": "jsr:@std/fmt@^1.0.2",
"@std/fs": "jsr:@std/fs@^1.0.4",
"@std/io": "jsr:@std/io@^0.224.9",
"@std/media-types": "jsr:@std/media-types@^1.0.3",
"@std/path": "jsr:@std/path@^1.0.6",
"@zip-js/zip-js": "jsr:@zip-js/zip-js@^2.7.52",
"https://deno.land/": "./vendor/deno.land/",
"https://deno.land/std/": "./vendor/deno.land/[email protected]/"
},
"exports": "./studio_pack_generator.ts",
"publish": { "exclude": ["tools", "gui/frontend/src", "test_data/"] }
}
Loading

0 comments on commit 9662111

Please sign in to comment.