Changed for version 2

This commit is contained in:
matthias@arch 2022-04-04 05:54:31 +02:00
parent 9299140b87
commit 38aff38a04
2 changed files with 52 additions and 22 deletions

View File

@ -2,9 +2,7 @@
**N**ew-**I**ntrepid-**C**hief-**O**f-**L**yrics-**E**mbedders (obviously) **N**ew-**I**ntrepid-**C**hief-**O**f-**L**yrics-**E**mbedders (obviously)
## Overview ## Overview
Nicole is a program that searches for lyrics and writes them into the mp3-tag. Nicole is a program that searches for lyrics and writes them into the mp3-tag of a file.
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.
### Files ### Files
Nicole supports FLAC and mp3 files. Other files can not be edited (as of now). Nicole supports FLAC and mp3 files. Other files can not be edited (as of now).
@ -14,51 +12,85 @@ Files that do not have a .flac or .mp3 extension are skipped automatically.
### History ### History
Nicole creates a history of all files that were processed in `~/.configs/nicole`. Nicole creates a history of all files that were processed in `~/.configs/nicole`.
If a file is in the history, it will be skipped unless `ignore_history=True`. If a file is in the history, it will be skipped (unless `-i` is passed).
If the lyrics for a file can not be obtained, it is added to `~/.configs/nicole/failed_files`. 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. Those files are not skipped, the file only exists so that you can see which lyrics were not downloaded.
If you dont want your files in the history, add the `-n` option. 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.
### azlyrics ### azlyrics
Nicole creates an azlyrics.com url from the "title" and "artist" tags of the file. Nicole creates an azlyrics.com url from the "title" and "artist" tags of the file.
The lyrics are extracted from the html document using regex. The lyrics are extracted from the html document using regex.
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.
## Usage ## Usage
Command line options:
### Command line options
- `-d [directory]` process directory [directory] - `-d [directory]` process directory [directory]
- `-f [file]` process file [file] - `-f [file]` process file [file]
- `-r` go through directories recursively - `-r` go through directories recursively
- `-s` silent, no command-line output - `-s` silent, no command-line output
- `-i` ignore history - `-i` ignore history
- `-n` do not write to history - `-n` do not write to history
- `-o` overwrite if the file already a lyrics - `-o` overwrite if the file already has lyrics
- `-t` test, do not write lyrics to file, but print to console - `-t` test, do not write lyrics to file, but print to stdout
- `-h` show this - `-h` show this
- `--rm_explicit` remove the "[Explicit]" lyrics warning from the song's title tag - `--rm_explicit` remove the "[Explicit]" lyrics warning from the song's title tag
- `--site [site]` only search [site] for lyrics (genius or azlyrics)
If you do not specify a directory or file, the program will ask you if you want to use the current working directory. If you do not specify a directory or file, the program will ask you if you want to use the current working directory.
Example: `nicole -ior -d ~/music/artist --rm_explicit`
## Installation ## Installation and Updating
Clone this repository and install it using python-pip. To update nicole, simply follow the installation instructions.
pip should also install https://github.com/seebye/mutagen, which is needed to read and write the mp3-tags.
### 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
Clone this repository and install it using python-pip.
```shell ```shell
cd ~/Downloads
git clone https://github.com/MatthiasQuintern/nicole.git git clone https://github.com/MatthiasQuintern/nicole.git
cd nicole cd nicole
python3 -m pip install . python3 -m pip install .
``` ```
You can also install it system-wide using `sudo python3 -m pip install.` You can also install it system-wide using `sudo python3 -m pip install.`
After installing, you can use it like this: `nicole -ior -d ~/music/artist --rm_explicit` 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.
## Changelog ## Changelog
### 2.0
- Nicole now supports lyrics from genius!
### 1.1 ### 1.1
- Lyrics are now properly encoded. - Lyrics are now properly encoded.
- If a title contains paranthesis or umlaute, multiple possible urls will be checked. - If a title contains parenthesis or umlaute, multiple possible urls will be checked.
- Files are now processed in order - Files are now processed in order
## Importand Notice # Copyright
This software comes with no warranty! 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.

View File

@ -2,8 +2,8 @@ from setuptools import setup
setup( setup(
name="nicole", name="nicole",
version="1.1", version="2.0",
description="Add lyrics from azlyrics.com to mp3-tag", description="Write lyrics from genius or azlyrics.com to a mp3-tag",
author="Matthias Quintern", author="Matthias Quintern",
author_email="matthiasqui@protonmail.com", author_email="matthiasqui@protonmail.com",
@ -13,7 +13,7 @@ setup(
license="GPLv3", license="GPLv3",
packages=["nicole"], packages=["nicole"],
install_requires=["mutagen"], install_requires=["mutagen", "beautifulsoup4"],
classifiers=[ classifiers=[
"Operating System :: POSIX :: Linux", "Operating System :: POSIX :: Linux",
@ -28,5 +28,3 @@ setup(
"console_scripts": [ "nicole=nicole.nicole:main" ], "console_scripts": [ "nicole=nicole.nicole:main" ],
}, },
) )