From 5f85e5adca9b1bad1a841ab6892c7d9284c05186 Mon Sep 17 00:00:00 2001 From: Vic Wong Date: Wed, 28 Aug 2024 11:31:16 -0700 Subject: [PATCH] Add some more vscode setting to stop running afoul of the pre-commit checks. Add more doc clarification --- .vscode/settings.json | 9 ++++++++- docs/README.md | 27 ++++++++++++++++----------- pikaraoke/karaoke.py | 10 +++++++--- 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 8ef2c2d8..7cb8a048 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,10 @@ { - "pylint.args": ["--rcfile=${workspaceFolder}/code_quality/.pylintrc"] + "pylint.args": ["--rcfile=${workspaceFolder}/code_quality/.pylintrc"], + "[python]": { + "editor.formatOnSave": true, + "editor.codeActionsOnSave": { + "source.organizeImports": "explicit" + } + }, + "isort.args": ["--profile", "black"] } diff --git a/docs/README.md b/docs/README.md index 82e8701d..8d7eefbb 100644 --- a/docs/README.md +++ b/docs/README.md @@ -49,7 +49,9 @@ If you want to support this project with a little monetary tip, it's much apprec ### Install required programs -Raspberry Pi OS / Debian-based distros: +Pikaraoke requires Python 3.9 or greater. You can check your current version by running `python --version`. [Python downloads](https://www.python.org/downloads/) + +#### Raspberry Pi OS / Linux distros with `apt`: ``` sudo apt-get install ffmpeg -y @@ -57,15 +59,18 @@ sudo apt-get install chromium-browser -y sudo apt-get install chromium-chromedriver -y ``` -Windows / OSX / Linux: +#### Windows / OSX / Linux: -- Python 3.9 or greater: https://www.python.org/downloads/ -- FFmpeg 6.0 or greater: https://ffmpeg.org/download.html -- Chrome Browser: http://google.com/chrome (only required for headed mode) +- FFmpeg 6.0 or greater: [FFmpeg downloads](https://ffmpeg.org/download.html) +- Chrome Browser: [Chrome](http://google.com/chrome) (only required for headed mode) ### Install pikaraoke -Optional: create a virtual environment. Recommended if you might have conflicting python programs installed. This may not be a concern for most users, but is generally good practice (See: https://docs.python.org/3/library/venv.html). On the other hand, if you install globally with pip, you can launch pikaraoke without activating a venv each time. +Optional: create a virtual environment. This is recommended to prevent conflicts with other global python packages. + +On the other hand, if you install globally without venv, you can launch pikaraoke without activating a venv each time, which is more convenient and fine for many users. The choice is yours. + +See [the python documentation](https://docs.python.org/3/library/venv.html) for more details on venv. ```sh # Create a .venv directory in the homedir @@ -92,8 +97,8 @@ Pikaraoke is now installed in the `$PATH` with the command line interface `pikar pikaraoke ``` -Virtual env users: note that if you close your terminal, you'll need to run -`source ~/.venv/bin/activate` again before launching pikaraoke again. +Virtual env users: note that if you close your terminal between launches, you'll need to run: +`source ~/.venv/bin/activate` before launching pikaraoke again. ### More Options @@ -119,8 +124,8 @@ See [TROUBLESHOOTING.md](TROUBLESHOOTING.md) for help with issues. The Pikaraoke project utilizes poetry dependency management and local development. -- Install poetry: https://python-poetry.org/docs/#installation -- Clone this repo. +- Install poetry: [Poetry](https://python-poetry.org/docs/#installation) +- Git clone this repo From the pikaraoke directory: @@ -134,7 +139,7 @@ poetry install poetry run pikaraoke ``` -## Run from Repository (Legacy) +## Run from repository (Legacy) See [README](../scripts/README.md) for how to install pikaraoke cloning this repo and using the scripts. This is a legacy method and may no longer work. diff --git a/pikaraoke/karaoke.py b/pikaraoke/karaoke.py index 2eed6323..85b8c027 100644 --- a/pikaraoke/karaoke.py +++ b/pikaraoke/karaoke.py @@ -17,9 +17,13 @@ from unidecode import unidecode from pikaraoke.lib.file_resolver import FileResolver -from pikaraoke.lib.get_platform import (get_ffmpeg_version, get_os_version, - get_platform, is_raspberry_pi, - supports_hardware_h264_encoding) +from pikaraoke.lib.get_platform import ( + get_ffmpeg_version, + get_os_version, + get_platform, + is_raspberry_pi, + supports_hardware_h264_encoding, +) # Support function for reading lines from ffmpeg stderr without blocking