idm-cli 1.2.0__tar.gz → 1.3.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.
- {idm_cli-1.2.0 → idm_cli-1.3.0}/MANIFEST.in +2 -1
- idm_cli-1.3.0/PKG-INFO +230 -0
- idm_cli-1.3.0/README.md +194 -0
- idm_cli-1.3.0/idm_cli/__init__.py +3 -0
- idm_cli-1.3.0/idm_cli/__main__.py +4 -0
- idm_cli-1.3.0/idm_cli/config.py +75 -0
- idm_cli-1.3.0/idm_cli/downloader/__init__.py +0 -0
- idm_cli-1.3.0/idm_cli/downloader/core.py +308 -0
- idm_cli-1.3.0/idm_cli/downloader/downloader.py +256 -0
- idm_cli-1.3.0/idm_cli/downloader/handlers.py +152 -0
- idm_cli-1.3.0/idm_cli/downloader/muxer.py +179 -0
- {idm_cli-1.2.0/idm_cli → idm_cli-1.3.0/idm_cli/downloader}/state.py +60 -59
- idm_cli-1.3.0/idm_cli/extension/__init__.py +0 -0
- idm_cli-1.3.0/idm_cli/extension/daemon.py +44 -0
- idm_cli-1.3.0/idm_cli/extension/extension.py +161 -0
- idm_cli-1.3.0/idm_cli/extension/native_host.py +124 -0
- {idm_cli-1.2.0 → idm_cli-1.3.0}/idm_cli/extractors/__init__.py +2 -6
- {idm_cli-1.2.0 → idm_cli-1.3.0}/idm_cli/extractors/direct.py +19 -19
- {idm_cli-1.2.0 → idm_cli-1.3.0}/idm_cli/extractors/winget.py +72 -65
- idm_cli-1.2.0/idm_cli/extractors/youtube.py → idm_cli-1.3.0/idm_cli/extractors/ytdlp.py +139 -112
- idm_cli-1.3.0/idm_cli/ui/__init__.py +0 -0
- idm_cli-1.3.0/idm_cli/ui/cli.py +217 -0
- idm_cli-1.3.0/idm_cli/ui/utils.py +151 -0
- {idm_cli-1.2.0 → idm_cli-1.3.0}/idm_cli/update_checker.py +71 -67
- idm_cli-1.3.0/idm_cli.egg-info/PKG-INFO +230 -0
- idm_cli-1.3.0/idm_cli.egg-info/SOURCES.txt +32 -0
- idm_cli-1.3.0/idm_cli.egg-info/entry_points.txt +2 -0
- {idm_cli-1.2.0 → idm_cli-1.3.0}/idm_cli.egg-info/requires.txt +3 -0
- {idm_cli-1.2.0 → idm_cli-1.3.0}/requirements.txt +13 -10
- {idm_cli-1.2.0 → idm_cli-1.3.0}/setup.py +46 -46
- idm_cli-1.2.0/PKG-INFO +0 -124
- idm_cli-1.2.0/README.md +0 -91
- idm_cli-1.2.0/idm_cli/__init__.py +0 -3
- idm_cli-1.2.0/idm_cli/browser_extension/background.js +0 -41
- idm_cli-1.2.0/idm_cli/browser_extension/icon128.png +0 -0
- idm_cli-1.2.0/idm_cli/browser_extension/icon16.png +0 -0
- idm_cli-1.2.0/idm_cli/browser_extension/icon32.png +0 -0
- idm_cli-1.2.0/idm_cli/browser_extension/icon48.png +0 -0
- idm_cli-1.2.0/idm_cli/browser_extension/manifest.json +0 -17
- idm_cli-1.2.0/idm_cli/cli.py +0 -785
- idm_cli-1.2.0/idm_cli/daemon.py +0 -35
- idm_cli-1.2.0/idm_cli/downloader.py +0 -158
- idm_cli-1.2.0/idm_cli/extractors/facebook.py +0 -112
- idm_cli-1.2.0/idm_cli/extractors/instagram.py +0 -116
- idm_cli-1.2.0/idm_cli/muxer.py +0 -75
- idm_cli-1.2.0/idm_cli/native_host.py +0 -78
- idm_cli-1.2.0/idm_cli.egg-info/PKG-INFO +0 -124
- idm_cli-1.2.0/idm_cli.egg-info/SOURCES.txt +0 -31
- idm_cli-1.2.0/idm_cli.egg-info/entry_points.txt +0 -2
- {idm_cli-1.2.0 → idm_cli-1.3.0}/LICENSE +0 -0
- {idm_cli-1.2.0 → idm_cli-1.3.0}/idm_cli.egg-info/dependency_links.txt +0 -0
- {idm_cli-1.2.0 → idm_cli-1.3.0}/idm_cli.egg-info/top_level.txt +0 -0
- {idm_cli-1.2.0 → idm_cli-1.3.0}/setup.cfg +0 -0
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
include requirements.txt
|
|
2
|
+
recursive-include idm_cli/browser_extension *
|
idm_cli-1.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: idm-cli
|
|
3
|
+
Version: 1.3.0
|
|
4
|
+
Summary: A lightning-fast, universal command-line download manager
|
|
5
|
+
Home-page: https://github.com/rj41-w2/idm-cli
|
|
6
|
+
Author: Rehan
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: typer
|
|
15
|
+
Requires-Dist: rich
|
|
16
|
+
Requires-Dist: aiohttp
|
|
17
|
+
Requires-Dist: aiofiles
|
|
18
|
+
Requires-Dist: yt-dlp
|
|
19
|
+
Requires-Dist: pyfiglet
|
|
20
|
+
Requires-Dist: questionary
|
|
21
|
+
Requires-Dist: aiodns
|
|
22
|
+
Requires-Dist: Brotli
|
|
23
|
+
Requires-Dist: psutil
|
|
24
|
+
Requires-Dist: platformdirs
|
|
25
|
+
Requires-Dist: pytest
|
|
26
|
+
Requires-Dist: pytest-asyncio
|
|
27
|
+
Dynamic: author
|
|
28
|
+
Dynamic: classifier
|
|
29
|
+
Dynamic: description
|
|
30
|
+
Dynamic: description-content-type
|
|
31
|
+
Dynamic: home-page
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
Dynamic: requires-dist
|
|
34
|
+
Dynamic: requires-python
|
|
35
|
+
Dynamic: summary
|
|
36
|
+
|
|
37
|
+
# IDM-CLI (Internet Download Manager CLI)
|
|
38
|
+
|
|
39
|
+
*Inspired by the official [Internet Download Manager (IDM)](https://www.internetdownloadmanager.com/)*
|
|
40
|
+
|
|
41
|
+
A lightning-fast, cross-platform command-line download manager written in Python. IDM-CLI splits files into multiple parallel chunks (default 8, up to 32) to maximize your internet speed. It supports downloading from **YouTube**, **Facebook**, **Instagram**, and any **Direct File URL** (`.exe`, `.zip`, `.pdf`, etc.).
|
|
42
|
+
|
|
43
|
+
## Features
|
|
44
|
+
|
|
45
|
+
- **Parallel Chunk Engine** — Splits downloads into multiple concurrent chunks using `aiohttp` async sessions to fully saturate your bandwidth.
|
|
46
|
+
- **Universal Downloader** — Paste any direct URL. A built-in HTTP `HEAD` detector automatically recognizes file types and routes them to the parallel engine.
|
|
47
|
+
- **Social Media Support** — Natively supports YouTube, Facebook, and Instagram via a modular extractor architecture with yt-dlp.
|
|
48
|
+
- **Audio Only / MP3 Conversion** — Download videos as audio. IDM-CLI automatically grabs the best audio stream and uses FFmpeg to convert it to `.mp3`.
|
|
49
|
+
- **Smart Auto-Resume** — Internet dropped? Pressed `Ctrl+C`? No problem. IDM-CLI remembers the exact byte positions of all incomplete chunks. Paste the same link again to resume instantly.
|
|
50
|
+
- **Persistent Queue System** — Add multiple files to a queue with `-Q` and type `start queue` to download them all sequentially.
|
|
51
|
+
- **Browser Extension Integration** — Chrome/Edge extension intercepts downloads and routes them directly into IDM-CLI via Native Messaging.
|
|
52
|
+
- **Interactive UI** — Modern terminal interface powered by `rich` and `questionary` with real-time speed, ETA, and progress bars. Press `p` to pause, `r` to resume.
|
|
53
|
+
- **Cross-Platform** — Works on Windows, macOS, and Linux with platform-specific FFmpeg handling and browser registration.
|
|
54
|
+
- **Auto-Update Check** — Checks PyPI once a day and notifies you when a new version is available.
|
|
55
|
+
|
|
56
|
+
## Prerequisites
|
|
57
|
+
|
|
58
|
+
- **Python 3.8+**
|
|
59
|
+
- **FFmpeg** — Required for muxing video and audio streams, and converting to `.mp3`. IDM-CLI can auto-download it for you, or you can install it manually:
|
|
60
|
+
- Windows: `winget install ffmpeg`
|
|
61
|
+
- macOS: `brew install ffmpeg`
|
|
62
|
+
- Linux: `sudo apt install ffmpeg`
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# From PyPI
|
|
68
|
+
pip install idm-cli
|
|
69
|
+
|
|
70
|
+
# From source
|
|
71
|
+
git clone https://github.com/rj41-w2/idm-cli.git
|
|
72
|
+
cd IDM-CLI
|
|
73
|
+
pip install -r requirements.txt
|
|
74
|
+
pip install -e .
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
Run the app interactively:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
idm
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
This opens a prompt where you can paste your link, select video quality, or queue the download.
|
|
86
|
+
|
|
87
|
+
### CLI Flags (Fast Mode)
|
|
88
|
+
|
|
89
|
+
Skip the interactive menus by passing arguments directly:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Download a video at 1080p
|
|
93
|
+
idm "https://youtube.com/watch?v=..." -q 1080p -v
|
|
94
|
+
|
|
95
|
+
# Audio only (converts to MP3)
|
|
96
|
+
idm "https://youtube.com/watch?v=..." -a
|
|
97
|
+
|
|
98
|
+
# 16 parallel chunks for maximum speed
|
|
99
|
+
idm "https://example.com/largefile.zip" -c 16
|
|
100
|
+
|
|
101
|
+
# Add to queue
|
|
102
|
+
idm "https://facebook.com/..." -Q
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
| Flag | Description |
|
|
106
|
+
|------|-------------|
|
|
107
|
+
| `-q <resolution>` | Set video quality (e.g., `1080p`, `720p`) |
|
|
108
|
+
| `-a` | Audio only — download and convert to MP3 |
|
|
109
|
+
| `-v` | Download video + audio (bypasses quality prompt) |
|
|
110
|
+
| `-Q` | Add to queue instead of downloading immediately |
|
|
111
|
+
| `-c <num>` | Number of parallel chunks (default: 8) |
|
|
112
|
+
| `-f <filename>` | Force a custom output filename |
|
|
113
|
+
|
|
114
|
+
### Interactive Commands
|
|
115
|
+
|
|
116
|
+
| Command | Description |
|
|
117
|
+
|---------|-------------|
|
|
118
|
+
| `<URL>` | Download a video or file |
|
|
119
|
+
| `resume` | Resume or delete incomplete downloads |
|
|
120
|
+
| `start queue` | Process all queued downloads |
|
|
121
|
+
| `install extension` | Guide to install the browser extension |
|
|
122
|
+
| `help` | Show available commands and flags |
|
|
123
|
+
| `exit` | Exit the application |
|
|
124
|
+
|
|
125
|
+
### Browser Extension
|
|
126
|
+
|
|
127
|
+
IDM-CLI includes a Chrome/Edge extension that intercepts file downloads automatically. To install it:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
idm
|
|
131
|
+
# then type:
|
|
132
|
+
install extension
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Follow the on-screen guide to load the unpacked extension and link it to IDM-CLI.
|
|
136
|
+
|
|
137
|
+
### Troubleshooting: Windows Device Guard
|
|
138
|
+
|
|
139
|
+
If you get `"idm.exe was blocked by your organization's Device Guard policy"`, run the Python module directly:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
python -m idm_cli
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Architecture
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
idm_cli/
|
|
149
|
+
├── config.py # Platform-aware config, logging, paths
|
|
150
|
+
├── update_checker.py # PyPI version check
|
|
151
|
+
├── ui/
|
|
152
|
+
│ ├── cli.py # Main interactive CLI
|
|
153
|
+
│ └── utils.py # Console, progress listener, validators
|
|
154
|
+
├── downloader/
|
|
155
|
+
│ ├── core.py # Download orchestration & FFmpeg setup
|
|
156
|
+
│ ├── downloader.py # Async chunk download engine
|
|
157
|
+
│ ├── handlers.py # Queue & resume handlers
|
|
158
|
+
│ ├── muxer.py # FFmpeg mux/conversion
|
|
159
|
+
│ └── state.py # Atomic JSON state persistence
|
|
160
|
+
├── extractors/
|
|
161
|
+
│ ├── ytdlp.py # YouTube/social media extractor
|
|
162
|
+
│ ├── direct.py # Direct HTTP file downloader
|
|
163
|
+
│ └── winget.py # Windows Package Manager extractor
|
|
164
|
+
└── extension/
|
|
165
|
+
├── extension.py # Browser extension installer
|
|
166
|
+
├── native_host.py # Native Messaging Host
|
|
167
|
+
├── daemon.py # Queue daemon with PID lock
|
|
168
|
+
└── browser_extension/ # Chrome/Edge extension source
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Contributing
|
|
172
|
+
|
|
173
|
+
Contributions are welcome — whether it's a bug fix, a new feature, or just improving the docs.
|
|
174
|
+
|
|
175
|
+
### Reporting Bugs
|
|
176
|
+
|
|
177
|
+
If you find a bug, [open an issue](https://github.com/rj41-w2/idm-cli/issues/new) with:
|
|
178
|
+
|
|
179
|
+
- A clear title and description of the problem
|
|
180
|
+
- Steps to reproduce the issue
|
|
181
|
+
- Your OS and Python version (`python --version`)
|
|
182
|
+
- The full error output if there is one
|
|
183
|
+
|
|
184
|
+
### Suggesting Features
|
|
185
|
+
|
|
186
|
+
Got an idea? [Open an issue](https://github.com/rj41-w2/idm-cli/issues/new) with the tag `enhancement` and describe:
|
|
187
|
+
|
|
188
|
+
- What you want to happen and why
|
|
189
|
+
- How it would work from the user's perspective
|
|
190
|
+
- Any alternatives you considered
|
|
191
|
+
|
|
192
|
+
### Submitting a Pull Request
|
|
193
|
+
|
|
194
|
+
1. **Fork** the repository from [github.com/rj41-w2/idm-cli](https://github.com/rj41-w2/idm-cli)
|
|
195
|
+
|
|
196
|
+
2. **Clone your fork** and set it up:
|
|
197
|
+
```bash
|
|
198
|
+
git clone https://github.com/<your-username>/idm-cli.git
|
|
199
|
+
cd IDM-CLI
|
|
200
|
+
pip install -r requirements.txt
|
|
201
|
+
pip install -e .
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
3. **Create a branch** for your change:
|
|
205
|
+
```bash
|
|
206
|
+
git checkout -b fix/short-description
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
4. **Make your changes**, test them, and commit with a clear message:
|
|
210
|
+
```bash
|
|
211
|
+
git commit -m "fix: describe the bug you fixed"
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
5. **Push** to your fork and open a Pull Request against `main`:
|
|
215
|
+
```bash
|
|
216
|
+
git push origin fix/short-description
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
6. In your PR description, explain **what changed** and **why**. Link the issue if there is one.
|
|
220
|
+
|
|
221
|
+
### Guidelines
|
|
222
|
+
|
|
223
|
+
- Keep PRs focused on a single change. Don't mix unrelated fixes.
|
|
224
|
+
- Follow the existing code style — no comments unless absolutely necessary.
|
|
225
|
+
- Test your changes on at least one platform before submitting.
|
|
226
|
+
- If you're adding a feature, update the README and spec if needed.
|
|
227
|
+
|
|
228
|
+
## License
|
|
229
|
+
|
|
230
|
+
This project is licensed under the [MIT License](LICENSE).
|
idm_cli-1.3.0/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# IDM-CLI (Internet Download Manager CLI)
|
|
2
|
+
|
|
3
|
+
*Inspired by the official [Internet Download Manager (IDM)](https://www.internetdownloadmanager.com/)*
|
|
4
|
+
|
|
5
|
+
A lightning-fast, cross-platform command-line download manager written in Python. IDM-CLI splits files into multiple parallel chunks (default 8, up to 32) to maximize your internet speed. It supports downloading from **YouTube**, **Facebook**, **Instagram**, and any **Direct File URL** (`.exe`, `.zip`, `.pdf`, etc.).
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Parallel Chunk Engine** — Splits downloads into multiple concurrent chunks using `aiohttp` async sessions to fully saturate your bandwidth.
|
|
10
|
+
- **Universal Downloader** — Paste any direct URL. A built-in HTTP `HEAD` detector automatically recognizes file types and routes them to the parallel engine.
|
|
11
|
+
- **Social Media Support** — Natively supports YouTube, Facebook, and Instagram via a modular extractor architecture with yt-dlp.
|
|
12
|
+
- **Audio Only / MP3 Conversion** — Download videos as audio. IDM-CLI automatically grabs the best audio stream and uses FFmpeg to convert it to `.mp3`.
|
|
13
|
+
- **Smart Auto-Resume** — Internet dropped? Pressed `Ctrl+C`? No problem. IDM-CLI remembers the exact byte positions of all incomplete chunks. Paste the same link again to resume instantly.
|
|
14
|
+
- **Persistent Queue System** — Add multiple files to a queue with `-Q` and type `start queue` to download them all sequentially.
|
|
15
|
+
- **Browser Extension Integration** — Chrome/Edge extension intercepts downloads and routes them directly into IDM-CLI via Native Messaging.
|
|
16
|
+
- **Interactive UI** — Modern terminal interface powered by `rich` and `questionary` with real-time speed, ETA, and progress bars. Press `p` to pause, `r` to resume.
|
|
17
|
+
- **Cross-Platform** — Works on Windows, macOS, and Linux with platform-specific FFmpeg handling and browser registration.
|
|
18
|
+
- **Auto-Update Check** — Checks PyPI once a day and notifies you when a new version is available.
|
|
19
|
+
|
|
20
|
+
## Prerequisites
|
|
21
|
+
|
|
22
|
+
- **Python 3.8+**
|
|
23
|
+
- **FFmpeg** — Required for muxing video and audio streams, and converting to `.mp3`. IDM-CLI can auto-download it for you, or you can install it manually:
|
|
24
|
+
- Windows: `winget install ffmpeg`
|
|
25
|
+
- macOS: `brew install ffmpeg`
|
|
26
|
+
- Linux: `sudo apt install ffmpeg`
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# From PyPI
|
|
32
|
+
pip install idm-cli
|
|
33
|
+
|
|
34
|
+
# From source
|
|
35
|
+
git clone https://github.com/rj41-w2/idm-cli.git
|
|
36
|
+
cd IDM-CLI
|
|
37
|
+
pip install -r requirements.txt
|
|
38
|
+
pip install -e .
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
Run the app interactively:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
idm
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This opens a prompt where you can paste your link, select video quality, or queue the download.
|
|
50
|
+
|
|
51
|
+
### CLI Flags (Fast Mode)
|
|
52
|
+
|
|
53
|
+
Skip the interactive menus by passing arguments directly:
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Download a video at 1080p
|
|
57
|
+
idm "https://youtube.com/watch?v=..." -q 1080p -v
|
|
58
|
+
|
|
59
|
+
# Audio only (converts to MP3)
|
|
60
|
+
idm "https://youtube.com/watch?v=..." -a
|
|
61
|
+
|
|
62
|
+
# 16 parallel chunks for maximum speed
|
|
63
|
+
idm "https://example.com/largefile.zip" -c 16
|
|
64
|
+
|
|
65
|
+
# Add to queue
|
|
66
|
+
idm "https://facebook.com/..." -Q
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
| Flag | Description |
|
|
70
|
+
|------|-------------|
|
|
71
|
+
| `-q <resolution>` | Set video quality (e.g., `1080p`, `720p`) |
|
|
72
|
+
| `-a` | Audio only — download and convert to MP3 |
|
|
73
|
+
| `-v` | Download video + audio (bypasses quality prompt) |
|
|
74
|
+
| `-Q` | Add to queue instead of downloading immediately |
|
|
75
|
+
| `-c <num>` | Number of parallel chunks (default: 8) |
|
|
76
|
+
| `-f <filename>` | Force a custom output filename |
|
|
77
|
+
|
|
78
|
+
### Interactive Commands
|
|
79
|
+
|
|
80
|
+
| Command | Description |
|
|
81
|
+
|---------|-------------|
|
|
82
|
+
| `<URL>` | Download a video or file |
|
|
83
|
+
| `resume` | Resume or delete incomplete downloads |
|
|
84
|
+
| `start queue` | Process all queued downloads |
|
|
85
|
+
| `install extension` | Guide to install the browser extension |
|
|
86
|
+
| `help` | Show available commands and flags |
|
|
87
|
+
| `exit` | Exit the application |
|
|
88
|
+
|
|
89
|
+
### Browser Extension
|
|
90
|
+
|
|
91
|
+
IDM-CLI includes a Chrome/Edge extension that intercepts file downloads automatically. To install it:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
idm
|
|
95
|
+
# then type:
|
|
96
|
+
install extension
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Follow the on-screen guide to load the unpacked extension and link it to IDM-CLI.
|
|
100
|
+
|
|
101
|
+
### Troubleshooting: Windows Device Guard
|
|
102
|
+
|
|
103
|
+
If you get `"idm.exe was blocked by your organization's Device Guard policy"`, run the Python module directly:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
python -m idm_cli
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Architecture
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
idm_cli/
|
|
113
|
+
├── config.py # Platform-aware config, logging, paths
|
|
114
|
+
├── update_checker.py # PyPI version check
|
|
115
|
+
├── ui/
|
|
116
|
+
│ ├── cli.py # Main interactive CLI
|
|
117
|
+
│ └── utils.py # Console, progress listener, validators
|
|
118
|
+
├── downloader/
|
|
119
|
+
│ ├── core.py # Download orchestration & FFmpeg setup
|
|
120
|
+
│ ├── downloader.py # Async chunk download engine
|
|
121
|
+
│ ├── handlers.py # Queue & resume handlers
|
|
122
|
+
│ ├── muxer.py # FFmpeg mux/conversion
|
|
123
|
+
│ └── state.py # Atomic JSON state persistence
|
|
124
|
+
├── extractors/
|
|
125
|
+
│ ├── ytdlp.py # YouTube/social media extractor
|
|
126
|
+
│ ├── direct.py # Direct HTTP file downloader
|
|
127
|
+
│ └── winget.py # Windows Package Manager extractor
|
|
128
|
+
└── extension/
|
|
129
|
+
├── extension.py # Browser extension installer
|
|
130
|
+
├── native_host.py # Native Messaging Host
|
|
131
|
+
├── daemon.py # Queue daemon with PID lock
|
|
132
|
+
└── browser_extension/ # Chrome/Edge extension source
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Contributing
|
|
136
|
+
|
|
137
|
+
Contributions are welcome — whether it's a bug fix, a new feature, or just improving the docs.
|
|
138
|
+
|
|
139
|
+
### Reporting Bugs
|
|
140
|
+
|
|
141
|
+
If you find a bug, [open an issue](https://github.com/rj41-w2/idm-cli/issues/new) with:
|
|
142
|
+
|
|
143
|
+
- A clear title and description of the problem
|
|
144
|
+
- Steps to reproduce the issue
|
|
145
|
+
- Your OS and Python version (`python --version`)
|
|
146
|
+
- The full error output if there is one
|
|
147
|
+
|
|
148
|
+
### Suggesting Features
|
|
149
|
+
|
|
150
|
+
Got an idea? [Open an issue](https://github.com/rj41-w2/idm-cli/issues/new) with the tag `enhancement` and describe:
|
|
151
|
+
|
|
152
|
+
- What you want to happen and why
|
|
153
|
+
- How it would work from the user's perspective
|
|
154
|
+
- Any alternatives you considered
|
|
155
|
+
|
|
156
|
+
### Submitting a Pull Request
|
|
157
|
+
|
|
158
|
+
1. **Fork** the repository from [github.com/rj41-w2/idm-cli](https://github.com/rj41-w2/idm-cli)
|
|
159
|
+
|
|
160
|
+
2. **Clone your fork** and set it up:
|
|
161
|
+
```bash
|
|
162
|
+
git clone https://github.com/<your-username>/idm-cli.git
|
|
163
|
+
cd IDM-CLI
|
|
164
|
+
pip install -r requirements.txt
|
|
165
|
+
pip install -e .
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
3. **Create a branch** for your change:
|
|
169
|
+
```bash
|
|
170
|
+
git checkout -b fix/short-description
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
4. **Make your changes**, test them, and commit with a clear message:
|
|
174
|
+
```bash
|
|
175
|
+
git commit -m "fix: describe the bug you fixed"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
5. **Push** to your fork and open a Pull Request against `main`:
|
|
179
|
+
```bash
|
|
180
|
+
git push origin fix/short-description
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
6. In your PR description, explain **what changed** and **why**. Link the issue if there is one.
|
|
184
|
+
|
|
185
|
+
### Guidelines
|
|
186
|
+
|
|
187
|
+
- Keep PRs focused on a single change. Don't mix unrelated fixes.
|
|
188
|
+
- Follow the existing code style — no comments unless absolutely necessary.
|
|
189
|
+
- Test your changes on at least one platform before submitting.
|
|
190
|
+
- If you're adding a feature, update the README and spec if needed.
|
|
191
|
+
|
|
192
|
+
## License
|
|
193
|
+
|
|
194
|
+
This project is licensed under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import json
|
|
3
|
+
import platform
|
|
4
|
+
import shutil
|
|
5
|
+
import logging
|
|
6
|
+
from logging.handlers import RotatingFileHandler
|
|
7
|
+
from platformdirs import user_data_dir, user_downloads_dir
|
|
8
|
+
|
|
9
|
+
APP_NAME = "idm-cli"
|
|
10
|
+
APP_AUTHOR = "idm-cli"
|
|
11
|
+
CONFIG_DIR = user_data_dir(APP_NAME, APP_AUTHOR)
|
|
12
|
+
CONFIG_FILE = os.path.join(CONFIG_DIR, "config.json")
|
|
13
|
+
LOG_FILE = os.path.join(CONFIG_DIR, "idm.log")
|
|
14
|
+
|
|
15
|
+
def _migrate_old_config():
|
|
16
|
+
old_dir = os.path.expanduser("~/.idm_cli")
|
|
17
|
+
if old_dir == CONFIG_DIR:
|
|
18
|
+
return
|
|
19
|
+
if not os.path.isdir(old_dir):
|
|
20
|
+
return
|
|
21
|
+
os.makedirs(CONFIG_DIR, exist_ok=True)
|
|
22
|
+
for item in os.listdir(old_dir):
|
|
23
|
+
src = os.path.join(old_dir, item)
|
|
24
|
+
dst = os.path.join(CONFIG_DIR, item)
|
|
25
|
+
if not os.path.exists(dst):
|
|
26
|
+
try:
|
|
27
|
+
if os.path.isdir(src):
|
|
28
|
+
shutil.copytree(src, dst)
|
|
29
|
+
else:
|
|
30
|
+
shutil.copy2(src, dst)
|
|
31
|
+
except OSError:
|
|
32
|
+
pass
|
|
33
|
+
|
|
34
|
+
def _get_default_download_dir() -> str:
|
|
35
|
+
return user_downloads_dir()
|
|
36
|
+
|
|
37
|
+
def setup_logging():
|
|
38
|
+
_migrate_old_config()
|
|
39
|
+
os.makedirs(CONFIG_DIR, exist_ok=True)
|
|
40
|
+
logger = logging.getLogger("idm_cli")
|
|
41
|
+
logger.setLevel(logging.DEBUG)
|
|
42
|
+
if not logger.handlers:
|
|
43
|
+
handler = RotatingFileHandler(LOG_FILE, maxBytes=5*1024*1024, backupCount=2)
|
|
44
|
+
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
45
|
+
handler.setFormatter(formatter)
|
|
46
|
+
logger.addHandler(handler)
|
|
47
|
+
return logger
|
|
48
|
+
|
|
49
|
+
logger = setup_logging()
|
|
50
|
+
|
|
51
|
+
DEFAULT_CONFIG = {
|
|
52
|
+
"default_chunks": 8,
|
|
53
|
+
"default_quality": "720p",
|
|
54
|
+
"download_dir": _get_default_download_dir(),
|
|
55
|
+
"last_version": "0.0.0"
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
def load_config():
|
|
59
|
+
config = DEFAULT_CONFIG.copy()
|
|
60
|
+
if os.path.exists(CONFIG_FILE):
|
|
61
|
+
try:
|
|
62
|
+
with open(CONFIG_FILE, "r") as f:
|
|
63
|
+
user_config = json.load(f)
|
|
64
|
+
config.update(user_config)
|
|
65
|
+
except (OSError, json.JSONDecodeError) as e:
|
|
66
|
+
logger.warning(f"Failed to load config: {e}")
|
|
67
|
+
return config
|
|
68
|
+
|
|
69
|
+
def save_config(config_data):
|
|
70
|
+
os.makedirs(CONFIG_DIR, exist_ok=True)
|
|
71
|
+
try:
|
|
72
|
+
with open(CONFIG_FILE, "w") as f:
|
|
73
|
+
json.dump(config_data, f, indent=4)
|
|
74
|
+
except OSError as e:
|
|
75
|
+
logger.error(f"Failed to save config: {e}")
|
|
File without changes
|