-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathREADME.md
194 lines (153 loc) · 8.58 KB
/
README.md
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<p align="center">
<a href="" rel="noopener">
<img width=200px height=200px src="../assets/logos/logo.png?raw=true" alt="Project logo"></a>
</p>
<h3 align="center">Bragibooks</h3>
<div align="center">
[]()
[](https://github.com/djdembeck/bragibooks/issues)
[](https://github.com/djdembeck/bragibooks/pulls)
[](https://github.com/djdembeck/bragibooks/blob/develop/LICENSE)
[](https://github.com/djdembeck/bragibooks/actions/workflows/docker-publish.yml)
[](https://hub.docker.com/r/djdembeck/bragibooks)
[](https://hub.docker.com/r/djdembeck/bragibooks)
[](https://hub.docker.com/r/djdembeck/bragibooks)
[](https://www.codefactor.io/repository/github/djdembeck/bragibooks)
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
</div>
---
<p align="center"> An audiobook library cleanup & management app, written as a frontend for web use of <a href="https://github.com/djdembeck/m4b-merge">m4b-merge</a>.
<br>
</p>
## 📝 Table of Contents
- [About](#about)
- [Getting Started](#getting_started)
- [Usage](#usage)
- [Built Using](#built_using)
- [Contributing](../CONTRIBUTING.md)
- [Authors](#authors)
- [Contributors](#contributors)
## 🧐 About <a name = "about"></a>
**Bragi - (god of poetry in [Norse mythology](https://en.wikipedia.org/wiki/Bragi)):**
Bragibooks provides a minimal and straightforward webserver that you can run remotely or locally on your server. Since Bragibooks runs in a docker, you no longer need to install dependencies on whichever OS you are on. You can
Some basics of what Bragi does:
- Merge multiple files
- Convert mp3(s)
- Cleanup existing data on an m4b file
- More features on [m4b-merge's help page](https://github.com/djdembeck/m4b-merge)
### Screens
Folder/file selection | ASIN input
:-------------------------:|:-------------------------:
 | 
Folder/file selection | Post-proccess overview
:-------------------------:|:-------------------------:
 | 
## 🏁 Getting Started <a name = "getting_started"></a>
You can either install this project directly or run it prepackaged in Docker.
### Prerequisites
#### Docker
- All prerequisites are included in the image.
#### Direct (Gunicorn)
- You'll need to install m4b-tool and it's dependants from [the project's readme](https://github.com/sandreas/m4b-tool#installation)
- Run `pip install -r requirements.txt` from this project's directory.
### Installing
#### Docker
To run Bragibooks as a container, you need to pass some paramaters in the run command:
| Parameter | Function |
| :----: | --- |
| `-v /path/to/input:/input` | Input folder |
| `-v /path/to/output:/output` | Output folder |
| `-v /appdata/bragibooks/config:/config` | Persistent config storage |
| `-p 8000:8000/tcp` | Port for your browser to use |
| `-e LOG_LEVEL=WARNING` | Choose any [logging level](https://www.loggly.com/ultimate-guide/python-logging-basics/) |
| `-e DEBUG=False` | Turn django debug on or off (default False) |
| `-e UID=99` | User ID to run the container as (default 99)|
| `-e GID=100` | Group ID to run the container as (default 100)|
| `-e CELERY_WORKERS=1` | The number or celery workers for processing books (default 1)|
| `-e CSRF_TRUSTED_ORIGINS=https://bragibooks.mydomain.com` | Domains to trust if bragibooks is hosted behind a reverse proxy. |
Which all together should look like:
docker run --rm -d --name bragibooks -v /path/to/input:/input -v /path/to/output:/output -v /appdata/bragibooks/config:/config -p 8000:8000/tcp -e LOG_LEVEL=WARNING ghcr.io/djdembeck/bragibooks:main
## Docker Compose
```
version: '3'
services:
bragi:
image: ghcr.io/djdembeck/bragibooks:main
container_name: bragibooks
environment:
- CSRF_TRUSTED_ORIGINS=https://bragibooks.mydomain.com
- LOG_LEVEL=INFO
- DEBUG=False
- UID=1000
- GID=1000
volumes:
- path/to/config:/config
- path/to/input:/input
- path/to/output/output:/output
- path/to/done:/done
ports:
- 8000:8000
restart: unless-stopped
```
#### Direct Build (Gunicorn)
- Copy static assets to project folder:
```
python manage.py collectstatic
```
- Create the database:
```
python manage.py migrate
```
- Run the celery worker for processing books:
```
celery -A bragibooks_proj worker \
--loglevel=info \
--concurrency 1 \
-E
```
- Run the web server:
```
gunicorn bragibooks_proj.wsgi \
--bind 0.0.0.0:8000 \
--timeout 1200 \
--worker-tmp-dir /dev/shm \
--workers=2 \
--threads=4 \
--worker-class=gthread \
--reload \
--enable-stdio-inheritance
```
## 🎈 Usage <a name="usage"></a>
The Bragibooks process is a linear, 3 step process:
1. __Select input__ - Use the file multi-select box to choose which books to process this session, and click next.
2. __Submit ASINs__ - Bragi will auto search for the audiobook data on [Audible.com](https://www.audible.com) (US only). If the data found is incorrect you can do a custom search to find the correct title and then submit for processing.
3. Wait for books to finish processing. This can take anywhere from 10 seconds to a few hours, depending on the number and type of files submitted. This will be done in the background.
4. __Books page__ - Page where you can see the data assigned to each book after it has finished processing. You can also check the status of the books still being processed.
## ⛏️ Built Using <a name = "built_using"></a>
- [Django](https://www.djangoproject.com/) - Server/web framework
- [Celery](https://docs.celeryq.dev/en/stable/getting-started/introduction.html) - Task queue and worker
- [Bulma](https://bulma.io/) - Frontend CSS framework
- [audnexus](https://github.com/laxamentumtech/audnexus) - API backend for metadata
- [m4b-merge](https://github.com/djdembeck/m4b-merge) - File merging and tagging
## ✍️ Authors <a name = "authors"></a>
<img src="https://github.com/djdembeck.png?size=100"/>
[@djdembeck](https://github.com/djdembeck) - Idea & Initial work
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://koby.huckabee.dev"><img src="https://avatars.githubusercontent.com/u/14910857?v=4?s=100" width="100px;" alt="Koby Huckabee"/><br /><sub><b>Koby Huckabee</b></sub></a><br /><a href="https://github.com/djdembeck/bragibooks/commits?author=AceTugboat" title="Code">💻</a> <a href="#ideas-AceTugboat" title="Ideas, Planning, & Feedback">🤔</a> <a href="https://github.com/djdembeck/bragibooks/commits?author=AceTugboat" title="Documentation">📖</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://pilabor.com"><img src="https://avatars.githubusercontent.com/u/2050604?v=4?s=100" width="100px;" alt="Andreas"/><br /><sub><b>Andreas</b></sub></a><br /><a href="#tool-sandreas" title="Tools">🔧</a></td>
</tr>
</tbody>
</table>
<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!