Skip to content

Commit ce3fb39

Browse files
committed
chore: add lint
1 parent 33371b8 commit ce3fb39

12 files changed

Lines changed: 410 additions & 174 deletions

File tree

.github/workflows/lint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
concurrency: lint-${{ github.sha }}
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
15+
env:
16+
PYTHON_VERSION: "3.13"
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v6
21+
- name: Set up Python ${{ env.PYTHON_VERSION }}
22+
uses: actions/setup-python@v6
23+
with:
24+
python-version: ${{ env.PYTHON_VERSION }}
25+
- name: Run pre-commit hooks
26+
uses: pre-commit/action@v3.0.1

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ wheels/
99
# Virtual environments
1010
.venv
1111
.tmp
12-
sounds/
12+
.vscode/
13+
sounds/

.pre-commit-config.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
default_language_version:
2+
python: "3"
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v6.0.0
6+
hooks:
7+
- id: check-ast
8+
- id: check-case-conflict
9+
- id: check-merge-conflict
10+
- id: check-toml
11+
- id: debug-statements
12+
- id: end-of-file-fixer
13+
- id: mixed-line-ending
14+
- id: trailing-whitespace
15+
- repo: https://github.com/compilerla/conventional-pre-commit
16+
rev: v4.3.0
17+
hooks:
18+
- id: conventional-pre-commit
19+
stages: [commit-msg]
20+
- repo: https://github.com/charliermarsh/ruff-pre-commit
21+
rev: v0.14.5
22+
hooks:
23+
- id: ruff
24+
args: [--fix]
25+
- id: ruff-format
26+
- repo: https://github.com/codespell-project/codespell
27+
rev: v2.4.1
28+
hooks:
29+
- id: codespell
30+
exclude: "uv.lock"
31+
args: ["--ignore-words-list=ure"]
32+
additional_dependencies:
33+
- tomli

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,4 +198,4 @@
198198
distributed under the License is distributed on an "AS IS" BASIS,
199199
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200200
See the License for the specific language governing permissions and
201-
limitations under the License.
201+
limitations under the License.

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.PHONY: lint
2+
3+
lint:
4+
@echo "Running linters... 🔄"
5+
pre-commit install
6+
pre-commit run -a
7+
@echo "Linters completed. ✅"

README.md

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Play audio files through your microphone in multiplayer games like CS, Battlefie
1919
- **Python 3.13** or higher
2020
- **uv** or **pip** for package management
2121

22-
### 2. Virtual Audio Cable ⚠️
22+
### 2. Virtual Audio Cable
2323
**CRITICAL**: You need a virtual audio device to route audio to your microphone.
2424

2525
**Recommended: VB-Cable (Free)**
@@ -30,37 +30,18 @@ Play audio files through your microphone in multiplayer games like CS, Battlefie
3030
- `CABLE Input` - Where your soundboard outputs audio
3131
- `CABLE Output` - What your game reads as a microphone
3232

33-
### 3. System Audio Libraries
34-
35-
**Windows:**
36-
The Python packages may require system audio libraries. If you encounter errors:
37-
```powershell
38-
# Using Chocolatey
39-
choco install portaudio
40-
41-
# Or download manually from: http://www.portaudio.com/
42-
```
43-
4433
## 🚀 Installation
4534

4635
### Quick Start
4736

48-
1. **Clone this repository:**
37+
1. **Install via uv or pip:**
4938
```bash
50-
git clone https://github.com/yourusername/mu.git
51-
cd mu
39+
uv add mu
40+
# optional: with yt-dlp for downloading audio
41+
uv add mu[yt-dlp]
5242
```
5343

54-
2. **Install dependencies:**
55-
```bash
56-
# Using uv (recommended)
57-
uv sync
58-
59-
# Or using pip
60-
pip install -e .
61-
```
62-
63-
3. **Add your audio files:**
44+
2. **Add your audio files:**
6445
- Place audio files (MP3, WAV, OGG, FLAC, M4A) in the `sounds/` directory
6546
- Organize in subdirectories if desired
6647
- The app automatically scans and loads all audio files
@@ -123,7 +104,7 @@ mu listen # Start hotkey listener (press ESC to stop)
123104
mu interactive # Launch full interactive menu
124105

125106
# Help
126-
mu --help # Show all commands with beautiful help
107+
mu --help # Show all commands
127108
```
128109

129110
### Quick Workflow
@@ -218,8 +199,8 @@ The app recursively scans all subdirectories.
218199
### Getting Audio Files
219200

220201
```bash
221-
# Download from YouTube (uses yt-dlp in dev dependencies)
222-
uv run yt-dlp -x --audio-format wav "https://youtube.com/watch?v=..."
202+
# Download from YouTube (uses yt-dlp if installed)
203+
yt-dlp -x --audio-format wav "https://youtube.com/watch?v=..."
223204

224205
# The file will be saved in your current directory
225206
# Then move it to sounds/
@@ -248,21 +229,21 @@ mu setup
248229
mu play test-sound
249230
```
250231

251-
2. **Volume Control**:
232+
2. **Volume Control**:
252233
- Adjust Windows master volume
253234
- Use audio editing software to normalize clips
254235
- Set in-game voice volume appropriately
255236

256-
3. **Quick Access**:
237+
3. **Quick Access**:
257238
- Keep a terminal with `mu listen` running
258239
- Alt-tab is instant with hotkeys
259240
- Or use a second monitor
260241

261-
4. **Push-to-Talk**:
242+
4. **Push-to-Talk**:
262243
- If your game uses PTT, you'll need to hold it while playing sounds
263244
- Or configure the game to use voice activation
264245

265-
5. **Be Respectful**:
246+
5. **Be Respectful**:
266247
- Don't spam sounds excessively
267248
- Use appropriate audio in competitive matches
268249
- Some communities have rules about soundboards
@@ -287,15 +268,6 @@ mu devices # Verify device IDs
287268
mu setup # Reconfigure if needed
288269
```
289270

290-
### "Import errors" or "Module not found"
291-
```bash
292-
# Reinstall dependencies
293-
uv sync
294-
295-
# Or with pip
296-
pip install --upgrade sounddevice soundfile numpy pynput rich-click
297-
```
298-
299271
### "Audio plays on my speakers, not through mic"
300272
**Problem**: Wrong output device selected
301273

@@ -424,4 +396,4 @@ This is a personal project, but contributions are welcome!
424396

425397
## 📄 License
426398

427-
This project is provided as-is for personal and educational use.
399+
This project is provided as-is for personal and educational use only. See [LICENSE](https://github.com/Harshal6927/mu?tab=Apache-2.0-1-ov-file) for details.

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ yt-dlp = ["yt-dlp>=2025.11.12"]
1818

1919
[dependency-groups]
2020
dev = [
21+
"pre-commit>=4.4.0",
2122
"yt-dlp>=2025.11.12",
2223
]
2324

@@ -30,3 +31,6 @@ requires = ["hatchling"]
3031

3132
[project.scripts]
3233
mu = "src.cli:main"
34+
35+
[tool.ruff]
36+
line-length = 120

0 commit comments

Comments
 (0)