refactor(memobird): switch to uv with inline script dependencies
This commit is contained in:
parent
64137350b4
commit
2a6709d5bc
|
|
@ -9,36 +9,32 @@ Direct printing to the Memobird thermal printer on the local network.
|
||||||
|
|
||||||
## 📦 Installation
|
## 📦 Installation
|
||||||
|
|
||||||
This skill requires Python 3 and several libraries. Install them using:
|
This skill uses [uv](https://docs.astral.sh/uv/) for dependency management. No manual installation of Python packages is required as dependencies are declared inline within the script.
|
||||||
|
|
||||||
```bash
|
Ensure you have `uv` installed on your system.
|
||||||
pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
*Note: Depends on `requests` and `Pillow`.*
|
|
||||||
|
|
||||||
## 🚀 Usage
|
## 🚀 Usage
|
||||||
|
|
||||||
Use the `scripts/memobird_print.py` tool. By default, it targets the static IP `192.168.10.165`.
|
Use `uv run` to execute the script. `uv` will automatically create a temporary environment and install the required dependencies (`requests`, `Pillow`).
|
||||||
|
|
||||||
### 1. Print simple text
|
### 1. Print simple text
|
||||||
```bash
|
```bash
|
||||||
./scripts/memobird_print.py --text "Hello from Gemini!"
|
uv run skills/memobird/scripts/memobird_print.py --text "Hello from Gemini!"
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2. Print styled text
|
### 2. Print styled text
|
||||||
```bash
|
```bash
|
||||||
./scripts/memobird_print.py --text "IMPORTANT NOTE" --big --bold
|
uv run skills/memobird/scripts/memobird_print.py --text "IMPORTANT NOTE" --big --bold
|
||||||
```
|
```
|
||||||
|
|
||||||
### 3. Print an image
|
### 3. Print an image
|
||||||
```bash
|
```bash
|
||||||
./scripts/memobird_print.py --image "path/to/image.png"
|
uv run skills/memobird/scripts/memobird_print.py --image "path/to/image.png"
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4. Print a separator line
|
### 4. Print a separator line
|
||||||
```bash
|
```bash
|
||||||
./scripts/memobird_print.py --line THICK
|
uv run skills/memobird/scripts/memobird_print.py --line THICK
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🛠️ Options
|
## 🛠️ Options
|
||||||
|
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
requests
|
|
||||||
Pillow
|
|
||||||
|
|
@ -1,4 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
# /// script
|
||||||
|
# dependencies = [
|
||||||
|
# "requests",
|
||||||
|
# "pillow",
|
||||||
|
# ]
|
||||||
|
# ///
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
|
@ -6,22 +12,8 @@ import base64
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from random import randint
|
from random import randint
|
||||||
import argparse
|
import argparse
|
||||||
|
import requests
|
||||||
# Dependency Check
|
from PIL import Image as PILImg, ImageOps
|
||||||
MISSING_DEPS = []
|
|
||||||
try:
|
|
||||||
import requests
|
|
||||||
except ImportError:
|
|
||||||
MISSING_DEPS.append("requests")
|
|
||||||
try:
|
|
||||||
from PIL import Image as PILImg, ImageOps
|
|
||||||
except ImportError:
|
|
||||||
MISSING_DEPS.append("Pillow (PIL)")
|
|
||||||
|
|
||||||
if MISSING_DEPS:
|
|
||||||
print(f"Error: Missing dependencies: {', '.join(MISSING_DEPS)}")
|
|
||||||
print("Please install them using: pip install " + " ".join(["requests", "Pillow"]))
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# Default IP for Moritz's Memobird
|
# Default IP for Moritz's Memobird
|
||||||
DEFAULT_HOST = "192.168.10.165"
|
DEFAULT_HOST = "192.168.10.165"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue