ytm-cli 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ytm_cli-0.5.0/LICENSE +21 -0
- ytm_cli-0.5.0/PKG-INFO +264 -0
- ytm_cli-0.5.0/README.md +232 -0
- ytm_cli-0.5.0/pyproject.toml +82 -0
- ytm_cli-0.5.0/setup.cfg +4 -0
- ytm_cli-0.5.0/tests/test_auth.py +584 -0
- ytm_cli-0.5.0/tests/test_config.py +210 -0
- ytm_cli-0.5.0/tests/test_dislikes.py +450 -0
- ytm_cli-0.5.0/tests/test_ffmpeg_player.py +601 -0
- ytm_cli-0.5.0/tests/test_hybrid_player.py +271 -0
- ytm_cli-0.5.0/tests/test_integration.py +414 -0
- ytm_cli-0.5.0/tests/test_lyrics_service.py +533 -0
- ytm_cli-0.5.0/tests/test_main.py +536 -0
- ytm_cli-0.5.0/tests/test_playlists.py +397 -0
- ytm_cli-0.5.0/tests/test_runner.py +82 -0
- ytm_cli-0.5.0/tests/test_ui.py +361 -0
- ytm_cli-0.5.0/tests/test_utils.py +145 -0
- ytm_cli-0.5.0/ytm_cli/__init__.py +3 -0
- ytm_cli-0.5.0/ytm_cli/__main__.py +6 -0
- ytm_cli-0.5.0/ytm_cli/auth.py +697 -0
- ytm_cli-0.5.0/ytm_cli/cache.py +67 -0
- ytm_cli-0.5.0/ytm_cli/config.py +29 -0
- ytm_cli-0.5.0/ytm_cli/dislikes.py +174 -0
- ytm_cli-0.5.0/ytm_cli/hybrid_player.py +199 -0
- ytm_cli-0.5.0/ytm_cli/llm_client.py +426 -0
- ytm_cli-0.5.0/ytm_cli/lyrics_service.py +230 -0
- ytm_cli-0.5.0/ytm_cli/main.py +1036 -0
- ytm_cli-0.5.0/ytm_cli/player.py +545 -0
- ytm_cli-0.5.0/ytm_cli/playlists.py +266 -0
- ytm_cli-0.5.0/ytm_cli/tui/__init__.py +5 -0
- ytm_cli-0.5.0/ytm_cli/tui/app.py +247 -0
- ytm_cli-0.5.0/ytm_cli/tui/ffmpeg_player.py +360 -0
- ytm_cli-0.5.0/ytm_cli/tui/player_factory.py +100 -0
- ytm_cli-0.5.0/ytm_cli/tui/player_service.py +97 -0
- ytm_cli-0.5.0/ytm_cli/tui/widgets/__init__.py +8 -0
- ytm_cli-0.5.0/ytm_cli/tui/widgets/now_playing.py +180 -0
- ytm_cli-0.5.0/ytm_cli/tui/widgets/playlist_sidebar.py +59 -0
- ytm_cli-0.5.0/ytm_cli/tui/widgets/queue.py +73 -0
- ytm_cli-0.5.0/ytm_cli/tui/widgets/search.py +183 -0
- ytm_cli-0.5.0/ytm_cli/ui.py +451 -0
- ytm_cli-0.5.0/ytm_cli/utils.py +35 -0
- ytm_cli-0.5.0/ytm_cli/verbose_logger.py +293 -0
- ytm_cli-0.5.0/ytm_cli.egg-info/PKG-INFO +264 -0
- ytm_cli-0.5.0/ytm_cli.egg-info/SOURCES.txt +46 -0
- ytm_cli-0.5.0/ytm_cli.egg-info/dependency_links.txt +1 -0
- ytm_cli-0.5.0/ytm_cli.egg-info/entry_points.txt +2 -0
- ytm_cli-0.5.0/ytm_cli.egg-info/requires.txt +5 -0
- ytm_cli-0.5.0/ytm_cli.egg-info/top_level.txt +1 -0
ytm_cli-0.5.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Nguyen Luan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ytm_cli-0.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ytm-cli
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: YouTube Music CLI tool with interactive terminal interface
|
|
5
|
+
Author-email: thieuluan <thieuluan.dark@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/thieuluan1618/ytm
|
|
8
|
+
Project-URL: Repository, https://github.com/thieuluan1618/ytm
|
|
9
|
+
Project-URL: Issues, https://github.com/thieuluan1618/ytm/issues
|
|
10
|
+
Keywords: youtube-music,cli,terminal,music-player,mpv
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Players
|
|
23
|
+
Requires-Python: >=3.8
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: ytmusicapi
|
|
27
|
+
Requires-Dist: rich
|
|
28
|
+
Requires-Dist: mpv
|
|
29
|
+
Requires-Dist: requests
|
|
30
|
+
Requires-Dist: pyperclip
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
# YTM - YouTube Music CLI
|
|
34
|
+
|
|
35
|
+
🎵 **A simple, interactive command-line tool for YouTube Music**
|
|
36
|
+
|
|
37
|
+
Stream music directly from YouTube Music in your terminal with intuitive controls, playlist management, and smart filtering.
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
|
|
41
|
+

