nicole/README.md

97 lines
3.9 KiB
Markdown
Raw Normal View History

2021-09-29 04:20:27 +02:00
# Nicole - Lyrics Scraper
2021-09-29 15:52:12 +02:00
**N**ew-**I**ntrepid-**C**hief-**O**f-**L**yrics-**E**mbedders (obviously)
2021-09-29 04:20:27 +02:00
2021-09-29 04:24:35 +02:00
## Overview
2022-04-04 05:54:31 +02:00
Nicole is a program that searches for lyrics and writes them into the mp3-tag of a file.
2021-09-29 04:20:27 +02:00
2021-09-29 14:43:58 +02:00
### Files
Nicole supports FLAC and mp3 files. Other files can not be edited (as of now).
Files that do not have a .flac or .mp3 extension are skipped automatically.
2021-09-29 14:52:05 +02:00
- mp3: lyrics are stored in "USLT" tag as "lyrics- "
- flac: lyrics are stored as vorbis-comment with key "LYRICS"
2021-09-29 14:43:58 +02:00
2021-09-29 04:24:35 +02:00
### History
2021-09-29 14:43:58 +02:00
Nicole creates a history of all files that were processed in `~/.configs/nicole`.
2022-04-04 05:54:31 +02:00
If a file is in the history, it will be skipped (unless `-i` is passed).
2021-09-29 04:20:27 +02:00
If the lyrics for a file can not be obtained, it is added to `~/.configs/nicole/failed_files`.
Those files are not skipped, the file only exists so that you can see which lyrics were not downloaded.
2022-04-04 05:54:31 +02:00
If you don't want your files in the history, add the `-n` option.
### genius
Nicole searches for lyrics using the genius api using the "title" and "artist" tags of the file.
If the title and artist names from genius and the tags are similar, the lyrics are scraped from the url obtained through the api.
2021-09-29 14:43:58 +02:00
2021-09-29 04:24:35 +02:00
### azlyrics
2021-09-29 15:39:48 +02:00
Nicole creates an azlyrics.com url from the "title" and "artist" tags of the file.
2021-09-29 04:20:27 +02:00
The lyrics are extracted from the html document using regex.
2022-04-04 05:54:31 +02:00
Unfortunately, there needs to be a 5 second delay between each request to azlyrics.com because the site will block your ip for a while if you send many requests.
### Important Note
Since the lyrics are extracted from html pages and not from an api, the lyrics sites might temporarily block your ip address if you send too many requests.
If that is the case, wait a few hours and try again.
2021-09-29 04:20:27 +02:00
## Usage
2022-04-04 05:54:31 +02:00
### Command line options
2021-09-29 04:28:12 +02:00
- `-d [directory]` process directory [directory]
- `-f [file]` process file [file]
2021-09-29 04:27:35 +02:00
- `-r` go through directories recursively
- `-s` silent, no command-line output
- `-i` ignore history
- `-n` do not write to history
2022-04-04 05:54:31 +02:00
- `-o` overwrite if the file already has lyrics
- `-t` test, do not write lyrics to file, but print to stdout
2021-09-29 04:27:35 +02:00
- `-h` show this
2021-09-29 15:39:48 +02:00
- `--rm_explicit` remove the "[Explicit]" lyrics warning from the song's title tag
2022-04-04 05:54:31 +02:00
- `--site [site]` only search [site] for lyrics (genius or azlyrics)
2021-09-29 04:28:43 +02:00
2021-09-29 04:20:27 +02:00
If you do not specify a directory or file, the program will ask you if you want to use the current working directory.
2022-04-04 05:54:31 +02:00
Example: `nicole -ior -d ~/music/artist --rm_explicit`
2021-09-29 04:20:27 +02:00
2022-04-04 05:54:31 +02:00
## Installation and Updating
To update nicole, simply follow the installation instructions.
### pacman (Arch Linux)
Installing nicole using the Arch Build System also installs the man-page and a zsh completion script if you are using zsh as default shell.
```shell
git clone https://github.com/MatthiasQuintern/nicole.git
cd nicole
makepkg -si
```
### pip
2021-09-29 04:20:27 +02:00
Clone this repository and install it using python-pip.
```shell
git clone https://github.com/MatthiasQuintern/nicole.git
cd nicole
python3 -m pip install .
```
You can also install it system-wide using `sudo python3 -m pip install.`
2022-04-04 05:54:31 +02:00
If you also want to install the man-page and the zsh completion script:
```shell
sudo cp nicole.1.man /usr/share/man/man1/nicole.1
sudo cp _nicole.compdef.zsh /usr/share/zsh/site-functions/_nicole
sudo chmod +x /usr/share/zsh/site-functions/_nicole
```
### Dependencies
- https://github.com/seebye/mutagen: read and write mp3-tags
- https://www.crummy.com/software/BeautifulSoup/: deal with the html from genius
The dependencies will be automatically installed when using the either of the two installation options.
2021-09-29 16:00:05 +02:00
2021-10-03 17:39:43 +02:00
## Changelog
2022-04-04 05:54:31 +02:00
### 2.0
- Nicole now supports lyrics from genius!
2021-10-03 17:39:43 +02:00
### 1.1
- Lyrics are now properly encoded.
2022-04-04 05:54:31 +02:00
- If a title contains parenthesis or umlaute, multiple possible urls will be checked.
2021-10-03 20:31:50 +02:00
- Files are now processed in order
2021-10-03 17:39:43 +02:00
2022-04-04 05:54:31 +02:00
# Copyright
Copyright © 2022 Matthias Quintern. License GPLv3+: GNU GPL version 3 <https://gnu.org/licenses/gpl.html>.\
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.