get-tracks/README.md

58 lines
1.4 KiB
Markdown
Raw Normal View History

# Get Tracks
`get-tracks.sh` allows you to easily extract music tracks from a file with multiple songs, like a CD-in-a-file.
2021-03-27 21:18:08 +01:00
# Required applications
`get-tracks.sh` is a simple shell script based around `ffmpeg`, using `xxd` and `awk`.
2021-03-27 21:18:08 +01:00
* ffmpeg
* xxd (with '-r' and '-p' options)
* awk
2021-03-27 21:18:08 +01:00
It was tested on both OpenBSD and Linux.
2021-03-27 21:18:08 +01:00
# Usage
Download a CD and the starting time of each track in a file, and you're good to go.
2021-03-27 21:18:08 +01:00
```Bash
get-tracks.sh <audio-file> <time-file>
2021-04-06 16:10:02 +02:00
# Example
get-track.sh doom-eternal.opus doom-eternal.txt
2021-03-27 21:18:08 +01:00
```
*audio-file* can be in any format understood by `ffmpeg`.
2021-03-27 21:18:08 +01:00
The *time-file* must have this format:
2021-03-27 21:18:08 +01:00
```
0:00 intro
2:20 First song
2021-03-27 21:18:08 +01:00
3:18 Awesome song
```
# Environment variables
* **SIMULATION** [empty or not]\
do not invoke ffmpeg
* **NONUMBER** [empty or 1]\
do not write song numbers
* **FORMAT** [mp3,ogg,opus,…]\
see the ffmpeg documentation for the output formats available
* **SEPARATOR** [separator] (default: ' - ')\
separator between number and name\
example with SEPARATOR='_': 01_intro.opus 02_blah.opus…
* **HEADERS** [empty or 1]\
print environment parameters (verbosity, simulation, etc.)
2021-04-06 16:10:02 +02:00
* **VERBOSITY** [0-3] (default: 1)\
0: no output except errors from ffmpeg\
1: simple indications on the current track being extracted\
2: print actual ffmpeg commands the script currently runs
2021-03-27 21:18:08 +01:00
# More
Run `get-track.sh` without arguments.