openconvert 0.1.0__py3-none-any.whl → 1.0.0__py3-none-any.whl
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.
- openconvert/__init__.py +108 -3
- openconvert/__main__.py +13 -0
- openconvert/client.py +392 -0
- openconvert/openconvert_cli.py +543 -0
- openconvert-1.0.0.dist-info/METADATA +504 -0
- openconvert-1.0.0.dist-info/RECORD +10 -0
- openconvert-1.0.0.dist-info/entry_points.txt +2 -0
- openconvert-1.0.0.dist-info/licenses/LICENSE +21 -0
- openconvert/cli.py +0 -145
- openconvert/converter.py +0 -152
- openconvert/converters/__init__.py +0 -3
- openconvert/converters/archive_converter.py +0 -277
- openconvert/converters/audio_converter.py +0 -223
- openconvert/converters/code_converter.py +0 -412
- openconvert/converters/document_converter.py +0 -596
- openconvert/converters/image_converter.py +0 -214
- openconvert/converters/model_converter.py +0 -208
- openconvert/converters/video_converter.py +0 -259
- openconvert/launcher.py +0 -0
- openconvert-0.1.0.dist-info/METADATA +0 -232
- openconvert-0.1.0.dist-info/RECORD +0 -17
- openconvert-0.1.0.dist-info/entry_points.txt +0 -2
- {openconvert-0.1.0.dist-info → openconvert-1.0.0.dist-info}/WHEEL +0 -0
- {openconvert-0.1.0.dist-info → openconvert-1.0.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,504 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: openconvert
|
3
|
+
Version: 1.0.0
|
4
|
+
Summary: CLI tool for connecting to OpenConvert OpenAgents network for file conversion
|
5
|
+
Home-page: https://github.com/acenta-ai/openconvert
|
6
|
+
Author: OpenAgents Team
|
7
|
+
Author-email: OpenAgents Team <team@openagents.com>
|
8
|
+
Maintainer: OpenAgents Team
|
9
|
+
Maintainer-email: OpenAgents Team <team@openagents.com>
|
10
|
+
License: MIT
|
11
|
+
Project-URL: Homepage, https://github.com/acenta-ai/openconvert
|
12
|
+
Project-URL: Documentation, https://openconvert.readthedocs.io/
|
13
|
+
Project-URL: Repository, https://github.com/acenta-ai/openconvert
|
14
|
+
Project-URL: Bug Reports, https://github.com/acenta-ai/openconvert/issues
|
15
|
+
Keywords: file conversion,openagents,cli,network,format conversion,document conversion
|
16
|
+
Classifier: Development Status :: 4 - Beta
|
17
|
+
Classifier: Intended Audience :: Developers
|
18
|
+
Classifier: Intended Audience :: End Users/Desktop
|
19
|
+
Classifier: License :: OSI Approved :: MIT License
|
20
|
+
Classifier: Operating System :: OS Independent
|
21
|
+
Classifier: Programming Language :: Python :: 3
|
22
|
+
Classifier: Programming Language :: Python :: 3.8
|
23
|
+
Classifier: Programming Language :: Python :: 3.9
|
24
|
+
Classifier: Programming Language :: Python :: 3.10
|
25
|
+
Classifier: Programming Language :: Python :: 3.11
|
26
|
+
Classifier: Programming Language :: Python :: 3.12
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
28
|
+
Classifier: Topic :: Communications
|
29
|
+
Classifier: Topic :: Internet
|
30
|
+
Classifier: Topic :: Multimedia :: Graphics :: Graphics Conversion
|
31
|
+
Classifier: Topic :: Office/Business :: Office Suites
|
32
|
+
Classifier: Topic :: Text Processing :: Markup
|
33
|
+
Classifier: Topic :: Utilities
|
34
|
+
Requires-Python: >=3.8
|
35
|
+
Description-Content-Type: text/markdown
|
36
|
+
License-File: LICENSE
|
37
|
+
Requires-Dist: pyyaml>=5.4.0
|
38
|
+
Requires-Dist: openagents>=0.5.0
|
39
|
+
Provides-Extra: dev
|
40
|
+
Requires-Dist: pytest>=6.0.0; extra == "dev"
|
41
|
+
Requires-Dist: pytest-asyncio>=0.18.0; extra == "dev"
|
42
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
43
|
+
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
44
|
+
Requires-Dist: mypy>=0.910; extra == "dev"
|
45
|
+
Provides-Extra: docs
|
46
|
+
Requires-Dist: sphinx>=4.0.0; extra == "docs"
|
47
|
+
Requires-Dist: sphinx-rtd-theme>=1.0.0; extra == "docs"
|
48
|
+
Requires-Dist: myst-parser>=0.17.0; extra == "docs"
|
49
|
+
Provides-Extra: service
|
50
|
+
Requires-Dist: agconvert; extra == "service"
|
51
|
+
Dynamic: author
|
52
|
+
Dynamic: home-page
|
53
|
+
Dynamic: license-file
|
54
|
+
Dynamic: maintainer
|
55
|
+
Dynamic: requires-python
|
56
|
+
|
57
|
+
<div align="center">
|
58
|
+
|
59
|
+
# 🔄 OpenConvert CLI
|
60
|
+
|
61
|
+
### *Intelligent File Conversion for the Distributed Age*
|
62
|
+
|
63
|
+
[](https://www.python.org/downloads/)
|
64
|
+
[](https://opensource.org/licenses/MIT)
|
65
|
+
[](http://makeapullrequest.com)
|
66
|
+
[](https://github.com/openagents/openagents)
|
67
|
+
|
68
|
+
*Transform any file to any format using distributed AI agents*
|
69
|
+
|
70
|
+
[🚀 Quick Start](#-quick-start) • [📖 Documentation](#-usage) • [🤝 Contributing](#-contributing) • [💬 Community](#-community)
|
71
|
+
|
72
|
+
</div>
|
73
|
+
|
74
|
+
---
|
75
|
+
|
76
|
+
## 🌟 **What is OpenConvert?**
|
77
|
+
|
78
|
+
OpenConvert CLI is a command-line tool that connects to distributed OpenAgents networks to discover and utilize file conversion services. Instead of installing multiple conversion tools, OpenConvert leverages distributed agents to handle various file conversion tasks.
|
79
|
+
|
80
|
+
### ✅ **Currently Implemented**
|
81
|
+
|
82
|
+
🔗 **Network-Powered** • Connect to OpenAgents conversion networks
|
83
|
+
🤖 **Prompt Support** • Use natural language prompts (agent-dependent)
|
84
|
+
📁 **Batch Processing** • Convert files and directories
|
85
|
+
🔍 **Auto-Detection** • Automatic MIME type detection
|
86
|
+
🛡️ **Error Handling** • Comprehensive error reporting
|
87
|
+
⚡ **Async Operations** • Non-blocking network operations
|
88
|
+
🔧 **Python API** • Import and use `from openconvert import convert`
|
89
|
+
📊 **Format Discovery** • `--list-formats` to see available conversions
|
90
|
+
|
91
|
+
### 🚧 **Planned Features**
|
92
|
+
|
93
|
+
🚀 **Enhanced Format Support** • Expand to 50+ formats as agents join
|
94
|
+
🐳 **Easy Deployment** • Docker and Kubernetes support
|
95
|
+
⚙️ **Configuration Files** • YAML config for defaults and preferences
|
96
|
+
|
97
|
+
---
|
98
|
+
|
99
|
+
## 🎬 **See It In Action**
|
100
|
+
|
101
|
+
```bash
|
102
|
+
# Convert a document with AI enhancement
|
103
|
+
openconvert -i data.csv -o report.pdf --prompt "Create a professional report with charts"
|
104
|
+
|
105
|
+
# Batch convert an entire photo library
|
106
|
+
openconvert -i photos/ -o pdfs/ --from image/jpeg --to application/pdf
|
107
|
+
|
108
|
+
# Simple format conversion
|
109
|
+
openconvert -i document.txt -o document.pdf
|
110
|
+
|
111
|
+
# Discover available conversions
|
112
|
+
openconvert --list-formats
|
113
|
+
```
|
114
|
+
|
115
|
+
> 💡 **Pro Tip**: Use natural language prompts to guide conversions (depends on agent capabilities)!
|
116
|
+
|
117
|
+
---
|
118
|
+
|
119
|
+
## 🚀 **Quick Start**
|
120
|
+
|
121
|
+
### Installation
|
122
|
+
|
123
|
+
```bash
|
124
|
+
# Currently: Install from source
|
125
|
+
git clone https://github.com/openagents/openconvert.git
|
126
|
+
cd openconvert
|
127
|
+
pip install -e .
|
128
|
+
|
129
|
+
# Future: PyPI package (planned)
|
130
|
+
# pip install openconvert
|
131
|
+
```
|
132
|
+
|
133
|
+
### Your First Conversion
|
134
|
+
|
135
|
+
```bash
|
136
|
+
# Start an OpenConvert network (one-time setup)
|
137
|
+
openagents launch-network demos/openconvert/network_config.yaml
|
138
|
+
|
139
|
+
# Launch some conversion agents
|
140
|
+
python demos/openconvert/run_agent.py doc &
|
141
|
+
python demos/openconvert/run_agent.py image &
|
142
|
+
|
143
|
+
# Convert your first file!
|
144
|
+
openconvert -i document.txt -o document.pdf
|
145
|
+
```
|
146
|
+
|
147
|
+
That's it! 🎉
|
148
|
+
|
149
|
+
> ⚠️ **Current Status**: This is an early-stage project. Basic functionality works, but many advanced features are still in development.
|
150
|
+
|
151
|
+
---
|
152
|
+
|
153
|
+
## 📖 **Usage**
|
154
|
+
|
155
|
+
### **Basic Syntax**
|
156
|
+
|
157
|
+
```bash
|
158
|
+
openconvert -i INPUT -o OUTPUT [OPTIONS]
|
159
|
+
```
|
160
|
+
|
161
|
+
### **Real-World Examples**
|
162
|
+
|
163
|
+
<details>
|
164
|
+
<summary><b>📄 Document Conversions</b></summary>
|
165
|
+
|
166
|
+
```bash
|
167
|
+
# Text to PDF with custom styling
|
168
|
+
openconvert -i notes.txt -o notes.pdf --prompt "Use a professional layout with headers"
|
169
|
+
|
170
|
+
# Markdown to Word document
|
171
|
+
openconvert -i README.md -o README.docx
|
172
|
+
|
173
|
+
# CSV to formatted Excel with charts
|
174
|
+
openconvert -i sales.csv -o sales.xlsx --prompt "Add charts and formatting"
|
175
|
+
```
|
176
|
+
</details>
|
177
|
+
|
178
|
+
<details>
|
179
|
+
<summary><b>🖼️ Image Processing</b></summary>
|
180
|
+
|
181
|
+
```bash
|
182
|
+
# Convert and compress images
|
183
|
+
openconvert -i photos/ -o thumbnails/ --from image/jpeg --to image/webp --prompt "Resize to 800px width"
|
184
|
+
|
185
|
+
# Create PDF from images
|
186
|
+
openconvert -i scans/ -o document.pdf --from image/png --to application/pdf
|
187
|
+
|
188
|
+
# Batch image format conversion
|
189
|
+
openconvert -i raw_images/ -o processed/ --from image/tiff --to image/png
|
190
|
+
```
|
191
|
+
</details>
|
192
|
+
|
193
|
+
<details>
|
194
|
+
<summary><b>🎵 Media Files</b></summary>
|
195
|
+
|
196
|
+
```bash
|
197
|
+
# Audio format conversion
|
198
|
+
openconvert -i music.wav -o music.mp3 --prompt "High quality encoding"
|
199
|
+
|
200
|
+
# Video format conversion
|
201
|
+
openconvert -i video.avi -o video.mp4 --prompt "Optimize for web streaming"
|
202
|
+
|
203
|
+
# Extract audio from video
|
204
|
+
openconvert -i movie.mp4 -o soundtrack.mp3
|
205
|
+
```
|
206
|
+
</details>
|
207
|
+
|
208
|
+
<details>
|
209
|
+
<summary><b>🗂️ Archives & Data</b></summary>
|
210
|
+
|
211
|
+
```bash
|
212
|
+
# Create compressed archives
|
213
|
+
openconvert -i project/ -o project.zip
|
214
|
+
|
215
|
+
# Convert between archive formats
|
216
|
+
openconvert -i backup.rar -o backup.tar.gz
|
217
|
+
|
218
|
+
# JSON to other formats
|
219
|
+
openconvert -i data.json -o data.xlsx --prompt "Create tables with proper headers"
|
220
|
+
```
|
221
|
+
</details>
|
222
|
+
|
223
|
+
### **Command-Line Options**
|
224
|
+
|
225
|
+
| Option | Description | Example |
|
226
|
+
|--------|-------------|---------|
|
227
|
+
| `-i, --input` | Input file or directory | `-i documents/` |
|
228
|
+
| `-o, --output` | Output file or directory | `-o converted/` |
|
229
|
+
| `--from` | Source MIME type | `--from image/png` |
|
230
|
+
| `--to` | Target MIME type | `--to application/pdf` |
|
231
|
+
| `--prompt` | AI conversion instructions | `--prompt "Compress by 50%"` |
|
232
|
+
| `--host` | Network host | `--host remote.example.com` |
|
233
|
+
| `--port` | Network port | `--port 8765` |
|
234
|
+
| `-v, --verbose` | Detailed output | `-v` |
|
235
|
+
| `-q, --quiet` | Minimal output | `-q` |
|
236
|
+
| `--list-formats` | Discover available conversions | `--list-formats` |
|
237
|
+
|
238
|
+
---
|
239
|
+
|
240
|
+
## 🌐 **Supported Formats**
|
241
|
+
|
242
|
+
<div align="center">
|
243
|
+
|
244
|
+
| Category | Formats | Count |
|
245
|
+
|----------|---------|-------|
|
246
|
+
| **📄 Documents** | txt, pdf, docx, html, md, rtf, csv, xlsx, epub | 9+ |
|
247
|
+
| **🖼️ Images** | png, jpg, gif, bmp, tiff, svg, webp, ico | 8+ |
|
248
|
+
| **🎵 Audio** | mp3, wav, ogg, flac, aac, m4a | 6+ |
|
249
|
+
| **🎬 Video** | mp4, avi, mkv, mov, webm, gif | 6+ |
|
250
|
+
| **🗜️ Archives** | zip, rar, 7z, tar, gz, bz2 | 6+ |
|
251
|
+
| **💻 Code** | json, xml, yaml, html, css, js, py | 7+ |
|
252
|
+
| **🎯 3D Models** | stl, obj, fbx, ply, glb | 5+ |
|
253
|
+
|
254
|
+
**Total: 50+ formats supported!**
|
255
|
+
|
256
|
+
</div>
|
257
|
+
|
258
|
+
> 📈 **Growing Library**: New formats added regularly as agents join the network
|
259
|
+
|
260
|
+
---
|
261
|
+
|
262
|
+
## 🏗️ **Network Setup**
|
263
|
+
|
264
|
+
### **Quick Network Setup**
|
265
|
+
|
266
|
+
```bash
|
267
|
+
# 1. Clone the OpenAgents repository
|
268
|
+
git clone https://github.com/openagents/openagents.git
|
269
|
+
cd openagents
|
270
|
+
|
271
|
+
# 2. Start the network
|
272
|
+
openagents launch-network demos/openconvert/network_config.yaml
|
273
|
+
|
274
|
+
# 3. Launch conversion agents (in separate terminals)
|
275
|
+
python demos/openconvert/run_agent.py doc # Document conversions
|
276
|
+
python demos/openconvert/run_agent.py image # Image processing
|
277
|
+
python demos/openconvert/run_agent.py audio # Audio conversions
|
278
|
+
python demos/openconvert/run_agent.py video # Video processing
|
279
|
+
```
|
280
|
+
|
281
|
+
### **Production Deployment (Planned)**
|
282
|
+
|
283
|
+
> 🚧 **Coming Soon**: Docker and Kubernetes deployment configurations are being developed.
|
284
|
+
>
|
285
|
+
> Currently: Use the manual setup method above for development and testing.
|
286
|
+
|
287
|
+
---
|
288
|
+
|
289
|
+
## 🔧 **Advanced Usage**
|
290
|
+
|
291
|
+
### **Batch Processing Power**
|
292
|
+
|
293
|
+
```bash
|
294
|
+
# Convert all images in a folder structure
|
295
|
+
find ./photos -name "*.raw" -exec openconvert -i {} -o {}.jpg \;
|
296
|
+
|
297
|
+
# Parallel processing with xargs
|
298
|
+
ls *.txt | xargs -I {} -P 4 openconvert -i {} -o {}.pdf
|
299
|
+
|
300
|
+
# Directory-wide conversions
|
301
|
+
openconvert -i ./documents --from text/plain --to application/pdf --prompt "Professional formatting"
|
302
|
+
```
|
303
|
+
|
304
|
+
### **Python Integration**
|
305
|
+
|
306
|
+
```python
|
307
|
+
# Simple file conversion
|
308
|
+
from openconvert import convert_file
|
309
|
+
|
310
|
+
success = convert_file("document.txt", "document.pdf")
|
311
|
+
if success:
|
312
|
+
print("✅ Conversion successful!")
|
313
|
+
|
314
|
+
# Advanced batch conversion
|
315
|
+
from openconvert import convert
|
316
|
+
from pathlib import Path
|
317
|
+
|
318
|
+
success = convert(
|
319
|
+
input_files=[Path("file1.txt"), Path("file2.txt")],
|
320
|
+
output_path=Path("merged.pdf"),
|
321
|
+
from_format="text/plain",
|
322
|
+
to_format="application/pdf",
|
323
|
+
prompt="Merge into single document with table of contents"
|
324
|
+
)
|
325
|
+
|
326
|
+
# Advanced async usage (for custom integrations)
|
327
|
+
from openconvert.client import OpenConvertClient
|
328
|
+
|
329
|
+
async def custom_conversion():
|
330
|
+
client = OpenConvertClient()
|
331
|
+
await client.connect("my-network.com", 8765)
|
332
|
+
|
333
|
+
result = await client.convert_file(
|
334
|
+
input_file=Path("data.xlsx"),
|
335
|
+
output_file=Path("report.pdf"),
|
336
|
+
source_format="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
337
|
+
target_format="application/pdf",
|
338
|
+
prompt="Create executive summary with charts"
|
339
|
+
)
|
340
|
+
|
341
|
+
await client.disconnect()
|
342
|
+
return result
|
343
|
+
```
|
344
|
+
|
345
|
+
### **Configuration Files (Planned)**
|
346
|
+
|
347
|
+
> 🚧 **Coming Soon**: Configuration file support is planned for future releases.
|
348
|
+
|
349
|
+
---
|
350
|
+
|
351
|
+
## 🛠️ **Development**
|
352
|
+
|
353
|
+
### **Project Structure**
|
354
|
+
|
355
|
+
```
|
356
|
+
openconvert/
|
357
|
+
├── 📁 openconvert/ # Main package
|
358
|
+
│ ├── 🐍 __init__.py # Package init
|
359
|
+
│ ├── 🖥️ openconvert_cli.py # CLI interface
|
360
|
+
│ ├── 🌐 client.py # Network client
|
361
|
+
│ └── 📄 __main__.py # Module entry
|
362
|
+
├── 🧪 tests/ # Test suite
|
363
|
+
├── 📖 docs/ # Documentation
|
364
|
+
├── 🐳 docker/ # Docker configs
|
365
|
+
├── ⚙️ setup.py # Installation
|
366
|
+
└── 📋 README.md # This file
|
367
|
+
```
|
368
|
+
|
369
|
+
### **Contributing Workflow**
|
370
|
+
|
371
|
+
```bash
|
372
|
+
# 1. Fork & clone
|
373
|
+
git clone https://github.com/yourusername/openconvert.git
|
374
|
+
cd openconvert
|
375
|
+
|
376
|
+
# 2. Create feature branch
|
377
|
+
git checkout -b feature/amazing-feature
|
378
|
+
|
379
|
+
# 3. Set up development environment
|
380
|
+
pip install -e ".[dev]"
|
381
|
+
pre-commit install
|
382
|
+
|
383
|
+
# 4. Make changes & test
|
384
|
+
pytest tests/
|
385
|
+
black openconvert/
|
386
|
+
flake8 openconvert/
|
387
|
+
|
388
|
+
# 5. Submit PR
|
389
|
+
git push origin feature/amazing-feature
|
390
|
+
```
|
391
|
+
|
392
|
+
### **Running Tests**
|
393
|
+
|
394
|
+
```bash
|
395
|
+
# Unit tests
|
396
|
+
pytest tests/
|
397
|
+
|
398
|
+
# Integration tests (requires network)
|
399
|
+
pytest tests/integration/ --network
|
400
|
+
|
401
|
+
# Performance tests
|
402
|
+
pytest tests/performance/ --benchmark
|
403
|
+
|
404
|
+
# Coverage report
|
405
|
+
pytest --cov=openconvert --cov-report=html
|
406
|
+
```
|
407
|
+
|
408
|
+
---
|
409
|
+
|
410
|
+
## 🤝 **Contributing**
|
411
|
+
|
412
|
+
We ❤️ contributions! Here's how you can help:
|
413
|
+
|
414
|
+
### **🐛 Found a Bug?**
|
415
|
+
- [Open an issue](https://github.com/openagents/openconvert/issues/new?template=bug_report.md)
|
416
|
+
- Include reproduction steps
|
417
|
+
- Mention your OS and Python version
|
418
|
+
|
419
|
+
### **💡 Have an Idea?**
|
420
|
+
- [Start a discussion](https://github.com/openagents/openconvert/discussions)
|
421
|
+
- Propose new features or improvements
|
422
|
+
- Share your use cases
|
423
|
+
|
424
|
+
### **🛠️ Want to Code?**
|
425
|
+
- Check [good first issues](https://github.com/openagents/openconvert/labels/good%20first%20issue)
|
426
|
+
- Read our [contributing guide](CONTRIBUTING.md)
|
427
|
+
- Join our [developer Discord](https://discord.gg/openagents)
|
428
|
+
|
429
|
+
### **📝 Improve Documentation?**
|
430
|
+
- Fix typos or unclear sections
|
431
|
+
- Add examples and tutorials
|
432
|
+
- Translate to other languages
|
433
|
+
|
434
|
+
---
|
435
|
+
|
436
|
+
## 💬 **Community**
|
437
|
+
|
438
|
+
<div align="center">
|
439
|
+
|
440
|
+
[](https://discord.gg/openagents)
|
441
|
+
[](https://twitter.com/openagents)
|
442
|
+
[](https://github.com/openagents/openconvert/discussions)
|
443
|
+
|
444
|
+
</div>
|
445
|
+
|
446
|
+
- **💬 Chat**: [Discord Server](https://discord.gg/openagents)
|
447
|
+
- **🐦 Updates**: [@openagents](https://twitter.com/openagents)
|
448
|
+
- **💡 Discussions**: [GitHub Discussions](https://github.com/openagents/openconvert/discussions)
|
449
|
+
- **📧 Email**: hello@openagents.org
|
450
|
+
|
451
|
+
---
|
452
|
+
|
453
|
+
## 🗺️ **Roadmap**
|
454
|
+
|
455
|
+
### **🚀 Coming Soon**
|
456
|
+
|
457
|
+
- [ ] **Plugin System** - Custom conversion agents
|
458
|
+
- [ ] **Web Interface** - Browser-based UI
|
459
|
+
- [ ] **API Gateway** - REST API for integrations
|
460
|
+
- [ ] **Cloud Hosting** - Managed OpenConvert service
|
461
|
+
- [ ] **Mobile Apps** - iOS and Android clients
|
462
|
+
|
463
|
+
### **🎯 Long Term**
|
464
|
+
|
465
|
+
- [ ] **AI-Generated Agents** - Automatic agent creation
|
466
|
+
- [ ] **Blockchain Integration** - Decentralized agent rewards
|
467
|
+
- [ ] **Real-time Collaboration** - Multi-user conversion workflows
|
468
|
+
- [ ] **Format Prediction** - ML-powered format suggestions
|
469
|
+
|
470
|
+
---
|
471
|
+
|
472
|
+
## 🏆 **Acknowledgments**
|
473
|
+
|
474
|
+
Special thanks to:
|
475
|
+
|
476
|
+
- **OpenAgents Team** - For the amazing framework
|
477
|
+
- **Contributors** - Everyone who helps improve OpenConvert
|
478
|
+
- **Community** - Users who provide feedback and ideas
|
479
|
+
- **Dependencies** - All the great open source libraries we use
|
480
|
+
|
481
|
+
### **Built With**
|
482
|
+
|
483
|
+
- [OpenAgents](https://github.com/openagents/openagents) - Distributed agent framework
|
484
|
+
- [Click](https://click.palletsprojects.com/) - Command line interface
|
485
|
+
- [AsyncIO](https://docs.python.org/3/library/asyncio.html) - Asynchronous programming
|
486
|
+
- [Typer](https://typer.tiangolo.com/) - CLI framework
|
487
|
+
|
488
|
+
---
|
489
|
+
|
490
|
+
## 📄 **License**
|
491
|
+
|
492
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
493
|
+
|
494
|
+
---
|
495
|
+
|
496
|
+
<div align="center">
|
497
|
+
|
498
|
+
**[⭐ Star this repo](https://github.com/openagents/openconvert) if you found it helpful!**
|
499
|
+
|
500
|
+
Made with ❤️ by the OpenAgents community
|
501
|
+
|
502
|
+
*Transforming files, one conversion at a time* 🔄
|
503
|
+
|
504
|
+
</div>
|
@@ -0,0 +1,10 @@
|
|
1
|
+
openconvert/__init__.py,sha256=jGaXnKh8u4eq3Ycq5d6G--AwYfs5PSw-MJbI1cPLw1U,3253
|
2
|
+
openconvert/__main__.py,sha256=9bqNhW4-s5yWNZGkvnUy6UCb8eaZiQAFfgeuNghDdxg,263
|
3
|
+
openconvert/client.py,sha256=qqidLnLDwF-4f5-WPutrZkNV-CGzFfm4C741NbKOIcE,14954
|
4
|
+
openconvert/openconvert_cli.py,sha256=HvWUc76dvzuoXcMWMLnh8LEXrMcT4pJCqY5bLvXaGuc,18179
|
5
|
+
openconvert-1.0.0.dist-info/licenses/LICENSE,sha256=dHQW0DXhwJm5PhaWpJsZmcrC2OgU1sPDO66nVLmL8Ek,1072
|
6
|
+
openconvert-1.0.0.dist-info/METADATA,sha256=HySK5XSYrR3EzQKvG_oTV7_TQiE9Ckt7G7kuLSUjZsk,15307
|
7
|
+
openconvert-1.0.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
8
|
+
openconvert-1.0.0.dist-info/entry_points.txt,sha256=Jhi6MBetmmpMK_CpeEkzx44KFHPsuTBCZ0UzUrGZ5dM,65
|
9
|
+
openconvert-1.0.0.dist-info/top_level.txt,sha256=BQWm5PHwGlf1DRAcesIki9gKa0D27YCXJLeqj9DQ-es,12
|
10
|
+
openconvert-1.0.0.dist-info/RECORD,,
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 OpenAgents Team
|
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.
|
openconvert/cli.py
DELETED
@@ -1,145 +0,0 @@
|
|
1
|
-
"""
|
2
|
-
Command-line interface for AGConvert.
|
3
|
-
"""
|
4
|
-
|
5
|
-
import argparse
|
6
|
-
import json
|
7
|
-
import logging
|
8
|
-
import os
|
9
|
-
import sys
|
10
|
-
from pathlib import Path
|
11
|
-
from typing import Dict, Any, Optional
|
12
|
-
|
13
|
-
from . import __version__
|
14
|
-
from .converter import open_convert
|
15
|
-
|
16
|
-
# Configure logging
|
17
|
-
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
18
|
-
logger = logging.getLogger(__name__)
|
19
|
-
|
20
|
-
def parse_args() -> argparse.Namespace:
|
21
|
-
"""Parse command-line arguments."""
|
22
|
-
parser = argparse.ArgumentParser(
|
23
|
-
description="AGConvert - A versatile file and data conversion tool",
|
24
|
-
formatter_class=argparse.RawDescriptionHelpFormatter,
|
25
|
-
epilog="""
|
26
|
-
Examples:
|
27
|
-
agconvert image.png image.jpg # Convert PNG to JPG
|
28
|
-
agconvert document.docx document.pdf # Convert DOCX to PDF
|
29
|
-
agconvert audio.mp3 audio.wav # Convert MP3 to WAV
|
30
|
-
agconvert video.mp4 video.gif # Convert MP4 to GIF
|
31
|
-
agconvert data.json data.yaml # Convert JSON to YAML
|
32
|
-
agconvert --options '{"quality": 90}' image.png image.jpg # With options
|
33
|
-
"""
|
34
|
-
)
|
35
|
-
|
36
|
-
parser.add_argument(
|
37
|
-
"input_file",
|
38
|
-
help="Path to the input file"
|
39
|
-
)
|
40
|
-
|
41
|
-
parser.add_argument(
|
42
|
-
"output_file",
|
43
|
-
help="Path to the output file"
|
44
|
-
)
|
45
|
-
|
46
|
-
parser.add_argument(
|
47
|
-
"--source-format",
|
48
|
-
help="Source file format (if not specified, will be inferred from input file extension)"
|
49
|
-
)
|
50
|
-
|
51
|
-
parser.add_argument(
|
52
|
-
"--target-format",
|
53
|
-
help="Target file format (if not specified, will be inferred from output file extension)"
|
54
|
-
)
|
55
|
-
|
56
|
-
parser.add_argument(
|
57
|
-
"--options",
|
58
|
-
help="Additional conversion options as JSON string",
|
59
|
-
default="{}"
|
60
|
-
)
|
61
|
-
|
62
|
-
parser.add_argument(
|
63
|
-
"--verbose", "-v",
|
64
|
-
action="store_true",
|
65
|
-
help="Enable verbose output"
|
66
|
-
)
|
67
|
-
|
68
|
-
parser.add_argument(
|
69
|
-
"--version",
|
70
|
-
action="version",
|
71
|
-
version=f"AGConvert {__version__}"
|
72
|
-
)
|
73
|
-
|
74
|
-
return parser.parse_args()
|
75
|
-
|
76
|
-
def parse_options(options_str: str) -> Dict[str, Any]:
|
77
|
-
"""Parse options from JSON string."""
|
78
|
-
try:
|
79
|
-
return json.loads(options_str)
|
80
|
-
except json.JSONDecodeError as e:
|
81
|
-
logger.error(f"Error parsing options: {str(e)}")
|
82
|
-
logger.error("Options must be a valid JSON string")
|
83
|
-
sys.exit(1)
|
84
|
-
|
85
|
-
def infer_format(filepath: str) -> str:
|
86
|
-
"""Infer file format from file extension."""
|
87
|
-
ext = os.path.splitext(filepath)[1].lower().lstrip('.')
|
88
|
-
|
89
|
-
# Handle special cases
|
90
|
-
if ext == 'jpeg':
|
91
|
-
return 'jpg'
|
92
|
-
elif ext == 'tif':
|
93
|
-
return 'tiff'
|
94
|
-
elif ext == 'yml':
|
95
|
-
return 'yaml'
|
96
|
-
elif ext == 'htm':
|
97
|
-
return 'html'
|
98
|
-
elif ext == 'markdown':
|
99
|
-
return 'md'
|
100
|
-
elif ext == 'tex':
|
101
|
-
return 'latex'
|
102
|
-
|
103
|
-
return ext
|
104
|
-
|
105
|
-
def main() -> None:
|
106
|
-
"""Main entry point for the CLI."""
|
107
|
-
args = parse_args()
|
108
|
-
|
109
|
-
# Set logging level
|
110
|
-
if args.verbose:
|
111
|
-
logging.getLogger().setLevel(logging.DEBUG)
|
112
|
-
|
113
|
-
# Parse options
|
114
|
-
options = parse_options(args.options)
|
115
|
-
|
116
|
-
# Infer formats if not specified
|
117
|
-
source_format = args.source_format or infer_format(args.input_file)
|
118
|
-
target_format = args.target_format or infer_format(args.output_file)
|
119
|
-
|
120
|
-
if not source_format:
|
121
|
-
logger.error("Could not determine source format. Please specify --source-format")
|
122
|
-
sys.exit(1)
|
123
|
-
|
124
|
-
if not target_format:
|
125
|
-
logger.error("Could not determine target format. Please specify --target-format")
|
126
|
-
sys.exit(1)
|
127
|
-
|
128
|
-
try:
|
129
|
-
# Perform the conversion
|
130
|
-
output_path = open_convert(
|
131
|
-
filepath=args.input_file,
|
132
|
-
source_format=source_format,
|
133
|
-
target_format=target_format,
|
134
|
-
output_path=args.output_file,
|
135
|
-
options=options
|
136
|
-
)
|
137
|
-
|
138
|
-
logger.info(f"Conversion successful: {args.input_file} → {output_path}")
|
139
|
-
|
140
|
-
except Exception as e:
|
141
|
-
logger.error(f"Conversion failed: {str(e)}")
|
142
|
-
sys.exit(1)
|
143
|
-
|
144
|
-
if __name__ == "__main__":
|
145
|
-
main()
|