Skip to content

Commit

Permalink
Added readme docs and cli param for output file and line length
Browse files Browse the repository at this point in the history
  • Loading branch information
beveradb committed Mar 10, 2024
1 parent fa359da commit b69cace
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 4 deletions.
67 changes: 66 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,67 @@
# karaoke-lyrics-processor
# Karaoke Lyrics Processor 🎶 ✍️

Karaoke Lyrics Processor is a tool to prepare song lyrics for karaoke video production.

It processes lyrics by splitting long lines, handling parentheses, and ensuring that each line fits within a specified maximum length.
This tool is especially useful for creating karaoke tracks where timing and line length are crucial for readability.

## Features

- **Line Splitting**: Automatically splits long lines of lyrics to ensure they fit within a specified maximum length, making them more readable and suitable for karaoke display.
- **Intelligent Splitting**: Finds the best split points in lines, considering punctuation and logical breaks in the lyrics.
- **Parentheses Handling**: Processes lines containing parentheses appropriately, ensuring that the lyrical flow is maintained.
- **Clipboard Support**: Copies the processed lyrics to the clipboard for easy pasting into video production software or other applications.
- **Debug Mode**: Offers a debug mode for detailed logging, helping with troubleshooting and fine-tuning the processing.

## Installation

To install the Karaoke Lyrics Processor, ensure you have Python 3.9 or newer in your environment.

This package is available on PyPI and can be installed using pip. Run the following command in your terminal:

```bash
pip install karaoke-lyrics-processor
```

## Usage (CLI)

To process a file containing song lyrics, use the following command:

```bash
karaoke-lyrics-processor <path_to_lyrics_file>
```

By default, this will create a new file in your current directory with `(Lyrics Processed)` in the filename containing the processed lyrics.

### Command line options

```bash
usage: karaoke-lyrics-processor [-h] [-v] [-d] [-o OUTPUT] [-l LINE_LENGTH] filename

Process song lyrics to prepare them for karaoke video production, e.g. by splitting long lines

positional arguments:
filename The path to the file containing the song lyrics to process.

options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-d, --debug Enable debug mode, setting log level to DEBUG.
-o OUTPUT, --output OUTPUT Optional: Specify the output filename for the processed lyrics.
-l LINE_LENGTH, --line_length LINE_LENGTH Optional: Specify the maximum line length for the processed lyrics. Default is 36.
```
## Contributing 🤝
Contributions are very much welcome! Please fork the repository and submit a pull request with your changes, and I'll try to review, merge and publish promptly!

- This project is 100% open-source and free for anyone to use and modify as they wish.
- If the maintenance workload for this repo somehow becomes too much for me I'll ask for volunteers to share maintainership of the repo, though I don't think that is very likely

## License 📄

This project is licensed under the MIT [License](LICENSE).

## Contact 💌

For questions or feedback, please raise an issue or reach out to @beveradb ([Andrew Beveridge](mailto:[email protected])) directly.
19 changes: 17 additions & 2 deletions karaoke_lyrics_processor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ def main():
package_version = pkg_resources.get_distribution("karaoke-lyrics-processor").version
parser.add_argument("-v", "--version", action="version", version=f"%(prog)s {package_version}")
parser.add_argument("-d", "--debug", action="store_true", help="Enable debug mode, setting log level to DEBUG.")
parser.add_argument("-o", "--output", type=str, help="Optional: Specify the output filename for the processed lyrics.")
parser.add_argument(
"-l",
"--line_length",
type=int,
default=36,
help="Optional: Specify the maximum line length for the processed lyrics. Default is 36.",
)
parser.add_argument("filename", type=str, help="The path to the file containing the song lyrics to process.")

args = parser.parse_args()
Expand All @@ -37,10 +45,17 @@ def main():
logger.info(f"Karaoke Lyrics processor beginning with input file: {args.filename}")

filename_parts = args.filename.rsplit(".", 1)
output_filename = f"{filename_parts[0]} (Lyrics Processed).{filename_parts[1]}"
if args.output:
output_filename = args.output
else:
output_filename = f"{filename_parts[0]} (Lyrics Processed).{filename_parts[1]}"

processor = KaraokeLyricsProcessor(
log_level=log_level, log_formatter=log_formatter, input_filename=args.filename, output_filename=output_filename
log_level=log_level,
log_formatter=log_formatter,
input_filename=args.filename,
output_filename=output_filename,
max_line_length=args.line_length,
)
processor.process()
processor.write_to_output_file()
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "karaoke-lyrics-processor"
version = "0.1.0"
version = "0.1.1"
description = "Process song lyrics to prepare them for karaoke video production, e.g. by splitting long lines"
authors = ["Andrew Beveridge <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit b69cace

Please sign in to comment.