Metadata-Version: 2.4
Name: osp-tools
Version: 0.2.1
Summary: OpenSwim Pro Tools - Manage and download songs for your OpenSwim Pro / 2
Author-email: Ege Türker <egeturker34@icloud.com>
License: MIT License
        
        Copyright (c) 2026 Ege Türker
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/1etu/osp-tools
Project-URL: Repository, https://github.com/1etu/osp-tools
Project-URL: Issues, https://github.com/1etu/osp-tools/issues
Keywords: openswim,mp3,swimming,music,download
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Sound/Audio
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.0
Requires-Dist: yt-dlp>=2024.0
Requires-Dist: rich>=13.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: ruff>=0.1; extra == "dev"
Dynamic: license-file

# osp-tools

[![python](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![license](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)
[![platform](https://img.shields.io/badge/platform-macos%20|%20linux%20|%20windows-lightgrey.svg)]()

python tools for managing openswim mp3 players.

## cli overview
<img width="501" height="359" alt="image" src="https://github.com/user-attachments/assets/67efff33-6890-462b-8564-b0b2f8e0bf7f" />


## features

- **device detection**: automatically finds openswim device path on macos, linux, and windows.
- **youtube**: downloads audio via yt-dlp wrapper. supports videos, playlists, shorts.
- **spotify**: scrapes track metadata without api keys. supports tracks, albums, playlists, artist top tracks.
- **bulk**: threaded processing for multiple queries.

## installation

### pip (recommended)

```sh
pip install osp-tools
```

### manual build

```sh
git clone https://github.com/1etu/osp-tools.git
cd osp-tools
pip install build
python -m build
pip install dist/osp_tools-*.whl
```

### development

```sh
git clone https://github.com/1etu/osp-tools.git
cd osp-tools
pip install -e ".[dev]"
```

## usage

```sh
osp --help
```

### device management

```sh
osp device              # show device info, storage usage
osp ls                  # list tracks on device
```

### youtube download

```sh
osp dl "https://youtube.com/watch?v=..."             # download single video
osp dl "https://youtube.com/playlist?list=..."       # download entire playlist
osp dl dQw4w9WgXcQ                                   # download by video id
osp dl "..." --device                                # download directly to openswim
osp dl "..." -f m4a                                  # download as m4a (more efficient)
osp dl "..." -f mp3 -q 320                          # 320kbps mp3
osp dl "..." -f flac                                 # lossless audio (flac)
osp dl "..." -o ./music                              # custom output directory
```

### youtube search

```sh
osp search "song name"                # search youtube, get video ids
osp search "artist - track" -n 10     # limit results
```

### spotify (no api keys)

```sh
osp spotify "https://open.spotify.com/track/..."     # single track
osp spotify "https://open.spotify.com/album/..."     # full album
osp spotify "https://open.spotify.com/playlist/..."  # playlist
osp spotify "https://open.spotify.com/artist/..."    # artist top tracks
osp spotify "..." --info                             # show track list only
osp spotify "..." --device                           # download to openswim
osp spotify "..." -f m4a                             # download as m4a
osp spotify "..." -f mp3 -q 320                      # 320kbps mp3
osp spotify "..." -w 8                               # 8 parallel downloads
osp spotify "..." --fast                             # skip transcoding (~2x speed)
osp spotify "..." -f m4a --fast                      # m4a + fast mode (fastest)
```

### sync local files

```sh
osp sync ./downloads              # sync folder to device (skip existing)
osp sync ./downloads --all        # overwrite all
```

### format support

supported formats: `mp3`, `m4a`, `aac`, `flac`, `opus`, `wav`, `ogg`

format quality ranges (auto-adjusted):
- `mp3`: 128-320kbps (default: 192)
- `m4a/aac`: 96-256kbps (default: 160, more efficient)
- `opus`: 96-320kbps (default: 160)
- `ogg`: 128-320kbps (default: 192)
- `flac/wav`: lossless (quality ignored)

## dependencies

- python 3.9+
- yt-dlp
- ffmpeg (for audio conversion)

## structure

- `osp/core`: device discovery and mount point logic.
- `osp/download`: youtube/spotify scrapers and downloaders.

## license

MIT
