A TypeScript library and CLI tool for fetching synchronized lyrics from https://LRCLib.net for your
1.6K
A TypeScript library and CLI tool for fetching synchronized lyrics from LRCLib.net for your music files.
npm install -g lrclib-fetcher-ts
npm install lrclib-fetcher-ts
Process a directory of music files:
lrclib /path/to/your/music
Options:
-r, --recursive Scan directories recursively (default: true)
--no-skip-existing Don't skip files that already have lyrics
-o, --overwrite Overwrite existing lyrics files (default: false)
-b, --batch-size <number> Number of files to process in parallel (default: "5")
-d, --delay <number> Delay between API requests in milliseconds (default: "1000")
--allow-title-only Allow searching by title only if artist search fails (default: false)
--prefer-synced Prefer synchronized lyrics over plain text (default: true)
--log-level <level> Log level (debug, info, warn, error) (default: "info")
--log-file <path> Path to log file
-h, --help Display help
-V, --version Show version
# Process a directory with default settings
lrclib ~/Music
# Process with custom options
lrclib ~/Music --overwrite --batch-size 10 --delay 2000
# Only process files without existing lyrics
lrclib ~/Music --skip-existing
# Write logs to a file
lrclib ~/Music --log-level debug --log-file lyrics.log
The easiest way to use the tool with Docker is to use the maintained image:
docker pull leshicodes/lrclib-fetcher:0.0.2
And run it with:
docker run -v "/path/to/your/music:/music" leshicodes/lrclib-fetcher:0.0.2
Alternatively, you can build the Docker image yourself:
docker build -t lrclib-fetcher .
docker run -v "/path/to/your/music:/music" lrclib-fetcher
docker run -v "/path/to/your/music:/music" leshicodes/lrclib-fetcher:0.0.2 /music --overwrite --batch-size 10
import { createLyricsFetcher } from 'lrclib-fetcher-ts';
// Create a fetcher with custom options
const fetcher = createLyricsFetcher({
logging: {
level: 'info',
logToFile: false
},
search: {
allowTitleOnlySearch: true,
preferSynced: true
},
file: {
skipExisting: true,
overwriteExisting: false
},
batch: {
enabled: true,
size: 5,
delayMs: 1000
}
});
// Process a directory
fetcher.processDirectory('/path/to/music')
.then(results => {
console.log(`Processed ${results.length} files`);
console.log(`${results.filter(r => r.success).length} successful`);
})
.catch(error => {
console.error('Error:', error);
});
createLyricsFetcher(options)Creates a new lyrics fetcher instance with the specified options.
processDirectory(directory, options)Processes all audio files in the specified directory and its subdirectories.
MIT
This project uses the unofficial LRCLib.net API as described in the API documentation. All lyrics are provided by LRCLib.net users.
Contributions are welcome! Please feel free to submit a Pull Request.
When contributing, please follow my patterns and methodologies that are documented in the ./docs path
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)Content type
Image
Digest
sha256:9d6ef5f55…
Size
553.9 MB
Last updated
about 1 year ago
docker pull leshicodes/lrclib-fetcher:0.0.2