pyopenaudio 1.0.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.
- pyopenaudio-1.0.0/LICENSE +21 -0
- pyopenaudio-1.0.0/PKG-INFO +240 -0
- pyopenaudio-1.0.0/README.md +208 -0
- pyopenaudio-1.0.0/pyproject.toml +94 -0
- pyopenaudio-1.0.0/setup.cfg +4 -0
- pyopenaudio-1.0.0/src/openaudio/__init__.py +50 -0
- pyopenaudio-1.0.0/src/openaudio/core/config.py +80 -0
- pyopenaudio-1.0.0/src/openaudio/core/downloader.py +165 -0
- pyopenaudio-1.0.0/src/openaudio/core/lyrics.py +47 -0
- pyopenaudio-1.0.0/src/openaudio/core/matcher.py +161 -0
- pyopenaudio-1.0.0/src/openaudio/core/models.py +111 -0
- pyopenaudio-1.0.0/src/openaudio/core/pipeline.py +224 -0
- pyopenaudio-1.0.0/src/openaudio/core/sequencer.py +44 -0
- pyopenaudio-1.0.0/src/openaudio/core/spotify.py +572 -0
- pyopenaudio-1.0.0/src/openaudio/core/tagger.py +242 -0
- pyopenaudio-1.0.0/src/openaudio/core/youtube.py +243 -0
- pyopenaudio-1.0.0/src/openaudio/main.py +195 -0
- pyopenaudio-1.0.0/src/openaudio/ui/cli.py +263 -0
- pyopenaudio-1.0.0/src/openaudio/ui/mobile.py +155 -0
- pyopenaudio-1.0.0/src/openaudio/ui/progress.py +84 -0
- pyopenaudio-1.0.0/src/openaudio/ui/tui.py +967 -0
- pyopenaudio-1.0.0/src/openaudio/utils/formatting.py +63 -0
- pyopenaudio-1.0.0/src/openaudio/utils/system.py +83 -0
- pyopenaudio-1.0.0/src/pyopenaudio.egg-info/PKG-INFO +240 -0
- pyopenaudio-1.0.0/src/pyopenaudio.egg-info/SOURCES.txt +27 -0
- pyopenaudio-1.0.0/src/pyopenaudio.egg-info/dependency_links.txt +1 -0
- pyopenaudio-1.0.0/src/pyopenaudio.egg-info/entry_points.txt +2 -0
- pyopenaudio-1.0.0/src/pyopenaudio.egg-info/requires.txt +7 -0
- pyopenaudio-1.0.0/src/pyopenaudio.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 OpenAudio
|
|
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.
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyopenaudio
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Lightweight, cross-platform music downloader and offline music player for YouTube Music & Spotify.
|
|
5
|
+
Author-email: alphap365 <arajitpaul2010@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/alphap365/openaudio
|
|
8
|
+
Keywords: music,downloader,spotify,youtube,ytmusic,termux,tui,offline-player
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Environment :: Console
|
|
18
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
19
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
20
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Players
|
|
21
|
+
Requires-Python: >=3.10
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: yt-dlp>=2024.8.0
|
|
25
|
+
Requires-Dist: textual>=0.50.0
|
|
26
|
+
Requires-Dist: rich>=13.7.0
|
|
27
|
+
Requires-Dist: mutagen>=1.47.0
|
|
28
|
+
Requires-Dist: requests>=2.31.0
|
|
29
|
+
Requires-Dist: rapidfuzz>=3.0.0
|
|
30
|
+
Requires-Dist: spotipy>=2.24.0
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
|
|
33
|
+
<img width="828" height="294" alt="openaudio" src="docs/assets/banner.webp" />
|
|
34
|
+
|
|
35
|
+
> **Notice:** OpenAudio is based on and is a copy of the [radiantfalcon/OpenTunes](https://github.com/radiantfalcon/OpenTunes) codebase, updated and maintained for use as OpenAudio.
|
|
36
|
+
|
|
37
|
+
Open-Source Music Aggregator for Spotify, YouTube, and YouTube Music. Downloads songs, albums, and playlists with embedded cover art and lyrics. Available for Linux, Windows, MacOS and Android (Termux)
|
|
38
|
+
|
|
39
|
+
[](https://www.python.org/)
|
|
40
|
+
[](LICENSE)
|
|
41
|
+
[](https://github.com/alphap365/openaudio/stargazers)
|
|
42
|
+
[](https://github.com/alphap365/openaudio/commits/main)
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
### Documentation
|
|
47
|
+
|
|
48
|
+
- [Python API](docs/python-api.md)
|
|
49
|
+
- [Termux guide](docs/termux.md)
|
|
50
|
+
- [Architecture](docs/architecture.md)
|
|
51
|
+
- [Components](docs/components.md)
|
|
52
|
+
- [Repository script usage](docs/scripts.md)
|
|
53
|
+
- [Contributing](CONTRIBUTING.md)
|
|
54
|
+
- [Security policy](SECURITY.md)
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
### Installation
|
|
59
|
+
|
|
60
|
+
OpenAudio requires Python 3.10 or newer and FFmpeg.
|
|
61
|
+
|
|
62
|
+
Install [uv](https://docs.astral.sh/uv/getting-started/installation/) if it is not already available, then clone and sync the project:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
git clone https://github.com/alphap365/openaudio.git
|
|
66
|
+
cd OpenAudio
|
|
67
|
+
uv sync
|
|
68
|
+
uv run openaudio
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
`uv sync` creates and manages the project environment. Prefix project commands with `uv run`; this works on Linux, macOS, and PowerShell.
|
|
72
|
+
|
|
73
|
+
#### Android (Termux)
|
|
74
|
+
See the [Termux guide](docs/termux.md) for installation, storage permissions, and mobile mode.
|
|
75
|
+
|
|
76
|
+
### Repository scripts
|
|
77
|
+
|
|
78
|
+
From a checkout, use `bash scripts/setup.sh` followed by `bash scripts/run.sh --help` on Linux, macOS, or Termux. On Windows, use `.\scripts\setup.bat` followed by `.\scripts\openaudio.bat --help`.
|
|
79
|
+
|
|
80
|
+
See the [script usage guide](docs/scripts.md) for the launcher and installer details.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
### How to Use
|
|
85
|
+
|
|
86
|
+
#### 1. Interactive Mode
|
|
87
|
+
Run without arguments to open the interactive dashboard:
|
|
88
|
+
```bash
|
|
89
|
+
uv run openaudio
|
|
90
|
+
```
|
|
91
|
+
Key shortcuts inside the app:
|
|
92
|
+
- `1` : Download tab
|
|
93
|
+
- `2` : Live Search & Discover tab (searches live as you type)
|
|
94
|
+
- `3` : Settings tab (formats, bitrates, lyrics, output path)
|
|
95
|
+
- `Ctrl + C` : Quit
|
|
96
|
+
|
|
97
|
+
#### 2. Command Line Examples
|
|
98
|
+
|
|
99
|
+
Download a Spotify playlist:
|
|
100
|
+
```bash
|
|
101
|
+
uv run openaudio "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M"
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Download a Spotify album in lossless FLAC:
|
|
105
|
+
```bash
|
|
106
|
+
uv run openaudio "https://open.spotify.com/album/4m2880jivSbbyEGAKfITCa" -f flac
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Download a YouTube / YouTube Music playlist in Opus:
|
|
110
|
+
```bash
|
|
111
|
+
uv run openaudio "https://music.youtube.com/playlist?list=PL..." -f opus -q 160k
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Search and download a song directly by name:
|
|
115
|
+
```bash
|
|
116
|
+
uv run openaudio --search "Queen Bohemian Rhapsody"
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Download to a custom folder:
|
|
120
|
+
```bash
|
|
121
|
+
uv run openaudio "https://open.spotify.com/track/4cOdK2wGLETKBW3PvgPWqT" -o ~/Music/Rock
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Batch download from a text file:
|
|
125
|
+
```bash
|
|
126
|
+
uv run openaudio --batch urls.txt
|
|
127
|
+
```
|
|
128
|
+
*(urls.txt can have one Spotify link, YouTube link, or song query per line)*
|
|
129
|
+
|
|
130
|
+
Save synced lyrics as a separate `.lrc` file:
|
|
131
|
+
```bash
|
|
132
|
+
uv run openaudio "https://open.spotify.com/track/4cOdK2wGLETKBW3PvgPWqT" --lrc
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Run in simple mobile mode (recommended on narrow terminals / Termux):
|
|
136
|
+
```bash
|
|
137
|
+
uv run openaudio --mobile
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
Check system environment and FFmpeg installation:
|
|
141
|
+
```bash
|
|
142
|
+
uv run openaudio --check
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
### CLI Reference
|
|
148
|
+
|
|
149
|
+
| Flag | Short | Description | Default |
|
|
150
|
+
|---|---|---|---|
|
|
151
|
+
| `url_or_query` | | Spotify/YouTube URL or song name | Launches interactive app |
|
|
152
|
+
| `--format` | `-f` | Audio format: `mp3`, `flac`, `opus`, `wav`, `m4a` | `mp3` |
|
|
153
|
+
| `--quality` | `-q` | Audio bitrate: `320k`, `256k`, `192k`, `128k`, `best` | `320k` |
|
|
154
|
+
| `--output` | `-o` | Destination folder for downloads | `~/Music` |
|
|
155
|
+
| `--lrc` | | Export synced `.lrc` lyrics file next to audio | `false` |
|
|
156
|
+
| `--no-lyrics` | | Skip fetching and embedding lyrics | `false` |
|
|
157
|
+
| `--batch` | | Path to text file with links/queries | `none` |
|
|
158
|
+
| `--search` | | Search query to download best match | `none` |
|
|
159
|
+
| `--mobile` | | Simple prompt menu for mobile Termux | Auto-detected |
|
|
160
|
+
| `--overwrite` | | Force overwrite existing files | `false` |
|
|
161
|
+
| `--interactive`| `-i` | Force full-screen TUI | `false` |
|
|
162
|
+
| `--check` | | Check system dependencies and FFmpeg | |
|
|
163
|
+
| `--version` | `-v` | Print version | |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
### Audio Formats & Bitrates
|
|
168
|
+
|
|
169
|
+
- **MP3**: Constant bitrate (`320k`, `256k`, `192k`, `128k`) with universal ID3v2.3 tags and embedded artwork.
|
|
170
|
+
- **FLAC**: Lossless compression with Vorbis metadata and embedded artwork.
|
|
171
|
+
- **OPUS**: High-efficiency VBR audio (`160k`, `128k`, `96k`) with Vorbis comments.
|
|
172
|
+
- **WAV**: Uncompressed 16-bit PCM audio.
|
|
173
|
+
- **M4A / AAC**: AAC encoding (`256k`, `320k`) with MP4 metadata.
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### Configuration
|
|
178
|
+
|
|
179
|
+
Settings persist across runs and are saved at:
|
|
180
|
+
- **Linux / Android**: `~/.config/openaudio/config.json`
|
|
181
|
+
- **Windows**: `%USERPROFILE%\.config\openaudio\config.json`
|
|
182
|
+
|
|
183
|
+
Example `config.json`:
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"format": "mp3",
|
|
187
|
+
"bitrate": "320k",
|
|
188
|
+
"output_dir": "~/Music",
|
|
189
|
+
"fetch_lyrics": true,
|
|
190
|
+
"save_lrc": false,
|
|
191
|
+
"embed_cover": true,
|
|
192
|
+
"overwrite": false,
|
|
193
|
+
"max_retries": 3,
|
|
194
|
+
"rate_limit_delay": 1.2
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
You can also change these settings interactively through the Settings tab (`[3]`) in the desktop app or the Settings menu in mobile mode.
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
### Requirements
|
|
203
|
+
|
|
204
|
+
- **Python**: 3.13 or newer
|
|
205
|
+
- **FFmpeg**: Required for audio conversion and metadata embedding
|
|
206
|
+
|
|
207
|
+
Installing FFmpeg:
|
|
208
|
+
- **Ubuntu / Debian**: `sudo apt install ffmpeg`
|
|
209
|
+
- **Arch Linux**: `sudo pacman -S ffmpeg`
|
|
210
|
+
- **macOS**: `brew install ffmpeg`
|
|
211
|
+
- **Android (Termux)**: `pkg install ffmpeg`
|
|
212
|
+
- **Windows**: `winget install Gyan.FFmpeg`
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
### Development
|
|
217
|
+
|
|
218
|
+
Install the development dependencies with [uv](https://docs.astral.sh/uv/):
|
|
219
|
+
```bash
|
|
220
|
+
uv sync --group dev
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
Run the test suite with:
|
|
224
|
+
```bash
|
|
225
|
+
uv run pytest
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
### License
|
|
231
|
+
|
|
232
|
+
MIT
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
### Contributors
|
|
237
|
+
|
|
238
|
+
Contributors are updated automatically:
|
|
239
|
+
|
|
240
|
+
[](https://github.com/alphap365/openaudio/graphs/contributors)
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
<img width="828" height="294" alt="openaudio" src="docs/assets/banner.webp" />
|
|
2
|
+
|
|
3
|
+
> **Notice:** OpenAudio is based on and is a copy of the [radiantfalcon/OpenTunes](https://github.com/radiantfalcon/OpenTunes) codebase, updated and maintained for use as OpenAudio.
|
|
4
|
+
|
|
5
|
+
Open-Source Music Aggregator for Spotify, YouTube, and YouTube Music. Downloads songs, albums, and playlists with embedded cover art and lyrics. Available for Linux, Windows, MacOS and Android (Termux)
|
|
6
|
+
|
|
7
|
+
[](https://www.python.org/)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](https://github.com/alphap365/openaudio/stargazers)
|
|
10
|
+
[](https://github.com/alphap365/openaudio/commits/main)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
### Documentation
|
|
15
|
+
|
|
16
|
+
- [Python API](docs/python-api.md)
|
|
17
|
+
- [Termux guide](docs/termux.md)
|
|
18
|
+
- [Architecture](docs/architecture.md)
|
|
19
|
+
- [Components](docs/components.md)
|
|
20
|
+
- [Repository script usage](docs/scripts.md)
|
|
21
|
+
- [Contributing](CONTRIBUTING.md)
|
|
22
|
+
- [Security policy](SECURITY.md)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
### Installation
|
|
27
|
+
|
|
28
|
+
OpenAudio requires Python 3.10 or newer and FFmpeg.
|
|
29
|
+
|
|
30
|
+
Install [uv](https://docs.astral.sh/uv/getting-started/installation/) if it is not already available, then clone and sync the project:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git clone https://github.com/alphap365/openaudio.git
|
|
34
|
+
cd OpenAudio
|
|
35
|
+
uv sync
|
|
36
|
+
uv run openaudio
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
`uv sync` creates and manages the project environment. Prefix project commands with `uv run`; this works on Linux, macOS, and PowerShell.
|
|
40
|
+
|
|
41
|
+
#### Android (Termux)
|
|
42
|
+
See the [Termux guide](docs/termux.md) for installation, storage permissions, and mobile mode.
|
|
43
|
+
|
|
44
|
+
### Repository scripts
|
|
45
|
+
|
|
46
|
+
From a checkout, use `bash scripts/setup.sh` followed by `bash scripts/run.sh --help` on Linux, macOS, or Termux. On Windows, use `.\scripts\setup.bat` followed by `.\scripts\openaudio.bat --help`.
|
|
47
|
+
|
|
48
|
+
See the [script usage guide](docs/scripts.md) for the launcher and installer details.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
### How to Use
|
|
53
|
+
|
|
54
|
+
#### 1. Interactive Mode
|
|
55
|
+
Run without arguments to open the interactive dashboard:
|
|
56
|
+
```bash
|
|
57
|
+
uv run openaudio
|
|
58
|
+
```
|
|
59
|
+
Key shortcuts inside the app:
|
|
60
|
+
- `1` : Download tab
|
|
61
|
+
- `2` : Live Search & Discover tab (searches live as you type)
|
|
62
|
+
- `3` : Settings tab (formats, bitrates, lyrics, output path)
|
|
63
|
+
- `Ctrl + C` : Quit
|
|
64
|
+
|
|
65
|
+
#### 2. Command Line Examples
|
|
66
|
+
|
|
67
|
+
Download a Spotify playlist:
|
|
68
|
+
```bash
|
|
69
|
+
uv run openaudio "https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Download a Spotify album in lossless FLAC:
|
|
73
|
+
```bash
|
|
74
|
+
uv run openaudio "https://open.spotify.com/album/4m2880jivSbbyEGAKfITCa" -f flac
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Download a YouTube / YouTube Music playlist in Opus:
|
|
78
|
+
```bash
|
|
79
|
+
uv run openaudio "https://music.youtube.com/playlist?list=PL..." -f opus -q 160k
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Search and download a song directly by name:
|
|
83
|
+
```bash
|
|
84
|
+
uv run openaudio --search "Queen Bohemian Rhapsody"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Download to a custom folder:
|
|
88
|
+
```bash
|
|
89
|
+
uv run openaudio "https://open.spotify.com/track/4cOdK2wGLETKBW3PvgPWqT" -o ~/Music/Rock
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Batch download from a text file:
|
|
93
|
+
```bash
|
|
94
|
+
uv run openaudio --batch urls.txt
|
|
95
|
+
```
|
|
96
|
+
*(urls.txt can have one Spotify link, YouTube link, or song query per line)*
|
|
97
|
+
|
|
98
|
+
Save synced lyrics as a separate `.lrc` file:
|
|
99
|
+
```bash
|
|
100
|
+
uv run openaudio "https://open.spotify.com/track/4cOdK2wGLETKBW3PvgPWqT" --lrc
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Run in simple mobile mode (recommended on narrow terminals / Termux):
|
|
104
|
+
```bash
|
|
105
|
+
uv run openaudio --mobile
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Check system environment and FFmpeg installation:
|
|
109
|
+
```bash
|
|
110
|
+
uv run openaudio --check
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
### CLI Reference
|
|
116
|
+
|
|
117
|
+
| Flag | Short | Description | Default |
|
|
118
|
+
|---|---|---|---|
|
|
119
|
+
| `url_or_query` | | Spotify/YouTube URL or song name | Launches interactive app |
|
|
120
|
+
| `--format` | `-f` | Audio format: `mp3`, `flac`, `opus`, `wav`, `m4a` | `mp3` |
|
|
121
|
+
| `--quality` | `-q` | Audio bitrate: `320k`, `256k`, `192k`, `128k`, `best` | `320k` |
|
|
122
|
+
| `--output` | `-o` | Destination folder for downloads | `~/Music` |
|
|
123
|
+
| `--lrc` | | Export synced `.lrc` lyrics file next to audio | `false` |
|
|
124
|
+
| `--no-lyrics` | | Skip fetching and embedding lyrics | `false` |
|
|
125
|
+
| `--batch` | | Path to text file with links/queries | `none` |
|
|
126
|
+
| `--search` | | Search query to download best match | `none` |
|
|
127
|
+
| `--mobile` | | Simple prompt menu for mobile Termux | Auto-detected |
|
|
128
|
+
| `--overwrite` | | Force overwrite existing files | `false` |
|
|
129
|
+
| `--interactive`| `-i` | Force full-screen TUI | `false` |
|
|
130
|
+
| `--check` | | Check system dependencies and FFmpeg | |
|
|
131
|
+
| `--version` | `-v` | Print version | |
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
### Audio Formats & Bitrates
|
|
136
|
+
|
|
137
|
+
- **MP3**: Constant bitrate (`320k`, `256k`, `192k`, `128k`) with universal ID3v2.3 tags and embedded artwork.
|
|
138
|
+
- **FLAC**: Lossless compression with Vorbis metadata and embedded artwork.
|
|
139
|
+
- **OPUS**: High-efficiency VBR audio (`160k`, `128k`, `96k`) with Vorbis comments.
|
|
140
|
+
- **WAV**: Uncompressed 16-bit PCM audio.
|
|
141
|
+
- **M4A / AAC**: AAC encoding (`256k`, `320k`) with MP4 metadata.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
### Configuration
|
|
146
|
+
|
|
147
|
+
Settings persist across runs and are saved at:
|
|
148
|
+
- **Linux / Android**: `~/.config/openaudio/config.json`
|
|
149
|
+
- **Windows**: `%USERPROFILE%\.config\openaudio\config.json`
|
|
150
|
+
|
|
151
|
+
Example `config.json`:
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"format": "mp3",
|
|
155
|
+
"bitrate": "320k",
|
|
156
|
+
"output_dir": "~/Music",
|
|
157
|
+
"fetch_lyrics": true,
|
|
158
|
+
"save_lrc": false,
|
|
159
|
+
"embed_cover": true,
|
|
160
|
+
"overwrite": false,
|
|
161
|
+
"max_retries": 3,
|
|
162
|
+
"rate_limit_delay": 1.2
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
You can also change these settings interactively through the Settings tab (`[3]`) in the desktop app or the Settings menu in mobile mode.
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
### Requirements
|
|
171
|
+
|
|
172
|
+
- **Python**: 3.13 or newer
|
|
173
|
+
- **FFmpeg**: Required for audio conversion and metadata embedding
|
|
174
|
+
|
|
175
|
+
Installing FFmpeg:
|
|
176
|
+
- **Ubuntu / Debian**: `sudo apt install ffmpeg`
|
|
177
|
+
- **Arch Linux**: `sudo pacman -S ffmpeg`
|
|
178
|
+
- **macOS**: `brew install ffmpeg`
|
|
179
|
+
- **Android (Termux)**: `pkg install ffmpeg`
|
|
180
|
+
- **Windows**: `winget install Gyan.FFmpeg`
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
### Development
|
|
185
|
+
|
|
186
|
+
Install the development dependencies with [uv](https://docs.astral.sh/uv/):
|
|
187
|
+
```bash
|
|
188
|
+
uv sync --group dev
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Run the test suite with:
|
|
192
|
+
```bash
|
|
193
|
+
uv run pytest
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
### License
|
|
199
|
+
|
|
200
|
+
MIT
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### Contributors
|
|
205
|
+
|
|
206
|
+
Contributors are updated automatically:
|
|
207
|
+
|
|
208
|
+
[](https://github.com/alphap365/openaudio/graphs/contributors)
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "pyopenaudio"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Lightweight, cross-platform music downloader and offline music player for YouTube Music & Spotify."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [{name = "alphap365", email = "arajitpaul2010@gmail.com"}]
|
|
11
|
+
license = "MIT"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
15
|
+
"Programming Language :: Python :: 3.10",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Programming Language :: Python :: 3.14",
|
|
20
|
+
"Operating System :: OS Independent",
|
|
21
|
+
"Environment :: Console",
|
|
22
|
+
"Intended Audience :: End Users/Desktop",
|
|
23
|
+
"Topic :: Multimedia :: Sound/Audio",
|
|
24
|
+
"Topic :: Multimedia :: Sound/Audio :: Players",
|
|
25
|
+
]
|
|
26
|
+
requires-python = ">=3.10"
|
|
27
|
+
keywords = [
|
|
28
|
+
"music",
|
|
29
|
+
"downloader",
|
|
30
|
+
"spotify",
|
|
31
|
+
"youtube",
|
|
32
|
+
"ytmusic",
|
|
33
|
+
"termux",
|
|
34
|
+
"tui",
|
|
35
|
+
"offline-player",
|
|
36
|
+
]
|
|
37
|
+
dependencies = [
|
|
38
|
+
"yt-dlp>=2024.8.0",
|
|
39
|
+
"textual>=0.50.0",
|
|
40
|
+
"rich>=13.7.0",
|
|
41
|
+
"mutagen>=1.47.0",
|
|
42
|
+
"requests>=2.31.0",
|
|
43
|
+
"rapidfuzz>=3.0.0",
|
|
44
|
+
"spotipy>=2.24.0",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
[project.urls]
|
|
48
|
+
Homepage = "https://github.com/alphap365/openaudio"
|
|
49
|
+
|
|
50
|
+
[project.scripts]
|
|
51
|
+
openaudio = "openaudio:main"
|
|
52
|
+
|
|
53
|
+
[tool.setuptools]
|
|
54
|
+
include-package-data = true
|
|
55
|
+
|
|
56
|
+
[tool.setuptools.packages.find]
|
|
57
|
+
where = ["src"]
|
|
58
|
+
include = ["openaudio*"]
|
|
59
|
+
|
|
60
|
+
[tool.setuptools.package-data]
|
|
61
|
+
openaudio = ["py.typed"]
|
|
62
|
+
|
|
63
|
+
[tool.pytest.ini_options]
|
|
64
|
+
testpaths = ["tests"]
|
|
65
|
+
pythonpath = ["src"]
|
|
66
|
+
|
|
67
|
+
[tool.ty.environment]
|
|
68
|
+
python-version = "3.10"
|
|
69
|
+
|
|
70
|
+
[tool.ty.rules]
|
|
71
|
+
import-not-found = "ignore"
|
|
72
|
+
|
|
73
|
+
[tool.ty.src]
|
|
74
|
+
include = ["src/openaudio"]
|
|
75
|
+
|
|
76
|
+
[dependency-groups]
|
|
77
|
+
dev = [
|
|
78
|
+
"pytest>=7.0",
|
|
79
|
+
"pytest-cov>=4.0",
|
|
80
|
+
"pytest-vcr>=1.0",
|
|
81
|
+
"respx>=0.20",
|
|
82
|
+
"tox>=4.0",
|
|
83
|
+
"pytest-mock>=3.0",
|
|
84
|
+
"cibuildwheel",
|
|
85
|
+
"tomli>=2.0; python_version < '3.11'",
|
|
86
|
+
"ruff>=0.17.6",
|
|
87
|
+
"ty>=0.0.107",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
[tool.ruff]
|
|
91
|
+
target-version = "py310"
|
|
92
|
+
|
|
93
|
+
[tool.ruff.lint]
|
|
94
|
+
select = ["E4", "E7", "E9", "F"]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
__version__ = "1.0.0"
|
|
3
|
+
|
|
4
|
+
from .core.config import get_download_options, load_config, save_config
|
|
5
|
+
from .main import main, normalize_quality, parse_args
|
|
6
|
+
from .ui.cli import execute_download, run_diagnostics
|
|
7
|
+
from .ui.tui import run_interactive_tui
|
|
8
|
+
from .utils.formatting import (
|
|
9
|
+
clean_artist_name,
|
|
10
|
+
format_bytes,
|
|
11
|
+
format_duration,
|
|
12
|
+
pad_number,
|
|
13
|
+
sanitize_filename,
|
|
14
|
+
)
|
|
15
|
+
from .utils.system import (
|
|
16
|
+
check_internet_connection,
|
|
17
|
+
get_default_music_dir,
|
|
18
|
+
get_ffmpeg_install_instructions,
|
|
19
|
+
get_ffmpeg_path,
|
|
20
|
+
get_platform_name,
|
|
21
|
+
is_ffmpeg_available,
|
|
22
|
+
is_narrow_screen,
|
|
23
|
+
is_termux,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"__version__",
|
|
28
|
+
"check_internet_connection",
|
|
29
|
+
"clean_artist_name",
|
|
30
|
+
"execute_download",
|
|
31
|
+
"format_bytes",
|
|
32
|
+
"format_duration",
|
|
33
|
+
"get_default_music_dir",
|
|
34
|
+
"get_download_options",
|
|
35
|
+
"get_ffmpeg_install_instructions",
|
|
36
|
+
"get_ffmpeg_path",
|
|
37
|
+
"get_platform_name",
|
|
38
|
+
"is_ffmpeg_available",
|
|
39
|
+
"is_narrow_screen",
|
|
40
|
+
"is_termux",
|
|
41
|
+
"load_config",
|
|
42
|
+
"main",
|
|
43
|
+
"normalize_quality",
|
|
44
|
+
"pad_number",
|
|
45
|
+
"parse_args",
|
|
46
|
+
"run_diagnostics",
|
|
47
|
+
"run_interactive_tui",
|
|
48
|
+
"sanitize_filename",
|
|
49
|
+
"save_config",
|
|
50
|
+
]
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import json
|
|
2
|
+
import os
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
from typing import Any, Dict
|
|
5
|
+
|
|
6
|
+
from openaudio.core.models import DownloadOptions
|
|
7
|
+
from openaudio.utils.system import get_default_music_dir
|
|
8
|
+
|
|
9
|
+
CONFIG_DIR = Path(os.environ.get("XDG_CONFIG_HOME", Path.home() / ".config")) / "openaudio"
|
|
10
|
+
CONFIG_FILE = CONFIG_DIR / "config.json"
|
|
11
|
+
|
|
12
|
+
DEFAULT_CONFIG: Dict[str, Any] = {
|
|
13
|
+
"format": "mp3",
|
|
14
|
+
"bitrate": "320k",
|
|
15
|
+
"output_dir": str(get_default_music_dir()),
|
|
16
|
+
"sequential_naming": True,
|
|
17
|
+
"naming_template": "{index:03d} - {title} - {artist}",
|
|
18
|
+
"fetch_lyrics": True,
|
|
19
|
+
"save_lrc": False,
|
|
20
|
+
"embed_cover": True,
|
|
21
|
+
"overwrite": False,
|
|
22
|
+
"max_retries": 3,
|
|
23
|
+
"rate_limit_delay": 1.2,
|
|
24
|
+
"mobile_mode": False,
|
|
25
|
+
"concurrent_downloads": 3,
|
|
26
|
+
"spotify_client_id": "",
|
|
27
|
+
"spotify_client_secret": "",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
def load_config() -> Dict[str, Any]:
|
|
31
|
+
if not CONFIG_FILE.exists():
|
|
32
|
+
save_config(DEFAULT_CONFIG)
|
|
33
|
+
return dict(DEFAULT_CONFIG)
|
|
34
|
+
|
|
35
|
+
try:
|
|
36
|
+
with open(CONFIG_FILE, "r", encoding="utf-8") as f:
|
|
37
|
+
data = json.load(f)
|
|
38
|
+
config = dict(DEFAULT_CONFIG)
|
|
39
|
+
config.update(data)
|
|
40
|
+
return config
|
|
41
|
+
except Exception:
|
|
42
|
+
return dict(DEFAULT_CONFIG)
|
|
43
|
+
|
|
44
|
+
def save_config(config: Dict[str, Any]) -> None:
|
|
45
|
+
try:
|
|
46
|
+
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
|
47
|
+
with open(CONFIG_FILE, "w", encoding="utf-8") as f:
|
|
48
|
+
json.dump(config, f, indent=2)
|
|
49
|
+
except Exception:
|
|
50
|
+
local_cfg = Path.cwd() / "openaudio_config.json"
|
|
51
|
+
with open(local_cfg, "w", encoding="utf-8") as f:
|
|
52
|
+
json.dump(config, f, indent=2)
|
|
53
|
+
|
|
54
|
+
def get_download_options(overrides: Dict[str, Any] | None = None) -> DownloadOptions:
|
|
55
|
+
cfg = load_config()
|
|
56
|
+
if overrides:
|
|
57
|
+
cfg.update({k: v for k, v in overrides.items() if v is not None})
|
|
58
|
+
|
|
59
|
+
out_dir = Path(cfg.get("output_dir", str(get_default_music_dir()))).expanduser()
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
concurrent_val = max(1, min(5, int(cfg.get("concurrent_downloads", 3))))
|
|
63
|
+
except Exception:
|
|
64
|
+
concurrent_val = 3
|
|
65
|
+
|
|
66
|
+
return DownloadOptions(
|
|
67
|
+
format=cfg.get("format", "mp3"),
|
|
68
|
+
bitrate=cfg.get("bitrate", "320k"),
|
|
69
|
+
output_dir=out_dir,
|
|
70
|
+
sequential_naming=cfg.get("sequential_naming", True),
|
|
71
|
+
naming_template=cfg.get("naming_template", "{index:03d} - {title} - {artist}"),
|
|
72
|
+
fetch_lyrics=cfg.get("fetch_lyrics", True),
|
|
73
|
+
save_lrc=cfg.get("save_lrc", False),
|
|
74
|
+
embed_cover=cfg.get("embed_cover", True),
|
|
75
|
+
overwrite=cfg.get("overwrite", False),
|
|
76
|
+
max_retries=cfg.get("max_retries", 3),
|
|
77
|
+
rate_limit_delay=float(cfg.get("rate_limit_delay", 1.2)),
|
|
78
|
+
mobile_mode=cfg.get("mobile_mode", False),
|
|
79
|
+
concurrent_downloads=concurrent_val,
|
|
80
|
+
)
|