nicole/readme.md

105 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
2024-05-03 22:42:32 +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.
2024-05-03 22:42:32 +02:00
## genius
2022-04-04 06:14:47 +02:00
Nicole searches for lyrics using the genius api with the "title" and "artist" tags of the file.
2024-05-03 22:42:32 +02:00
If the title and artist names from genius are similar enough to the ones of the file,
the lyrics are scraped from the url obtained through the api.
2021-09-29 14:43:58 +02:00
2024-05-03 22:42:32 +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.
2024-05-03 22:42:32 +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.
2021-09-29 04:20:27 +02:00
## Usage
2022-04-04 05:54:31 +02:00
### Command line options
2024-05-03 22:42:32 +02:00
- `--directory DIRECTORY, -d DIRECTORY`
process directory [directory]
- `--file FILE, -f FILE` process file [file]
- `--recursive, -r` go through directories recursively
- `--silent` silent, no command-line output
- `--ignore-history, -i` ignore history
- `--no-history, -n` do not write to history
- `--overwrite, -o` overwrite if the file already has lyrics
- `--dry-run, -t` test, do not write lyrics to file, but print to console
- `--rm-explicit` remove the "[Explicit]" lyrics warning from the songs title tag
- `--site SITE, -s SITE` use only [site]: azlyrics or genius
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)
2022-04-04 06:14:47 +02:00
Installing nicole using the Arch Build System also installs the man-page and a zsh completion script, if you have zsh installed.
2022-04-04 05:54:31 +02:00
```shell
git clone https://github.com/MatthiasQuintern/nicole.git
cd nicole
makepkg -si
```
### pip
2022-04-04 06:14:47 +02:00
You can also install nicole with python-pip:
2021-09-29 04:20:27 +02:00
```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
2022-04-04 06:14:47 +02:00
sudo gzip /usr/share/man/man1/nicole.1
2022-04-04 05:54:31 +02:00
sudo cp _nicole.compdef.zsh /usr/share/zsh/site-functions/_nicole
sudo chmod +x /usr/share/zsh/site-functions/_nicole
```
### Dependencies
2022-04-04 06:14:47 +02:00
- https://github.com/quodlibet/mutagen read and write mp3-tags
- https://www.crummy.com/software/BeautifulSoup/ deal with the html from genius
2022-04-04 05:54:31 +02:00
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
2024-05-03 22:42:32 +02:00
## 2.1.0
- Refactoring:
- use argparse
- use pyproject.toml
- Ignore case when matching a genius result
2022-04-04 05:54:31 +02:00
### 2.0
- Nicole now supports lyrics from genius!
2024-05-01 22:49:59 +02:00
- Added man-page
- Added zsh-completion
2022-04-04 05:54:31 +02:00
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
2024-05-03 22:42:32 +02:00
Copyright © 2024 Matthias Quintern. License GPLv3+: GNU GPL version 3 <https://gnu.org/licenses/gpl.html>.\
2022-04-04 05:54:31 +02:00
This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.