globe-server 0.0.33__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.
- globe_server-0.0.33/LICENSE +21 -0
- globe_server-0.0.33/PKG-INFO +257 -0
- globe_server-0.0.33/README.md +210 -0
- globe_server-0.0.33/pyproject.toml +84 -0
- globe_server-0.0.33/setup.cfg +4 -0
- globe_server-0.0.33/src/globe_server/__init__.py +5 -0
- globe_server-0.0.33/src/globe_server/api/__init__.py +22 -0
- globe_server-0.0.33/src/globe_server/api/media.py +191 -0
- globe_server-0.0.33/src/globe_server/api/motor.py +44 -0
- globe_server-0.0.33/src/globe_server/api/network.py +73 -0
- globe_server-0.0.33/src/globe_server/api/playback.py +59 -0
- globe_server-0.0.33/src/globe_server/api/playlist.py +182 -0
- globe_server-0.0.33/src/globe_server/api/settings.py +67 -0
- globe_server-0.0.33/src/globe_server/api/status.py +62 -0
- globe_server-0.0.33/src/globe_server/api/update.py +254 -0
- globe_server-0.0.33/src/globe_server/api/version.py +39 -0
- globe_server-0.0.33/src/globe_server/api/websocket.py +169 -0
- globe_server-0.0.33/src/globe_server/config.py +83 -0
- globe_server-0.0.33/src/globe_server/db/__init__.py +5 -0
- globe_server-0.0.33/src/globe_server/db/broadcast_queue.py +106 -0
- globe_server-0.0.33/src/globe_server/db/database.py +214 -0
- globe_server-0.0.33/src/globe_server/db/db_events.py +75 -0
- globe_server-0.0.33/src/globe_server/db/events.py +115 -0
- globe_server-0.0.33/src/globe_server/db/orm.py +154 -0
- globe_server-0.0.33/src/globe_server/db/schemas.py +199 -0
- globe_server-0.0.33/src/globe_server/hardware/esp32_client.py +293 -0
- globe_server-0.0.33/src/globe_server/hardware/server_hardware.py +89 -0
- globe_server-0.0.33/src/globe_server/main.py +274 -0
- globe_server-0.0.33/src/globe_server/models/__init__.py +5 -0
- globe_server-0.0.33/src/globe_server/models/status.py +31 -0
- globe_server-0.0.33/src/globe_server/network_manager/mdns_manager.py +123 -0
- globe_server-0.0.33/src/globe_server/network_manager/models.py +61 -0
- globe_server-0.0.33/src/globe_server/network_manager/network_fsm.py +595 -0
- globe_server-0.0.33/src/globe_server/network_manager/network_service.py +75 -0
- globe_server-0.0.33/src/globe_server/network_manager/platform/__init__.py +51 -0
- globe_server-0.0.33/src/globe_server/network_manager/platform/base_network.py +52 -0
- globe_server-0.0.33/src/globe_server/network_manager/platform/linux_network.py +184 -0
- globe_server-0.0.33/src/globe_server/network_manager/platform/windows_network.py +288 -0
- globe_server-0.0.33/src/globe_server/playback/event_emitter.py +51 -0
- globe_server-0.0.33/src/globe_server/playback/media_player.py +138 -0
- globe_server-0.0.33/src/globe_server/playback/media_services/__init__.py +10 -0
- globe_server-0.0.33/src/globe_server/playback/media_services/earth_viz_service.py +182 -0
- globe_server-0.0.33/src/globe_server/playback/media_services/vlc_service.py +138 -0
- globe_server-0.0.33/src/globe_server/playback/playback_context.py +369 -0
- globe_server-0.0.33/src/globe_server/playback/playback_fsm.py +513 -0
- globe_server-0.0.33/src/globe_server/playback/playback_service.py +57 -0
- globe_server-0.0.33/src/globe_server/playback/playback_state.py +100 -0
- globe_server-0.0.33/src/globe_server/playback/playback_tracker.py +167 -0
- globe_server-0.0.33/src/globe_server/setup.py +170 -0
- globe_server-0.0.33/src/globe_server/static/index-2RLu-Oe0.js +73 -0
- globe_server-0.0.33/src/globe_server/static/index-DX6Xxgpy.css +1 -0
- globe_server-0.0.33/src/globe_server/static/index.html +14 -0
- globe_server-0.0.33/src/globe_server/static/vite.svg +1 -0
- globe_server-0.0.33/src/globe_server/tools/espota.py +325 -0
- globe_server-0.0.33/src/globe_server/utils/__init__.py +0 -0
- globe_server-0.0.33/src/globe_server/utils/eventbus.py +75 -0
- globe_server-0.0.33/src/globe_server/utils/files.py +193 -0
- globe_server-0.0.33/src/globe_server/utils/uart.py +39 -0
- globe_server-0.0.33/src/globe_server.egg-info/PKG-INFO +257 -0
- globe_server-0.0.33/src/globe_server.egg-info/SOURCES.txt +62 -0
- globe_server-0.0.33/src/globe_server.egg-info/dependency_links.txt +1 -0
- globe_server-0.0.33/src/globe_server.egg-info/entry_points.txt +3 -0
- globe_server-0.0.33/src/globe_server.egg-info/requires.txt +23 -0
- globe_server-0.0.33/src/globe_server.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Edward Catley
|
|
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,257 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: globe-server
|
|
3
|
+
Version: 0.0.33
|
|
4
|
+
Summary: Globe Server Backend - Webserver control of Globe
|
|
5
|
+
Author-email: Edward Catley <edward.catley@catleytech.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/edcatley/Globe-Software
|
|
8
|
+
Project-URL: Bug Reports, https://github.com/edcatley/Globe-Software/issues
|
|
9
|
+
Project-URL: Source, https://github.com/edcatley/Globe-Software
|
|
10
|
+
Keywords: globe,visualization,server,fastapi,interactive
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: fastapi>=0.112.0
|
|
25
|
+
Requires-Dist: uvicorn[standard]>=0.30.5
|
|
26
|
+
Requires-Dist: pydantic>=2.8.2
|
|
27
|
+
Requires-Dist: python-multipart>=0.0.9
|
|
28
|
+
Requires-Dist: psutil>=5.8.0
|
|
29
|
+
Requires-Dist: requests>=2.31.0
|
|
30
|
+
Requires-Dist: aiofiles>=23.2.1
|
|
31
|
+
Requires-Dist: aiosqlite>=0.19.0
|
|
32
|
+
Requires-Dist: pyserial>=3.5
|
|
33
|
+
Requires-Dist: python-vlc>=3.0.20000
|
|
34
|
+
Requires-Dist: websockets>=12.0
|
|
35
|
+
Requires-Dist: zeroconf>=0.39.4
|
|
36
|
+
Requires-Dist: aiohttp>=3.9.0
|
|
37
|
+
Requires-Dist: numpy>=1.26.0
|
|
38
|
+
Requires-Dist: sqlalchemy>=2.0.0
|
|
39
|
+
Requires-Dist: earth-viz
|
|
40
|
+
Provides-Extra: dev
|
|
41
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
43
|
+
Requires-Dist: black>=22.0; extra == "dev"
|
|
44
|
+
Requires-Dist: flake8>=5.0; extra == "dev"
|
|
45
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
|
|
48
|
+
# Globe Software
|
|
49
|
+
|
|
50
|
+
Complete interactive globe visualization system with hardware control, media playback, and web interface.
|
|
51
|
+
|
|
52
|
+
## Overview
|
|
53
|
+
|
|
54
|
+
Globe Software is a complete system for controlling and visualizing content on a physical rotating globe display. This package includes both the FastAPI backend server and the React web interface as static files.
|
|
55
|
+
|
|
56
|
+
WARNING: This package is designed to be used on the Globe platform hardware - use on other systems may result in unexpected behaviour like forced network disconnects.
|
|
57
|
+
|
|
58
|
+
## Features
|
|
59
|
+
|
|
60
|
+
- **Web Interface**: React-based UI for controlling the globe (served as static files)
|
|
61
|
+
- **FastAPI Backend**: High-performance async web server with REST API
|
|
62
|
+
- **Globe Visualization**: Real-time 3D globe rendering with earth-viz
|
|
63
|
+
- **Media Management**: Upload and manage video/image content with playlist support
|
|
64
|
+
- **Hardware Control**: Interface with ESP32 (motor) and FPGA (display) hardware
|
|
65
|
+
- **Network Management**: WiFi configuration, network switching, and access point mode
|
|
66
|
+
- **Automatic Updates**: Online (PyPI) and offline (.whl) update support
|
|
67
|
+
- **Real-time Communication**: WebSocket support for live status updates
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
70
|
+
|
|
71
|
+
### Quick Install
|
|
72
|
+
```bash
|
|
73
|
+
pip install globe-server
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Initial Setup
|
|
77
|
+
After installation, run the setup wizard to configure the system:
|
|
78
|
+
```bash
|
|
79
|
+
globe-server-setup
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This will:
|
|
83
|
+
- Create the `~/.globe-server/` directory structure
|
|
84
|
+
- Download required static images for visualization
|
|
85
|
+
- Prompt for configuration (ESP32 API key, WiFi credentials, etc.)
|
|
86
|
+
|
|
87
|
+
### Production Deployment (Raspberry Pi)
|
|
88
|
+
|
|
89
|
+
For production deployment on Raspberry Pi, see the [installation guide](https://github.com/edcatley/Globe-Software/blob/main/INSTALL.md) which covers:
|
|
90
|
+
- Creating the installation directory and virtual environment
|
|
91
|
+
- Installing as a systemd service
|
|
92
|
+
- Automatic startup and update management
|
|
93
|
+
|
|
94
|
+
## Usage
|
|
95
|
+
|
|
96
|
+
### Starting the Server
|
|
97
|
+
```bash
|
|
98
|
+
# Start the server
|
|
99
|
+
globe-server
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The server will start on `http://localhost:8000` and serve:
|
|
103
|
+
- Web interface at `http://localhost:8000/`
|
|
104
|
+
- API documentation at `http://localhost:8000/docs`
|
|
105
|
+
- Alternative API docs at `http://localhost:8000/redoc`
|
|
106
|
+
|
|
107
|
+
### Accessing the Web Interface
|
|
108
|
+
|
|
109
|
+
Once the server is running, open your browser to:
|
|
110
|
+
- `http://localhost:8000` (local access)
|
|
111
|
+
- `http://<raspberry-pi-ip>:8000` (remote access)
|
|
112
|
+
|
|
113
|
+
The web interface provides:
|
|
114
|
+
- Media upload and playlist management
|
|
115
|
+
- Globe visualization controls
|
|
116
|
+
- Motor speed and rotation control
|
|
117
|
+
- Network and WiFi configuration
|
|
118
|
+
- System settings and firmware updates
|
|
119
|
+
|
|
120
|
+
### Command Line Options
|
|
121
|
+
```bash
|
|
122
|
+
# Start with default settings
|
|
123
|
+
globe-server
|
|
124
|
+
|
|
125
|
+
# Or use uvicorn directly for custom configuration
|
|
126
|
+
uvicorn globe_server.main:app --host 0.0.0.0 --port 8000 --reload
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Configuration
|
|
130
|
+
|
|
131
|
+
The server stores configuration and data in `~/.globe-server/`:
|
|
132
|
+
|
|
133
|
+
- `.env` - Environment variables (API keys, WiFi credentials)
|
|
134
|
+
- `globe.db` - SQLite database
|
|
135
|
+
- `media/` - Uploaded media files
|
|
136
|
+
- `updates/` - Software update packages (.whl files)
|
|
137
|
+
- `logs/` - Application logs
|
|
138
|
+
|
|
139
|
+
Key configuration settings (from `globe_server.config`):
|
|
140
|
+
- `GLOBE_DATA_DIR`: `~/.globe-server` (base directory)
|
|
141
|
+
- `GLOBE_MEDIA_DIRECTORY`: Media storage location
|
|
142
|
+
- `UPDATE_DIRECTORY`: Software update packages
|
|
143
|
+
- `MOTOR_RPM`: Default motor rotation speed
|
|
144
|
+
- `ESP32_API_KEY`: Authentication for ESP32 communication
|
|
145
|
+
|
|
146
|
+
## System Architecture
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
┌─────────────────┐
|
|
150
|
+
│ Web Interface │ (React - served as static files)
|
|
151
|
+
│ Port 8000 │
|
|
152
|
+
└────────┬────────┘
|
|
153
|
+
│ HTTP/WebSocket
|
|
154
|
+
┌────────▼────────┐
|
|
155
|
+
│ FastAPI Server │ (Python)
|
|
156
|
+
│ Port 8000 │
|
|
157
|
+
└────┬───────┬────┘
|
|
158
|
+
│ │
|
|
159
|
+
│ └──────────┐
|
|
160
|
+
┌────▼────┐ ┌──────▼──────┐
|
|
161
|
+
│ ESP32 │ │ FPGA │
|
|
162
|
+
│ (Motor) │ │ (Display) │
|
|
163
|
+
└─────────┘ └─────────────┘
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## API Endpoints
|
|
167
|
+
|
|
168
|
+
The REST API provides programmatic access to all features:
|
|
169
|
+
|
|
170
|
+
- `/` - Web interface (static files)
|
|
171
|
+
- `/media/*` - Media file management and playback
|
|
172
|
+
- `/playlist/*` - Playlist operations
|
|
173
|
+
- `/motor/*` - Motor control (ESP32)
|
|
174
|
+
- `/status/*` - Server status and WebSocket updates
|
|
175
|
+
- `/settings/*` - Server configuration
|
|
176
|
+
- `/update/*` - Software and firmware updates (server, ESP32, FPGA)
|
|
177
|
+
- `/network/*` - Network and WiFi management
|
|
178
|
+
- `/earth-viz/*` - Globe visualization rendering
|
|
179
|
+
|
|
180
|
+
Full interactive API documentation available at `/docs` when server is running.
|
|
181
|
+
|
|
182
|
+
## Software Updates
|
|
183
|
+
|
|
184
|
+
Globe Software supports both online and offline updates:
|
|
185
|
+
|
|
186
|
+
### Online Updates (PyPI)
|
|
187
|
+
When connected to the internet, the system automatically checks for updates on startup (when using the systemd service).
|
|
188
|
+
|
|
189
|
+
### Offline Updates
|
|
190
|
+
For systems without internet access:
|
|
191
|
+
1. Download the update bundle (`.whl` files for the package and all dependencies)
|
|
192
|
+
2. Copy all `.whl` files to `~/.globe-server/updates/`
|
|
193
|
+
3. Restart the server
|
|
194
|
+
|
|
195
|
+
The startup script will automatically install from local files if PyPI is unavailable.
|
|
196
|
+
|
|
197
|
+
## Development
|
|
198
|
+
|
|
199
|
+
### From Source
|
|
200
|
+
```bash
|
|
201
|
+
git clone https://github.com/edcatley/Globe-Software.git
|
|
202
|
+
cd Globe-Software/backend
|
|
203
|
+
pip install -e .[dev]
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Running Tests
|
|
207
|
+
```bash
|
|
208
|
+
pytest
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Code Quality
|
|
212
|
+
```bash
|
|
213
|
+
# Format code
|
|
214
|
+
black src/
|
|
215
|
+
|
|
216
|
+
# Type checking
|
|
217
|
+
mypy src/
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Links
|
|
221
|
+
|
|
222
|
+
- **GitHub Repository**: https://github.com/edcatley/Globe-Software
|
|
223
|
+
- **Issue Tracker**: https://github.com/edcatley/Globe-Software/issues
|
|
224
|
+
- **Installation Guide**: https://github.com/edcatley/Globe-Software/blob/main/INSTALL.md
|
|
225
|
+
|
|
226
|
+
## Requirements
|
|
227
|
+
|
|
228
|
+
### Software
|
|
229
|
+
- Python 3.8 or higher
|
|
230
|
+
- VLC media player (for video/image playback)
|
|
231
|
+
|
|
232
|
+
### Hardware (Optional)
|
|
233
|
+
- Raspberry Pi (tested on Bookworm)
|
|
234
|
+
- ESP32 microcontroller (for motor control)
|
|
235
|
+
- FPGA (for display control)
|
|
236
|
+
|
|
237
|
+
The system can run without hardware for development and testing.
|
|
238
|
+
|
|
239
|
+
### Python Dependencies
|
|
240
|
+
All Python dependencies are automatically installed:
|
|
241
|
+
- FastAPI & Uvicorn (web server)
|
|
242
|
+
- SQLite (database)
|
|
243
|
+
- VLC Python bindings (media playback)
|
|
244
|
+
- PyQt5 & PyQtWebEngine (visualization windows)
|
|
245
|
+
- earth-viz (globe rendering)
|
|
246
|
+
- pyserial (UART communication)
|
|
247
|
+
- zeroconf (network discovery)
|
|
248
|
+
|
|
249
|
+
See the [pyproject.toml](https://github.com/edcatley/Globe-Software/blob/main/backend/pyproject.toml) for the complete dependency list.
|
|
250
|
+
|
|
251
|
+
## Author
|
|
252
|
+
|
|
253
|
+
Edward Catley (edward.catley@catleytech.com)
|
|
254
|
+
|
|
255
|
+
## License
|
|
256
|
+
|
|
257
|
+
MIT License - see [LICENSE](https://github.com/edcatley/Globe-Software/blob/main/backend/LICENSE) for details
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# Globe Software
|
|
2
|
+
|
|
3
|
+
Complete interactive globe visualization system with hardware control, media playback, and web interface.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
Globe Software is a complete system for controlling and visualizing content on a physical rotating globe display. This package includes both the FastAPI backend server and the React web interface as static files.
|
|
8
|
+
|
|
9
|
+
WARNING: This package is designed to be used on the Globe platform hardware - use on other systems may result in unexpected behaviour like forced network disconnects.
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **Web Interface**: React-based UI for controlling the globe (served as static files)
|
|
14
|
+
- **FastAPI Backend**: High-performance async web server with REST API
|
|
15
|
+
- **Globe Visualization**: Real-time 3D globe rendering with earth-viz
|
|
16
|
+
- **Media Management**: Upload and manage video/image content with playlist support
|
|
17
|
+
- **Hardware Control**: Interface with ESP32 (motor) and FPGA (display) hardware
|
|
18
|
+
- **Network Management**: WiFi configuration, network switching, and access point mode
|
|
19
|
+
- **Automatic Updates**: Online (PyPI) and offline (.whl) update support
|
|
20
|
+
- **Real-time Communication**: WebSocket support for live status updates
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
### Quick Install
|
|
25
|
+
```bash
|
|
26
|
+
pip install globe-server
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Initial Setup
|
|
30
|
+
After installation, run the setup wizard to configure the system:
|
|
31
|
+
```bash
|
|
32
|
+
globe-server-setup
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This will:
|
|
36
|
+
- Create the `~/.globe-server/` directory structure
|
|
37
|
+
- Download required static images for visualization
|
|
38
|
+
- Prompt for configuration (ESP32 API key, WiFi credentials, etc.)
|
|
39
|
+
|
|
40
|
+
### Production Deployment (Raspberry Pi)
|
|
41
|
+
|
|
42
|
+
For production deployment on Raspberry Pi, see the [installation guide](https://github.com/edcatley/Globe-Software/blob/main/INSTALL.md) which covers:
|
|
43
|
+
- Creating the installation directory and virtual environment
|
|
44
|
+
- Installing as a systemd service
|
|
45
|
+
- Automatic startup and update management
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
### Starting the Server
|
|
50
|
+
```bash
|
|
51
|
+
# Start the server
|
|
52
|
+
globe-server
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The server will start on `http://localhost:8000` and serve:
|
|
56
|
+
- Web interface at `http://localhost:8000/`
|
|
57
|
+
- API documentation at `http://localhost:8000/docs`
|
|
58
|
+
- Alternative API docs at `http://localhost:8000/redoc`
|
|
59
|
+
|
|
60
|
+
### Accessing the Web Interface
|
|
61
|
+
|
|
62
|
+
Once the server is running, open your browser to:
|
|
63
|
+
- `http://localhost:8000` (local access)
|
|
64
|
+
- `http://<raspberry-pi-ip>:8000` (remote access)
|
|
65
|
+
|
|
66
|
+
The web interface provides:
|
|
67
|
+
- Media upload and playlist management
|
|
68
|
+
- Globe visualization controls
|
|
69
|
+
- Motor speed and rotation control
|
|
70
|
+
- Network and WiFi configuration
|
|
71
|
+
- System settings and firmware updates
|
|
72
|
+
|
|
73
|
+
### Command Line Options
|
|
74
|
+
```bash
|
|
75
|
+
# Start with default settings
|
|
76
|
+
globe-server
|
|
77
|
+
|
|
78
|
+
# Or use uvicorn directly for custom configuration
|
|
79
|
+
uvicorn globe_server.main:app --host 0.0.0.0 --port 8000 --reload
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Configuration
|
|
83
|
+
|
|
84
|
+
The server stores configuration and data in `~/.globe-server/`:
|
|
85
|
+
|
|
86
|
+
- `.env` - Environment variables (API keys, WiFi credentials)
|
|
87
|
+
- `globe.db` - SQLite database
|
|
88
|
+
- `media/` - Uploaded media files
|
|
89
|
+
- `updates/` - Software update packages (.whl files)
|
|
90
|
+
- `logs/` - Application logs
|
|
91
|
+
|
|
92
|
+
Key configuration settings (from `globe_server.config`):
|
|
93
|
+
- `GLOBE_DATA_DIR`: `~/.globe-server` (base directory)
|
|
94
|
+
- `GLOBE_MEDIA_DIRECTORY`: Media storage location
|
|
95
|
+
- `UPDATE_DIRECTORY`: Software update packages
|
|
96
|
+
- `MOTOR_RPM`: Default motor rotation speed
|
|
97
|
+
- `ESP32_API_KEY`: Authentication for ESP32 communication
|
|
98
|
+
|
|
99
|
+
## System Architecture
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
┌─────────────────┐
|
|
103
|
+
│ Web Interface │ (React - served as static files)
|
|
104
|
+
│ Port 8000 │
|
|
105
|
+
└────────┬────────┘
|
|
106
|
+
│ HTTP/WebSocket
|
|
107
|
+
┌────────▼────────┐
|
|
108
|
+
│ FastAPI Server │ (Python)
|
|
109
|
+
│ Port 8000 │
|
|
110
|
+
└────┬───────┬────┘
|
|
111
|
+
│ │
|
|
112
|
+
│ └──────────┐
|
|
113
|
+
┌────▼────┐ ┌──────▼──────┐
|
|
114
|
+
│ ESP32 │ │ FPGA │
|
|
115
|
+
│ (Motor) │ │ (Display) │
|
|
116
|
+
└─────────┘ └─────────────┘
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## API Endpoints
|
|
120
|
+
|
|
121
|
+
The REST API provides programmatic access to all features:
|
|
122
|
+
|
|
123
|
+
- `/` - Web interface (static files)
|
|
124
|
+
- `/media/*` - Media file management and playback
|
|
125
|
+
- `/playlist/*` - Playlist operations
|
|
126
|
+
- `/motor/*` - Motor control (ESP32)
|
|
127
|
+
- `/status/*` - Server status and WebSocket updates
|
|
128
|
+
- `/settings/*` - Server configuration
|
|
129
|
+
- `/update/*` - Software and firmware updates (server, ESP32, FPGA)
|
|
130
|
+
- `/network/*` - Network and WiFi management
|
|
131
|
+
- `/earth-viz/*` - Globe visualization rendering
|
|
132
|
+
|
|
133
|
+
Full interactive API documentation available at `/docs` when server is running.
|
|
134
|
+
|
|
135
|
+
## Software Updates
|
|
136
|
+
|
|
137
|
+
Globe Software supports both online and offline updates:
|
|
138
|
+
|
|
139
|
+
### Online Updates (PyPI)
|
|
140
|
+
When connected to the internet, the system automatically checks for updates on startup (when using the systemd service).
|
|
141
|
+
|
|
142
|
+
### Offline Updates
|
|
143
|
+
For systems without internet access:
|
|
144
|
+
1. Download the update bundle (`.whl` files for the package and all dependencies)
|
|
145
|
+
2. Copy all `.whl` files to `~/.globe-server/updates/`
|
|
146
|
+
3. Restart the server
|
|
147
|
+
|
|
148
|
+
The startup script will automatically install from local files if PyPI is unavailable.
|
|
149
|
+
|
|
150
|
+
## Development
|
|
151
|
+
|
|
152
|
+
### From Source
|
|
153
|
+
```bash
|
|
154
|
+
git clone https://github.com/edcatley/Globe-Software.git
|
|
155
|
+
cd Globe-Software/backend
|
|
156
|
+
pip install -e .[dev]
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Running Tests
|
|
160
|
+
```bash
|
|
161
|
+
pytest
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Code Quality
|
|
165
|
+
```bash
|
|
166
|
+
# Format code
|
|
167
|
+
black src/
|
|
168
|
+
|
|
169
|
+
# Type checking
|
|
170
|
+
mypy src/
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
## Links
|
|
174
|
+
|
|
175
|
+
- **GitHub Repository**: https://github.com/edcatley/Globe-Software
|
|
176
|
+
- **Issue Tracker**: https://github.com/edcatley/Globe-Software/issues
|
|
177
|
+
- **Installation Guide**: https://github.com/edcatley/Globe-Software/blob/main/INSTALL.md
|
|
178
|
+
|
|
179
|
+
## Requirements
|
|
180
|
+
|
|
181
|
+
### Software
|
|
182
|
+
- Python 3.8 or higher
|
|
183
|
+
- VLC media player (for video/image playback)
|
|
184
|
+
|
|
185
|
+
### Hardware (Optional)
|
|
186
|
+
- Raspberry Pi (tested on Bookworm)
|
|
187
|
+
- ESP32 microcontroller (for motor control)
|
|
188
|
+
- FPGA (for display control)
|
|
189
|
+
|
|
190
|
+
The system can run without hardware for development and testing.
|
|
191
|
+
|
|
192
|
+
### Python Dependencies
|
|
193
|
+
All Python dependencies are automatically installed:
|
|
194
|
+
- FastAPI & Uvicorn (web server)
|
|
195
|
+
- SQLite (database)
|
|
196
|
+
- VLC Python bindings (media playback)
|
|
197
|
+
- PyQt5 & PyQtWebEngine (visualization windows)
|
|
198
|
+
- earth-viz (globe rendering)
|
|
199
|
+
- pyserial (UART communication)
|
|
200
|
+
- zeroconf (network discovery)
|
|
201
|
+
|
|
202
|
+
See the [pyproject.toml](https://github.com/edcatley/Globe-Software/blob/main/backend/pyproject.toml) for the complete dependency list.
|
|
203
|
+
|
|
204
|
+
## Author
|
|
205
|
+
|
|
206
|
+
Edward Catley (edward.catley@catleytech.com)
|
|
207
|
+
|
|
208
|
+
## License
|
|
209
|
+
|
|
210
|
+
MIT License - see [LICENSE](https://github.com/edcatley/Globe-Software/blob/main/backend/LICENSE) for details
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "globe-server"
|
|
7
|
+
version = "0.0.33"
|
|
8
|
+
authors = [
|
|
9
|
+
{name = "Edward Catley", email = "edward.catley@catleytech.com"},
|
|
10
|
+
]
|
|
11
|
+
description = "Globe Server Backend - Webserver control of Globe"
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
license = "MIT"
|
|
14
|
+
requires-python = ">=3.8"
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 3 - Alpha",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.8",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Topic :: Multimedia :: Graphics :: 3D Modeling",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Visualization",
|
|
26
|
+
]
|
|
27
|
+
keywords = ["globe", "visualization", "server", "fastapi", "interactive"]
|
|
28
|
+
|
|
29
|
+
dependencies = [
|
|
30
|
+
"fastapi>=0.112.0",
|
|
31
|
+
"uvicorn[standard]>=0.30.5",
|
|
32
|
+
"pydantic>=2.8.2",
|
|
33
|
+
"python-multipart>=0.0.9",
|
|
34
|
+
"psutil>=5.8.0",
|
|
35
|
+
"requests>=2.31.0",
|
|
36
|
+
"aiofiles>=23.2.1",
|
|
37
|
+
"aiosqlite>=0.19.0",
|
|
38
|
+
"pyserial>=3.5",
|
|
39
|
+
"python-vlc>=3.0.20000",
|
|
40
|
+
"websockets>=12.0",
|
|
41
|
+
"zeroconf>=0.39.4",
|
|
42
|
+
"aiohttp>=3.9.0",
|
|
43
|
+
"numpy>=1.26.0",
|
|
44
|
+
"sqlalchemy>=2.0.0",
|
|
45
|
+
"earth-viz",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[project.optional-dependencies]
|
|
49
|
+
dev = [
|
|
50
|
+
"pytest>=7.0",
|
|
51
|
+
"pytest-asyncio>=0.21.0",
|
|
52
|
+
"black>=22.0",
|
|
53
|
+
"flake8>=5.0",
|
|
54
|
+
"mypy>=1.0",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
[project.scripts]
|
|
58
|
+
globe-server = "globe_server.main:main"
|
|
59
|
+
globe-server-setup = "globe_server.setup:main"
|
|
60
|
+
|
|
61
|
+
[project.urls]
|
|
62
|
+
Homepage = "https://github.com/edcatley/Globe-Software"
|
|
63
|
+
"Bug Reports" = "https://github.com/edcatley/Globe-Software/issues"
|
|
64
|
+
"Source" = "https://github.com/edcatley/Globe-Software"
|
|
65
|
+
|
|
66
|
+
[tool.setuptools.packages.find]
|
|
67
|
+
where = ["src"]
|
|
68
|
+
|
|
69
|
+
[tool.setuptools.package-data]
|
|
70
|
+
globe_server = [
|
|
71
|
+
"planet_vis/resources/maps/*.jpg",
|
|
72
|
+
"planet_vis/resources/maps/*.png",
|
|
73
|
+
"static/**/*",
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
[tool.black]
|
|
77
|
+
line-length = 88
|
|
78
|
+
target-version = ['py38']
|
|
79
|
+
|
|
80
|
+
[tool.mypy]
|
|
81
|
+
python_version = "3.8"
|
|
82
|
+
warn_return_any = true
|
|
83
|
+
warn_unused_configs = true
|
|
84
|
+
disallow_untyped_defs = true
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from fastapi import APIRouter
|
|
2
|
+
from .status import router as status_router
|
|
3
|
+
from .media import router as media_router
|
|
4
|
+
from .motor import router as motor_router
|
|
5
|
+
from .playlist import router as playlist_router
|
|
6
|
+
from .playback import router as playback_router
|
|
7
|
+
from .update import router as update_router
|
|
8
|
+
from .settings import router as settings_router
|
|
9
|
+
from .version import router as version_router
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
api_router = APIRouter()
|
|
13
|
+
|
|
14
|
+
api_router.include_router(status_router)
|
|
15
|
+
api_router.include_router(media_router)
|
|
16
|
+
api_router.include_router(motor_router)
|
|
17
|
+
api_router.include_router(playlist_router)
|
|
18
|
+
api_router.include_router(playback_router)
|
|
19
|
+
api_router.include_router(update_router)
|
|
20
|
+
api_router.include_router(settings_router)
|
|
21
|
+
api_router.include_router(version_router)
|
|
22
|
+
|