youtube-cue/README.md

88 lines
3.5 KiB
Markdown
Raw Permalink Normal View History

2021-06-28 18:23:40 +00:00
# youtube-cue ![npm](https://img.shields.io/npm/v/youtube-cue) ![Libraries.io dependency status for latest release](https://img.shields.io/librariesio/release/npm/youtube-cue) ![NPM](https://img.shields.io/npm/l/youtube-cue) ![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/youtube-cue) [![Total Dependencies](https://img.shields.io/badge/Total%20Dependencies-4-orange)](https://www.npmjs.com/package/youtube-cue)
2017-06-07 20:26:45 +00:00
2021-06-28 08:44:19 +00:00
Generate CUE sheet from timestamps in youtube video description.
2017-06-07 20:26:45 +00:00
2021-06-28 08:44:19 +00:00
## What is this for?
1. If you have DJ-mix or album on YouTube that you'd like to generate a [CUE sheet][cue] for.
2. The video has timestamps in the video description.
3. The video is publicly available on Youtube.
2021-07-21 08:20:48 +00:00
`youtube-cue` will read the video description, get the timestamps and generate a [CUE sheet][cue] accordingly. It will also work if track durations are used instead of timestamps.
2021-06-28 08:44:19 +00:00
## Anti-features
1. It does not download tracks from YouTube
2. It does not split your tracks
3. It does not tag your tracks.
For all of the above, there are better tools available, such as [youtube-dl](https://ytdl-org.github.io/youtube-dl/), [m4acut](https://github.com/nu774/m4acut), [mp3splt](https://sourceforge.net/projects/mp3splt/), [cuetools](https://github.com/svend/cuetools), [beets](https://beets.io) and many more. youtube-cue tries to [do one thing well](https://onethingwell.org/).
2017-06-07 20:26:45 +00:00
## Installation
2021-05-30 15:31:27 +00:00
npm install -g youtube-cue
2017-06-07 20:26:45 +00:00
2021-06-28 08:44:19 +00:00
## Upgrade
npm update -g youtube-cue
2017-06-07 20:26:45 +00:00
## Usage
2021-06-28 08:44:19 +00:00
You need to pass 2 parameters, a Youtube URL and a output CUE filename. YouTube short URLs (`youtu.be`) are accepted. You can additionally pass a `audio-file` argument which is used for the [`FILE` specified in the CUE file][cuefile].
youtube-cue [--audio-file audio.m4a] <youtube_url> [output_file]
2021-06-01 07:02:16 +00:00
Options
--help, Show help
--audio-file, Input Audio File (optional) that is written to the CUE sheet
The default audio file is set to %VIDEOTITLE.m4a
The default output file is set to %VIDEOTITLE.cue
where $VIDEOTITLE is the title of the YouTube video.
2021-06-01 07:02:16 +00:00
Generally the parser detects whether numbers are positional timestamps or track durations.
To enforce a desired interpretation you can use these flags:
2021-07-21 08:20:48 +00:00
--timestamps Parse as positional timestamps (relative to the start of the playlist)
--durations Parse as track durations
The above 2 are only needed to force behaviour in
very specific edge cases, they should not be required for most files.
2021-07-21 08:20:48 +00:00
2021-06-01 07:02:16 +00:00
Examples
2023-12-14 06:04:36 +00:00
$ youtube-cue --audio-file audio.m4a "https://www.youtube.com/watch?v=WzpmVxvoBoc" "The Groovy Nobody - Solarium.cue"
"The Groovy Nobody - Solarium.cue" saved
2017-06-07 20:26:45 +00:00
2021-06-01 07:09:54 +00:00
## Personal Usage
2023-12-14 06:04:36 +00:00
I have this in my `.bashrc` to download, split, tag, and import albums using beet:
2021-06-01 07:09:54 +00:00
```shell
function ytdl.album() {
cd $(mktemp -d)
youtube-dl -f "bestaudio[ext=m4a]" --output "audio.m4a" "$1"
youtube-cue --audio-file "audio.m4a" "$1" tracks.cue
m4acut -C tracks.cue "audio.m4a" && \
trash audio.m4a && \
beet import -map .
}
```
2017-06-07 20:26:45 +00:00
## HACKING
2021-07-21 08:20:48 +00:00
- If it does not work on a specific video, please attach the complete output
2017-06-07 20:26:45 +00:00
- Pull Requests are welcome that add support for a better parser without breaking the existing tests
- Please add tests for any new functionality
## License
Licensed under the [MIT License][mit]
[mit]: https://nemo.mit-license.org/
2017-06-07 20:30:26 +00:00
[rdd]: http://tom.preston-werner.com/2010/08/23/readme-driven-development.html
2021-06-28 08:44:19 +00:00
[cue]: https://en.wikipedia.org/wiki/Cue_sheet_(computing)
[cuefile]: https://en.wikipedia.org/wiki/Cue_sheet_(computing)#Essential_commands