Metadata-Version: 2.4
Name: artbox
Version: 0.13.0
Summary: ArtBox is a tool set for handling multimedia files.
License: BSD-3-Clause
License-File: LICENSE
Author: Ivan Ogasawara
Author-email: ivan.ogasawara@gmail.com
Requires-Python: >=3.10,<3.14
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Dist: aubio (>=0.4.9)
Requires-Dist: edge-tts (>=6.1.8)
Requires-Dist: ffmpeg-python (>=0.2.0)
Requires-Dist: google-cloud-speech (>=2.24.1)
Requires-Dist: gtts (>=2.3.2)
Requires-Dist: jsonschema (>=4.0)
Requires-Dist: librosa (>=0.10.1)
Requires-Dist: matplotlib (<=3.9)
Requires-Dist: moviepy (>=1.0.3,<2)
Requires-Dist: noisereduce (>=2.0.1,<3)
Requires-Dist: numpy (>=1.20,<2)
Requires-Dist: openai (>=1)
Requires-Dist: pdf2image (>=1.16)
Requires-Dist: pycairo (>=1.25.1,<1.26.0)
Requires-Dist: pydub (>=0.25.1)
Requires-Dist: pygobject (>=3.44.1,<3.49)
Requires-Dist: python-dotenv (>=1.0.0)
Requires-Dist: python-pptx (>=0.6.0)
Requires-Dist: pytubefix (>=5.0)
Requires-Dist: pyyaml (>=6.0)
Requires-Dist: scipy (<1.23)
Requires-Dist: speechrecognition (>=3.10)
Requires-Dist: typer (>=0.9.0)
Requires-Dist: types-tqdm (>=4.67.3.20260205,<5.0.0.0)
Requires-Dist: vosk (>=0.3.45)
Description-Content-Type: text/markdown

# ArtBox

ArtBox is a tool set for handling multimedia files.

- Documentation: https://ggpedia.games
- License: BSD-3 Clause

## Features

TBD

# Setup

ArtBox uses some dependencies that maybe would not work well in your machine. In
order to have everything well installed, create a conda/mamba environment and
install `artbox` there.

```bash
$ mamba create --name artbox "python>=3.8.1,<3.12" pygobject pip
$ conda activate artbox
$ pip install artbox
```

## Examples

For the following examples, create the a temporary folder for artbox:

```bash
$ mkdir /tmp/artbox
```

### Convert text to audio

By default, the `artbox speech` uses
[`edge-tts`](https://pypi.org/project/edge-tts/) engine, but if you can also
specify [`gtts`](https://github.com/pndurette/gTTS) with the flag
`--engine gtts`.

```bash
$ echo "Are you ready to join Link and Zelda in fighting off this unprecedented threat to Hyrule?" > /tmp/artbox/text.md
$ artbox speech text-to-speech \
    --title artbox \
    --input-path /tmp/artbox/text.md \
    --output-path /tmp/artbox/speech.mp3 \
    --engine edge-tts
```

If you need to generate the audio for different language, you can use the flag
`--lang`:

```bash
$ echo "Bom dia, mundo!" > /tmp/artbox/text.md
$ artbox speech text-to-speech \
    --title artbox \
    --input-path /tmp/artbox/text.md \
    --output-path /tmp/artbox/speech.mp3 \
    --lang pt
```

If you are using `edge-tts` engine (the default one), you can also specify the
locale for that language, for example:

```bash
$ echo "Are you ready to join Link and Zelda in fighting off this unprecedented threat to Hyrule?" > /tmp/artbox/text.md
$ artbox speech text-to-speech \
    --title artbox \
    --input-path /tmp/artbox/text.md \
    --output-path /tmp/artbox/speech.mp3 \
    --engine edge-tts \
    --lang en-IN
```

Additionally, if you are using edge-tts, you can specify `--rate`, `--volume`,
and `--pitch`, for example:

```bash
$ echo "Do you want some coffee?" > /tmp/artbox/text.md
$ artbox speech text-to-speech \
    --title artbox \
    --input-path /tmp/artbox/text.md \
    --output-path /tmp/artbox/speech.mp3 \
    --engine edge-tts \
    --lang en \
    --rate +10% \
    --volume -10% \
    --pitch -5Hz
```

### Download a youtube video

If you want to download videos from the youtube, you can use the following
command:

```bash
$ artbox youtube download \
    --url https://www.youtube.com/watch?v=zw47_q9wbBE \
    --output-path /tmp/artbox/
```

The command above downloads using a random resolution. If you want a specific
resolution, use the flat `--resolution`:

```bash
$ artbox youtube download \
    --url https://www.youtube.com/watch?v=zw47_q9wbBE \
    --output-path /tmp/artbox/ \
    --resolution 360p
```

### Create a song based on the musical notes

```bash
# json format
echo '["E", "D#", "E", "D#", "E", "B", "D", "C", "A"]' > /tmp/artbox/notes.txt
$ artbox sound notes-to-audio \
  --input-path /tmp/artbox/notes.txt \
  --output-path /tmp/artbox/music.mp3 \
  --duration 2
```

### Remove the audio from a video

First, download the youtube video `https://www.youtube.com/watch?v=zw47_q9wbBE`
as explained before.

Next, run the following command:

```bash
$ artbox video remove-audio \
  --input-path "/tmp/artbox/The Legend of Zelda Breath of the Wild - Nintendo Switch Presentation 2017 Trailer.mp4" \
  --output-path /tmp/artbox/botw.mp4
```

### Extract the audio from a video

First, download the youtube video `https://www.youtube.com/watch?v=zw47_q9wbBE`
as explained before.

Next, run the following command:

```bash
$ artbox video extract-audio \
  --input-path "/tmp/artbox/The Legend of Zelda Breath of the Wild - Nintendo Switch Presentation 2017 Trailer.mp4" \
  --output-path /tmp/artbox/botw-audio.mp3
```

### Combine audio and video files

First, execute the previous steps:

- Download a youtube video
- Remove the audio from a video
- Extract the audio from a video

Next, run the following command:

```bash
$ artbox video combine-video-and-audio \
  --video-path /tmp/artbox/botw.mp4 \
  --audio-path /tmp/artbox/botw-audio.mp3 \
  --output-path /tmp/artbox/botw-combined.mp4
```

## Additional dependencies

If you want to use Python to play your audio files, you can install `playsound`:

```bash
$ pip wheel --use-pep517 "playsound (==1.3.0)"
```

## Troubleshoot

After installing with `poetry install`:

- Patch `pytube` (ref: https://github.com/pytube/pytube/issues/1773):
  `sed -i 's/(r"^$\\w+\\W")/(r"^\\w+\\W")/' $CONDA_PREFIX/lib/python3.*/site-packages/pytube/cipher.py`