|
|
42
|
+
|
|
43
|
+
## ✨ Features
|
|
44
|
+
|
|
45
|
+
- **🔍 Smart Search**: Search and play any song from YouTube Music
|
|
46
|
+
- **🎮 Interactive Controls**: Play/pause, skip, go back with simple key presses
|
|
47
|
+
- **📱 Vim-like Navigation**: Use `j/k` keys or arrow keys to navigate
|
|
48
|
+
- **📋 Local Playlists**: Create and manage personal playlists
|
|
49
|
+
- **👎 Smart Filtering**: Dislike songs to filter them from future results
|
|
50
|
+
- **📜 Lyrics Display**: View lyrics while listening (press `l`)
|
|
51
|
+
- **🎯 Radio Mode**: Automatic playlist generation based on your selection
|
|
52
|
+
- **🤖 AI-Powered**: Natural language music requests and AI-generated playlists
|
|
53
|
+
|
|
54
|
+
## 🚀 Quick Start
|
|
55
|
+
|
|
56
|
+
### Requirements
|
|
57
|
+
|
|
58
|
+
- Python 3.8+
|
|
59
|
+
- [mpv media player](https://mpv.io/installation/) (must be installed system-wide)
|
|
60
|
+
|
|
61
|
+
### Installation
|
|
62
|
+
|
|
63
|
+
**One command with [uv](https://docs.astral.sh/uv/) (recommended):**
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Install from PyPI
|
|
67
|
+
uvx ytm-cli "song name"
|
|
68
|
+
|
|
69
|
+
# Or from source (no clone needed)
|
|
70
|
+
uvx --from git+https://github.com/thieuluan1618/ytm.git ytm "song name"
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
<details>
|
|
74
|
+
<summary>Alternative: clone and run locally</summary>
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
git clone https://github.com/thieuluan1618/ytm.git
|
|
78
|
+
cd ytm
|
|
79
|
+
uv run ytm "song name"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
</details>
|
|
83
|
+
|
|
84
|
+
<details>
|
|
85
|
+
<summary>Alternative: one-shot setup scripts</summary>
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
git clone https://github.com/thieuluan1618/ytm.git
|
|
89
|
+
cd ytm
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
These create the virtual environment, install dependencies, and configure the `ytm` command globally.
|
|
93
|
+
|
|
94
|
+
**Linux/macOS:**
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
./setup.sh
|
|
98
|
+
source ~/.zshrc # or ~/.bashrc for bash
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Windows PowerShell:**
|
|
102
|
+
|
|
103
|
+
```powershell
|
|
104
|
+
.\setup.ps1
|
|
105
|
+
. $PROFILE
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**Windows Command Prompt:**
|
|
109
|
+
|
|
110
|
+
```cmd
|
|
111
|
+
setup.bat
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
After setup, use `ytm` from anywhere instead of `python -m ytm_cli`.
|
|
115
|
+
|
|
116
|
+
</details>
|
|
117
|
+
|
|
118
|
+
<details>
|
|
119
|
+
<summary>Alternative: manual install</summary>
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
git clone https://github.com/thieuluan1618/ytm.git
|
|
123
|
+
cd ytm
|
|
124
|
+
python -m venv venv
|
|
125
|
+
source venv/bin/activate # Windows: venv\Scripts\activate
|
|
126
|
+
pip install -r requirements.txt
|
|
127
|
+
./setup_alias.sh # or setup_alias.ps1 / setup_alias.bat
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
</details>
|
|
131
|
+
|
|
132
|
+
### Basic Usage
|
|
133
|
+
|
|
134
|
+
**Interactive search:**
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
ytm
|
|
138
|
+
# Enter search query when prompted
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**Direct search:**
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
ytm "your favorite song"
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
**Non-interactive mode (automation/scripting):**
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
ytm search "song name" --select 1 # Auto-select first result
|
|
151
|
+
ytm search "song" -s 1 -v # With verbose output
|
|
152
|
+
ytm search "song" -s 1 -v --log-file debug.log # Save debug logs
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
> **Note:** If you haven't set up the alias, use `python -m ytm_cli` instead of `ytm`
|
|
156
|
+
|
|
157
|
+
## 🎮 Controls
|
|
158
|
+
|
|
159
|
+
### During Song Selection
|
|
160
|
+
|
|
161
|
+
- `↑/↓` or `j/k` - Navigate through results
|
|
162
|
+
- `Enter` - Select and play song
|
|
163
|
+
- `q` - Quit
|
|
164
|
+
|
|
165
|
+
### During Playback
|
|
166
|
+
|
|
167
|
+
- `Space` - Play/pause
|
|
168
|
+
- `n` - Next song
|
|
169
|
+
- `b` - Previous song
|
|
170
|
+
- `l` - Show lyrics
|
|
171
|
+
- `a` - Add to playlist
|
|
172
|
+
- `d` - Dislike song (skip and filter from future results)
|
|
173
|
+
- `q` - Quit
|
|
174
|
+
|
|
175
|
+
## 📋 Playlist Management
|
|
176
|
+
|
|
177
|
+
**Create and manage playlists:**
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
ytm playlist list # List all playlists
|
|
181
|
+
ytm playlist create # Create new playlist
|
|
182
|
+
ytm playlist show "My Songs" # View playlist contents
|
|
183
|
+
ytm playlist play "My Songs" # Play entire playlist
|
|
184
|
+
ytm playlist delete "My Songs" # Delete playlist
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**Add songs to playlists:**
|
|
188
|
+
|
|
189
|
+
- Press `a` during song selection or playback
|
|
190
|
+
- Choose existing playlist or create new one
|
|
191
|
+
- Song added without interrupting playback
|
|
192
|
+
|
|
193
|
+
## 🤖 AI Music Assistant
|
|
194
|
+
|
|
195
|
+
Use natural language to search and create playlists powered by AI (supports Google Gemini, OpenAI, Anthropic):
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
ytm llm ask "play something chill for studying" # AI picks and auto-plays
|
|
199
|
+
ytm llm ask "upbeat pop songs for a workout" # Natural language search
|
|
200
|
+
ytm llm playlist "lo-fi beats for rainy days" --play # AI-generated playlist
|
|
201
|
+
ytm llm playlist "90s rock classics" -n 20 # 20-song playlist
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Configure your provider in `config.ini`:
|
|
205
|
+
|
|
206
|
+
```ini
|
|
207
|
+
[llm]
|
|
208
|
+
provider = google # google, openai, or anthropic
|
|
209
|
+
model = gemini-2.5-pro
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## 🛠️ Configuration
|
|
213
|
+
|
|
214
|
+
The app uses `config.ini` for customization:
|
|
215
|
+
|
|
216
|
+
```ini
|
|
217
|
+
[general]
|
|
218
|
+
songs_to_display = 10
|
|
219
|
+
show_thumbnails = true
|
|
220
|
+
|
|
221
|
+
[mpv]
|
|
222
|
+
# Add custom mpv flags
|
|
223
|
+
flags = --no-video
|
|
224
|
+
|
|
225
|
+
[playlists]
|
|
226
|
+
directory = playlists
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## 🎯 Philosophy
|
|
230
|
+
|
|
231
|
+
**Keep it simple for the listener to enjoy music.** Features are designed to be:
|
|
232
|
+
|
|
233
|
+
- **Intuitive**: Single-key shortcuts during playback
|
|
234
|
+
- **Non-disruptive**: Actions don't interrupt your listening experience
|
|
235
|
+
- **Consistent**: Same navigation patterns across all screens
|
|
236
|
+
- **Quick**: Important features accessible with simple key presses
|
|
237
|
+
|
|
238
|
+
## 🐛 Troubleshooting
|
|
239
|
+
|
|
240
|
+
Having issues? Check out the [**Troubleshooting Guide**](TROUBLESHOOTING.md) for solutions to common problems:
|
|
241
|
+
|
|
242
|
+
- 🔧 [Songs Skipping Continuously](TROUBLESHOOTING.md#songs-skipping-continuously)
|
|
243
|
+
- 📦 [MPV Not Found](TROUBLESHOOTING.md#mpv-not-found)
|
|
244
|
+
- 💻 [Terminal/Curses Errors](TROUBLESHOOTING.md#terminalcurses-errors)
|
|
245
|
+
- 📝 [Using Verbose Logging](TROUBLESHOOTING.md#using-verbose-logging)
|
|
246
|
+
|
|
247
|
+
**Quick diagnosis:**
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# Enable verbose logging to see what's happening
|
|
251
|
+
ytm search "test" -s 1 -v --log-file debug.log
|
|
252
|
+
|
|
253
|
+
# Check versions
|
|
254
|
+
mpv --version
|
|
255
|
+
yt-dlp --version
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## 📄 License
|
|
259
|
+
|
|
260
|
+
This project is open source. Please check the license file for details.
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
**Enjoy your music! 🎵**
|
ytm_cli-0.5.0/README.md
ADDED
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# YTM - YouTube Music CLI
|
|
2
|
+
|
|
3
|
+
🎵 **A simple, interactive command-line tool for YouTube Music**
|
|
4
|
+
|
|
5
|
+
Stream music directly from YouTube Music in your terminal with intuitive controls, playlist management, and smart filtering.
|
|
6
|
+
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## ✨ Features
|
|
12
|
+
|
|
13
|
+
- **🔍 Smart Search**: Search and play any song from YouTube Music
|
|
14
|
+
- **🎮 Interactive Controls**: Play/pause, skip, go back with simple key presses
|
|
15
|
+
- **📱 Vim-like Navigation**: Use `j/k` keys or arrow keys to navigate
|
|
16
|
+
- **📋 Local Playlists**: Create and manage personal playlists
|
|
17
|
+
- **👎 Smart Filtering**: Dislike songs to filter them from future results
|
|
18
|
+
- **📜 Lyrics Display**: View lyrics while listening (press `l`)
|
|
19
|
+
- **🎯 Radio Mode**: Automatic playlist generation based on your selection
|
|
20
|
+
- **🤖 AI-Powered**: Natural language music requests and AI-generated playlists
|
|
21
|
+
|
|
22
|
+
## 🚀 Quick Start
|
|
23
|
+
|
|
24
|
+
### Requirements
|
|
25
|
+
|
|
26
|
+
- Python 3.8+
|
|
27
|
+
- [mpv media player](https://mpv.io/installation/) (must be installed system-wide)
|
|
28
|
+
|
|
29
|
+
### Installation
|
|
30
|
+
|
|
31
|
+
**One command with [uv](https://docs.astral.sh/uv/) (recommended):**
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Install from PyPI
|
|
35
|
+
uvx ytm-cli "song name"
|
|
36
|
+
|
|
37
|
+
# Or from source (no clone needed)
|
|
38
|
+
uvx --from git+https://github.com/thieuluan1618/ytm.git ytm "song name"
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
<details>
|
|
42
|
+
<summary>Alternative: clone and run locally</summary>
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
git clone https://github.com/thieuluan1618/ytm.git
|
|
46
|
+
cd ytm
|
|
47
|
+
uv run ytm "song name"
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
</details>
|
|
51
|
+
|
|
52
|
+
<details>
|
|
53
|
+
<summary>Alternative: one-shot setup scripts</summary>
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
git clone https://github.com/thieuluan1618/ytm.git
|
|
57
|
+
cd ytm
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
These create the virtual environment, install dependencies, and configure the `ytm` command globally.
|
|
61
|
+
|
|
62
|
+
**Linux/macOS:**
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
./setup.sh
|
|
66
|
+
source ~/.zshrc # or ~/.bashrc for bash
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Windows PowerShell:**
|
|
70
|
+
|
|
71
|
+
```powershell
|
|
72
|
+
.\setup.ps1
|
|
73
|
+
. $PROFILE
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Windows Command Prompt:**
|
|
77
|
+
|
|
78
|
+
```cmd
|
|
79
|
+
setup.bat
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
After setup, use `ytm` from anywhere instead of `python -m ytm_cli`.
|
|
83
|
+
|
|
84
|
+
</details>
|
|
85
|
+
|
|
86
|
+
<details>
|
|
87
|
+
<summary>Alternative: manual install</summary>
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git clone https://github.com/thieuluan1618/ytm.git
|
|
91
|
+
cd ytm
|
|
92
|
+
python -m venv venv
|
|
93
|
+
source venv/bin/activate # Windows: venv\Scripts\activate
|
|
94
|
+
pip install -r requirements.txt
|
|
95
|
+
./setup_alias.sh # or setup_alias.ps1 / setup_alias.bat
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
</details>
|
|
99
|
+
|
|
100
|
+
### Basic Usage
|
|
101
|
+
|
|
102
|
+
**Interactive search:**
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
ytm
|
|
106
|
+
# Enter search query when prompted
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Direct search:**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
ytm "your favorite song"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
**Non-interactive mode (automation/scripting):**
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
ytm search "song name" --select 1 # Auto-select first result
|
|
119
|
+
ytm search "song" -s 1 -v # With verbose output
|
|
120
|
+
ytm search "song" -s 1 -v --log-file debug.log # Save debug logs
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
> **Note:** If you haven't set up the alias, use `python -m ytm_cli` instead of `ytm`
|
|
124
|
+
|
|
125
|
+
## 🎮 Controls
|
|
126
|
+
|
|
127
|
+
### During Song Selection
|
|
128
|
+
|
|
129
|
+
- `↑/↓` or `j/k` - Navigate through results
|
|
130
|
+
- `Enter` - Select and play song
|
|
131
|
+
- `q` - Quit
|
|
132
|
+
|
|
133
|
+
### During Playback
|
|
134
|
+
|
|
135
|
+
- `Space` - Play/pause
|
|
136
|
+
- `n` - Next song
|
|
137
|
+
- `b` - Previous song
|
|
138
|
+
- `l` - Show lyrics
|
|
139
|
+
- `a` - Add to playlist
|
|
140
|
+
- `d` - Dislike song (skip and filter from future results)
|
|
141
|
+
- `q` - Quit
|
|
142
|
+
|
|
143
|
+
## 📋 Playlist Management
|
|
144
|
+
|
|
145
|
+
**Create and manage playlists:**
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
ytm playlist list # List all playlists
|
|
149
|
+
ytm playlist create # Create new playlist
|
|
150
|
+
ytm playlist show "My Songs" # View playlist contents
|
|
151
|
+
ytm playlist play "My Songs" # Play entire playlist
|
|
152
|
+
ytm playlist delete "My Songs" # Delete playlist
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**Add songs to playlists:**
|
|
156
|
+
|
|
157
|
+
- Press `a` during song selection or playback
|
|
158
|
+
- Choose existing playlist or create new one
|
|
159
|
+
- Song added without interrupting playback
|
|
160
|
+
|
|
161
|
+
## 🤖 AI Music Assistant
|
|
162
|
+
|
|
163
|
+
Use natural language to search and create playlists powered by AI (supports Google Gemini, OpenAI, Anthropic):
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
ytm llm ask "play something chill for studying" # AI picks and auto-plays
|
|
167
|
+
ytm llm ask "upbeat pop songs for a workout" # Natural language search
|
|
168
|
+
ytm llm playlist "lo-fi beats for rainy days" --play # AI-generated playlist
|
|
169
|
+
ytm llm playlist "90s rock classics" -n 20 # 20-song playlist
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Configure your provider in `config.ini`:
|
|
173
|
+
|
|
174
|
+
```ini
|
|
175
|
+
[llm]
|
|
176
|
+
provider = google # google, openai, or anthropic
|
|
177
|
+
model = gemini-2.5-pro
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## 🛠️ Configuration
|
|
181
|
+
|
|
182
|
+
The app uses `config.ini` for customization:
|
|
183
|
+
|
|
184
|
+
```ini
|
|
185
|
+
[general]
|
|
186
|
+
songs_to_display = 10
|
|
187
|
+
show_thumbnails = true
|
|
188
|
+
|
|
189
|
+
[mpv]
|
|
190
|
+
# Add custom mpv flags
|
|
191
|
+
flags = --no-video
|
|
192
|
+
|
|
193
|
+
[playlists]
|
|
194
|
+
directory = playlists
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
## 🎯 Philosophy
|
|
198
|
+
|
|
199
|
+
**Keep it simple for the listener to enjoy music.** Features are designed to be:
|
|
200
|
+
|
|
201
|
+
- **Intuitive**: Single-key shortcuts during playback
|
|
202
|
+
- **Non-disruptive**: Actions don't interrupt your listening experience
|
|
203
|
+
- **Consistent**: Same navigation patterns across all screens
|
|
204
|
+
- **Quick**: Important features accessible with simple key presses
|
|
205
|
+
|
|
206
|
+
## 🐛 Troubleshooting
|
|
207
|
+
|
|
208
|
+
Having issues? Check out the [**Troubleshooting Guide**](TROUBLESHOOTING.md) for solutions to common problems:
|
|
209
|
+
|
|
210
|
+
- 🔧 [Songs Skipping Continuously](TROUBLESHOOTING.md#songs-skipping-continuously)
|
|
211
|
+
- 📦 [MPV Not Found](TROUBLESHOOTING.md#mpv-not-found)
|
|
212
|
+
- 💻 [Terminal/Curses Errors](TROUBLESHOOTING.md#terminalcurses-errors)
|
|
213
|
+
- 📝 [Using Verbose Logging](TROUBLESHOOTING.md#using-verbose-logging)
|
|
214
|
+
|
|
215
|
+
**Quick diagnosis:**
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
# Enable verbose logging to see what's happening
|
|
219
|
+
ytm search "test" -s 1 -v --log-file debug.log
|
|
220
|
+
|
|
221
|
+
# Check versions
|
|
222
|
+
mpv --version
|
|
223
|
+
yt-dlp --version
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## 📄 License
|
|
227
|
+
|
|
228
|
+
This project is open source. Please check the license file for details.
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
**Enjoy your music! 🎵**
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "ytm-cli"
|
|
7
|
+
version = "0.5.0"
|
|
8
|
+
description = "YouTube Music CLI tool with interactive terminal interface"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.8"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "thieuluan", email = "thieuluan.dark@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["youtube-music", "cli", "terminal", "music-player", "mpv"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Environment :: Console",
|
|
19
|
+
"Intended Audience :: End Users/Desktop",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.8",
|
|
23
|
+
"Programming Language :: Python :: 3.9",
|
|
24
|
+
"Programming Language :: Python :: 3.10",
|
|
25
|
+
"Programming Language :: Python :: 3.11",
|
|
26
|
+
"Programming Language :: Python :: 3.12",
|
|
27
|
+
"Programming Language :: Python :: 3.13",
|
|
28
|
+
"Topic :: Multimedia :: Sound/Audio :: Players",
|
|
29
|
+
]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"ytmusicapi",
|
|
32
|
+
"rich",
|
|
33
|
+
"mpv",
|
|
34
|
+
"requests",
|
|
35
|
+
"pyperclip",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://github.com/thieuluan1618/ytm"
|
|
40
|
+
Repository = "https://github.com/thieuluan1618/ytm"
|
|
41
|
+
Issues = "https://github.com/thieuluan1618/ytm/issues"
|
|
42
|
+
|
|
43
|
+
[project.scripts]
|
|
44
|
+
ytm = "ytm_cli.main:main"
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.packages.find]
|
|
47
|
+
include = ["ytm_cli*"]
|
|
48
|
+
|
|
49
|
+
[tool.ruff]
|
|
50
|
+
# Set line length to match pylint (100 characters)
|
|
51
|
+
line-length = 100
|
|
52
|
+
target-version = "py38"
|
|
53
|
+
|
|
54
|
+
[tool.ruff.lint]
|
|
55
|
+
# Enable flake8 rules and other important checks
|
|
56
|
+
select = [
|
|
57
|
+
"E", # pycodestyle errors
|
|
58
|
+
"W", # pycodestyle warnings
|
|
59
|
+
"F", # pyflakes
|
|
60
|
+
"I", # isort
|
|
61
|
+
"B", # flake8-bugbear
|
|
62
|
+
"C4", # flake8-comprehensions
|
|
63
|
+
"UP", # pyupgrade
|
|
64
|
+
]
|
|
65
|
+
|
|
66
|
+
# Ignore specific rules that conflict with project style
|
|
67
|
+
ignore = [
|
|
68
|
+
"E501", # Line too long (handled by formatter)
|
|
69
|
+
"B008", # Do not perform function calls in argument defaults
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
[tool.ruff.format]
|
|
73
|
+
# Use double quotes for strings
|
|
74
|
+
quote-style = "double"
|
|
75
|
+
# Use 4 spaces for indentation
|
|
76
|
+
indent-style = "space"
|
|
77
|
+
# Keep existing line endings
|
|
78
|
+
line-ending = "auto"
|
|
79
|
+
|
|
80
|
+
[tool.ruff.lint.isort]
|
|
81
|
+
# Group imports properly
|
|
82
|
+
known-first-party = ["ytm_cli"]
|
ytm_cli-0.5.0/setup.cfg
ADDED