ttyplayer 0.3.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.
- ttyplayer/__init__.py +2 -0
- ttyplayer/cli.py +343 -0
- ttyplayer/control.py +244 -0
- ttyplayer/favorites.py +90 -0
- ttyplayer/history.py +64 -0
- ttyplayer/models.py +13 -0
- ttyplayer/player.py +652 -0
- ttyplayer/tui.py +618 -0
- ttyplayer/tui.tcss +125 -0
- ttyplayer/utils.py +80 -0
- ttyplayer/youtube.py +57 -0
- ttyplayer-0.3.0.dist-info/METADATA +222 -0
- ttyplayer-0.3.0.dist-info/RECORD +16 -0
- ttyplayer-0.3.0.dist-info/WHEEL +4 -0
- ttyplayer-0.3.0.dist-info/entry_points.txt +3 -0
- ttyplayer-0.3.0.dist-info/licenses/LICENSE +21 -0
ttyplayer/tui.tcss
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/* ttyplayer tui — layout per docs/tui-design.md. Theme variables only, so every theme fits. */
|
|
2
|
+
|
|
3
|
+
#search-row {
|
|
4
|
+
height: 3;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
#search-row SearchBox {
|
|
8
|
+
width: 1fr;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#search-row LoadingIndicator {
|
|
12
|
+
width: 6;
|
|
13
|
+
height: 3;
|
|
14
|
+
color: $accent;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
TabbedContent {
|
|
18
|
+
height: 1fr;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
ResultsTable {
|
|
22
|
+
height: 1fr;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
NowPlaying {
|
|
26
|
+
height: 5;
|
|
27
|
+
border: round $primary;
|
|
28
|
+
border-title-color: $accent;
|
|
29
|
+
background: $surface;
|
|
30
|
+
padding: 0 1;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
NowPlaying #np-idle {
|
|
34
|
+
display: none;
|
|
35
|
+
text-style: dim;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
NowPlaying.-idle #np-idle {
|
|
39
|
+
display: block;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
NowPlaying.-idle .np-line {
|
|
43
|
+
display: none;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.np-line {
|
|
47
|
+
height: 1;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#np-state {
|
|
51
|
+
width: 3;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
#np-title {
|
|
55
|
+
width: auto;
|
|
56
|
+
max-width: 70%;
|
|
57
|
+
text-wrap: nowrap;
|
|
58
|
+
text-overflow: ellipsis;
|
|
59
|
+
text-style: bold;
|
|
60
|
+
color: $accent;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
#np-uploader {
|
|
64
|
+
width: 1fr;
|
|
65
|
+
text-wrap: nowrap;
|
|
66
|
+
text-overflow: ellipsis;
|
|
67
|
+
text-style: dim;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
#np-position {
|
|
71
|
+
width: auto;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
#np-progress {
|
|
75
|
+
width: 1fr;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
#np-progress Bar {
|
|
79
|
+
width: 1fr;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#np-time {
|
|
83
|
+
width: auto;
|
|
84
|
+
padding-left: 1;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
#np-volume {
|
|
88
|
+
width: auto;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
#np-next {
|
|
92
|
+
width: 1fr;
|
|
93
|
+
padding-left: 4;
|
|
94
|
+
text-wrap: nowrap;
|
|
95
|
+
text-overflow: ellipsis;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
#np-timing {
|
|
99
|
+
width: auto;
|
|
100
|
+
text-style: dim;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
HelpScreen {
|
|
104
|
+
align: center middle;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
#help {
|
|
108
|
+
width: auto;
|
|
109
|
+
height: auto;
|
|
110
|
+
max-height: 90%;
|
|
111
|
+
border: round $primary;
|
|
112
|
+
border-title-color: $accent;
|
|
113
|
+
background: $panel;
|
|
114
|
+
padding: 1 2;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
#help Static {
|
|
118
|
+
width: auto;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.help-heading {
|
|
122
|
+
text-style: bold;
|
|
123
|
+
color: $accent;
|
|
124
|
+
margin-top: 1;
|
|
125
|
+
}
|
ttyplayer/utils.py
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import sys
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from ttyplayer.models import Video
|
|
6
|
+
|
|
7
|
+
APP_NAME = "ttyplayer" # the product name; every path, prefix and message derives from it
|
|
8
|
+
OLD_NAME = "cli" "tube" # the name before ttyplayer, split so the old-name grep guard stays clean
|
|
9
|
+
WINDOWS = sys.platform == "win32" # the one platform test; modules import it, tests patch theirs
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def data_path(filename):
|
|
13
|
+
"""Where ttyplayer keeps `filename`: $XDG_DATA_HOME/ttyplayer, by default ~/.local/share/ttyplayer,
|
|
14
|
+
or %LOCALAPPDATA%\\ttyplayer on Windows."""
|
|
15
|
+
base = Path(os.environ.get("XDG_DATA_HOME") or default_data_home())
|
|
16
|
+
migrate_data_dir(base)
|
|
17
|
+
return base / APP_NAME / filename
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def migrate_data_dir(base):
|
|
21
|
+
"""Carry the old name's data dir over, once: rename it when only it exists, else leave both alone."""
|
|
22
|
+
old, new = base / OLD_NAME, base / APP_NAME
|
|
23
|
+
if old.is_dir() and not new.exists():
|
|
24
|
+
old.rename(new)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def default_data_home():
|
|
28
|
+
if WINDOWS:
|
|
29
|
+
return os.environ.get("LOCALAPPDATA") or Path.home() / "AppData" / "Local"
|
|
30
|
+
return Path.home() / ".local" / "share"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def format_time(seconds):
|
|
34
|
+
if seconds is None:
|
|
35
|
+
return "--:--"
|
|
36
|
+
mins, secs = divmod(int(seconds), 60)
|
|
37
|
+
return f"{mins}:{secs:02d}"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def video_from_info(entry):
|
|
41
|
+
"""Build a Video from one yt-dlp entry. Only id is guaranteed to be present."""
|
|
42
|
+
return Video(
|
|
43
|
+
id=entry["id"],
|
|
44
|
+
title=entry.get("title") or "Untitled",
|
|
45
|
+
uploader=entry.get("uploader") or entry.get("channel") or "Unknown",
|
|
46
|
+
duration=entry.get("duration"),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def handle_many_entries(entries):
|
|
51
|
+
# yt-dlp leaves None in place of deleted or private playlist entries.
|
|
52
|
+
return [video_from_info(entry) for entry in entries if entry]
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def unseen(videos, shown):
|
|
56
|
+
"""The videos whose id is not in shown (nor repeated), in the order given."""
|
|
57
|
+
seen = {video.id for video in shown}
|
|
58
|
+
fresh = []
|
|
59
|
+
for video in videos:
|
|
60
|
+
if video.id not in seen:
|
|
61
|
+
seen.add(video.id)
|
|
62
|
+
fresh.append(video)
|
|
63
|
+
return fresh
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def parse_picks(text, count):
|
|
67
|
+
"""Turn "1 3 5" into [1, 3, 5], or None if anything is not a number in 1..count."""
|
|
68
|
+
pieces = text.split()
|
|
69
|
+
if not pieces:
|
|
70
|
+
return None
|
|
71
|
+
picks = []
|
|
72
|
+
for piece in pieces:
|
|
73
|
+
try:
|
|
74
|
+
number = int(piece)
|
|
75
|
+
except ValueError:
|
|
76
|
+
return None
|
|
77
|
+
if not 1 <= number <= count:
|
|
78
|
+
return None
|
|
79
|
+
picks.append(number)
|
|
80
|
+
return picks
|
ttyplayer/youtube.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
from yt_dlp import YoutubeDL
|
|
2
|
+
from yt_dlp.utils import DownloadError
|
|
3
|
+
|
|
4
|
+
from ttyplayer.models import Video
|
|
5
|
+
from ttyplayer.utils import handle_many_entries, video_from_info
|
|
6
|
+
|
|
7
|
+
class _Silent:
|
|
8
|
+
"""yt-dlp prints errors to stderr even when quiet; we report them ourselves."""
|
|
9
|
+
|
|
10
|
+
def debug(self, message):
|
|
11
|
+
pass
|
|
12
|
+
|
|
13
|
+
def info(self, message):
|
|
14
|
+
pass
|
|
15
|
+
|
|
16
|
+
def warning(self, message):
|
|
17
|
+
pass
|
|
18
|
+
|
|
19
|
+
def error(self, message):
|
|
20
|
+
pass
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# extract_flat: list playlist/search entries without fetching each video in full.
|
|
24
|
+
OPTIONS = {"extract_flat": True, "quiet": True, "no_warnings": True, "logger": _Silent()}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class YouTubeError(Exception):
|
|
28
|
+
"""yt-dlp could not resolve the target: no network, bad link, private video."""
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _extract(target):
|
|
32
|
+
try:
|
|
33
|
+
return YoutubeDL(OPTIONS).extract_info(target, download=False)
|
|
34
|
+
except DownloadError as error:
|
|
35
|
+
raise YouTubeError(_clean(str(error))) from error
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _clean(message):
|
|
39
|
+
# yt-dlp prefixes its messages with "ERROR: "; the CLI adds its own framing.
|
|
40
|
+
return message.removeprefix("ERROR: ").strip()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def search(query, limit=5) -> list[Video]:
|
|
44
|
+
info = _extract(f"ytsearch{limit}:{query}")
|
|
45
|
+
return handle_many_entries(info.get("entries", []))
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def fetch(url) -> list[Video]:
|
|
49
|
+
"""A single video link gives a one-item list; a playlist link gives every entry."""
|
|
50
|
+
info = _extract(url)
|
|
51
|
+
if "entries" in info:
|
|
52
|
+
return handle_many_entries(info["entries"])
|
|
53
|
+
return [video_from_info(info)]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def is_url(text):
|
|
57
|
+
return text.startswith("http")
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ttyplayer
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: ttyplayer: a modern YouTube player for the terminal — search, queue, and play audio or video via mpv
|
|
5
|
+
Keywords: youtube,music,player,mpv,cli,terminal,tui,yt-dlp
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Multimedia :: Sound/Audio :: Players
|
|
16
|
+
Requires-Dist: textual>=8.2
|
|
17
|
+
Requires-Dist: typer>=0.27.2
|
|
18
|
+
Requires-Dist: yt-dlp>=2026.8.19
|
|
19
|
+
Requires-Python: >=3.13
|
|
20
|
+
Project-URL: Homepage, https://github.com/webliftro/ttyplayer
|
|
21
|
+
Project-URL: Repository, https://github.com/webliftro/ttyplayer
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# ttyplayer
|
|
25
|
+
|
|
26
|
+
A modern YouTube player for the terminal. Search YouTube, queue videos and playlists, and play audio, or video too, through mpv: from the command line, or from a full-screen TUI. Keep a history and favorites, and drive the player from any other terminal.
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
ttyplayer play <url> play a video link, audio only
|
|
32
|
+
ttyplayer play <playlist url> queue every entry of a playlist
|
|
33
|
+
ttyplayer play <words...> search, pick one or more results, play them in order
|
|
34
|
+
ttyplayer play ... --video open a video window as well
|
|
35
|
+
ttyplayer play ... --limit 10 show more search results
|
|
36
|
+
|
|
37
|
+
ttyplayer search <words...> list results with durations
|
|
38
|
+
ttyplayer history recently played, newest first
|
|
39
|
+
ttyplayer history --play pick from history and play again
|
|
40
|
+
ttyplayer history --clear forget the history
|
|
41
|
+
ttyplayer favorite <url | words...> add a link, a playlist, or search picks to favorites
|
|
42
|
+
ttyplayer favorites favorites, newest first
|
|
43
|
+
ttyplayer favorites --play pick from favorites and play them
|
|
44
|
+
ttyplayer favorites --remove 2 drop the second favorite as listed
|
|
45
|
+
ttyplayer favorites --clear forget all favorites
|
|
46
|
+
ttyplayer tui [--video] full-screen: search box, results list, now-playing bar
|
|
47
|
+
ttyplayer doctor check Python, yt-dlp, mpv and ttyplayer's folders
|
|
48
|
+
ttyplayer version
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
While ttyplayer plays in one terminal, any other terminal can drive it:
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
ttyplayer pause pause / resume
|
|
55
|
+
ttyplayer next next in the queue
|
|
56
|
+
ttyplayer prev previous in the queue
|
|
57
|
+
ttyplayer stop quit the player
|
|
58
|
+
ttyplayer status 1:23 / 4:56 Playing <title>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Keys while playing:
|
|
62
|
+
|
|
63
|
+
| Key | Action |
|
|
64
|
+
|---|---|
|
|
65
|
+
| space | pause / resume |
|
|
66
|
+
| left / right, `,` / `.` | seek 5 seconds |
|
|
67
|
+
| up / down | volume |
|
|
68
|
+
| `n` / `p` | next / previous in the queue |
|
|
69
|
+
| `q` or Ctrl-C | quit, restores the terminal and stops mpv |
|
|
70
|
+
|
|
71
|
+
On Windows (Windows Terminal, PowerShell) the keys, arrows included, map the same way.
|
|
72
|
+
|
|
73
|
+
The volume meter, and the volume keys here and in the TUI, follow the Mac's system volume on macOS (the Mac's own volume keys move the meter within 2 seconds) and mpv's device (per-app) volume on Linux and Windows.
|
|
74
|
+
|
|
75
|
+
Picks accept several numbers at once: `1 3 5` queues those three in that order. After a search, `m` lists the next batch of results.
|
|
76
|
+
|
|
77
|
+
`TTYPLAYER_TIMING=1 ttyplayer play <words>` prints how long the YouTube lookup took and adds `started in 2.4s` (from `loadfile` to the first sound) to the status line.
|
|
78
|
+
|
|
79
|
+
## TUI
|
|
80
|
+
|
|
81
|
+
`ttyplayer tui` opens a full-screen player: a search box, Search / Queue / History / Favorites tabs, and a now-playing panel. Type a search or paste a link and press Enter. Ctrl-P opens the command palette (search, next theme, help, quit, pause, next, previous, mute, and Textual's own theme picker); `?` lists every key and command.
|
|
82
|
+
|
|
83
|
+
| Where | Key | Action |
|
|
84
|
+
|---|---|---|
|
|
85
|
+
| anywhere | `/` | focus the search box (`esc` returns to the table) |
|
|
86
|
+
| anywhere | `?` | help: every key and command (`esc` closes) |
|
|
87
|
+
| anywhere | `1` `2` `3` `4` | Search / Queue / History / Favorites tab |
|
|
88
|
+
| anywhere | Ctrl-C | quit and stop mpv |
|
|
89
|
+
| anywhere | Ctrl-P | command palette |
|
|
90
|
+
| anywhere | `t` | next theme |
|
|
91
|
+
| table | `q` | quit and stop mpv (in the search box it is just a letter) |
|
|
92
|
+
| table | `space` | pause / resume |
|
|
93
|
+
| table | `n` / `p` | next / previous |
|
|
94
|
+
| table | `,` / `.` | seek −5 s / +5 s |
|
|
95
|
+
| table | `<` / `>` | seek −30 s / +30 s |
|
|
96
|
+
| table | `-` / `+` | volume −5 / +5 |
|
|
97
|
+
| table | `M` | mute / unmute (🔇 in the panel) |
|
|
98
|
+
| table | `f` | favorite / unfavorite this row (the track playing when there is no row) |
|
|
99
|
+
| Search · History · Favorites row | Enter | play this one, then the rows after it |
|
|
100
|
+
| Search · History · Favorites row | `a` | add to the queue |
|
|
101
|
+
| Search | `m` | more results |
|
|
102
|
+
| Queue row | Enter | jump to this item |
|
|
103
|
+
| Queue row | `d` | remove from the queue |
|
|
104
|
+
| Queue row | `K` / `J` (or `shift+↑` / `shift+↓`) | move up / down |
|
|
105
|
+
| Queue | `c` | clear the queue (keeps the current track playing) |
|
|
106
|
+
| Favorites row | `d` | remove from favorites |
|
|
107
|
+
|
|
108
|
+
In the search box, letters, digits, `/` and `?` are typed as text; `esc` leaves it for the table.
|
|
109
|
+
|
|
110
|
+
## Install
|
|
111
|
+
|
|
112
|
+
One command installs everything ttyplayer needs.
|
|
113
|
+
|
|
114
|
+
macOS and Linux:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
curl -LsSf https://raw.githubusercontent.com/webliftro/ttyplayer/main/install.sh | sh
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Windows (PowerShell):
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
irm https://raw.githubusercontent.com/webliftro/ttyplayer/main/install.ps1 | iex
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Or clone the repository and run `./install.sh` (macOS, Linux) or `powershell -ExecutionPolicy ByPass -File .\install.ps1` (Windows) inside it; that installs the checkout you cloned.
|
|
127
|
+
|
|
128
|
+
The script:
|
|
129
|
+
|
|
130
|
+
1. installs [uv](https://docs.astral.sh/uv/) with its official installer if `uv` is missing (uv brings its own Python 3.13+; it runs as you, without sudo),
|
|
131
|
+
2. installs mpv if it is missing: Homebrew on macOS, your package manager on Linux (`apt-get`, `dnf`, `pacman`, `zypper` or `apk`, with `sudo`), winget on Windows,
|
|
132
|
+
3. installs ttyplayer with `uv tool install`,
|
|
133
|
+
4. runs `ttyplayer doctor`: every line should start with ✓.
|
|
134
|
+
|
|
135
|
+
It prints every command before running it. `TTYPLAYER_INSTALL_DRY_RUN=1 ./install.sh` and `install.ps1 -DryRun` only print them. If Homebrew (macOS) or winget (Windows) is missing, the script tells you how to install it and stops. If `ttyplayer` is not found in a new terminal, run `uv tool update-shell`.
|
|
136
|
+
|
|
137
|
+
<details>
|
|
138
|
+
<summary>By hand</summary>
|
|
139
|
+
|
|
140
|
+
Three steps on every system: install uv, install mpv, install ttyplayer. Then run `ttyplayer doctor`.
|
|
141
|
+
|
|
142
|
+
macOS:
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
146
|
+
brew install mpv
|
|
147
|
+
uv tool install ttyplayer
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Linux:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
154
|
+
sudo apt-get install -y mpv
|
|
155
|
+
uv tool install ttyplayer
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
On Fedora use `sudo dnf install -y mpv`, on Arch `sudo pacman -S --noconfirm mpv`, on openSUSE `sudo zypper install -y mpv`, on Alpine `sudo apk add mpv`.
|
|
159
|
+
|
|
160
|
+
Windows:
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
|
|
164
|
+
winget install -e --id shinchiro.mpv
|
|
165
|
+
uv tool install ttyplayer
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Instead of winget, `scoop install mpv` (from the `extras` bucket) or `choco install mpv` work too.
|
|
169
|
+
|
|
170
|
+
`uv tool install ttyplayer` installs from PyPI once ttyplayer is published there. Until then install straight from GitHub:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
uv tool install git+https://github.com/webliftro/ttyplayer
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
</details>
|
|
177
|
+
|
|
178
|
+
Upgrade with `uv tool upgrade ttyplayer`. Uninstall with `uv tool uninstall ttyplayer`.
|
|
179
|
+
|
|
180
|
+
## Development
|
|
181
|
+
|
|
182
|
+
Install from a checkout, with mpv installed as above:
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
uv tool install --editable .
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
The `--editable` flag means edits to the source are live without reinstalling.
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
uv run pytest # unit tests, no network and no mpv needed
|
|
192
|
+
uv run ttyplayer ... # run from the checkout
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
The live tests talk to the real YouTube through `ttyplayer.youtube`, so a yt-dlp or YouTube change shows up as a failing test. They are skipped unless `TTYPLAYER_LIVE=1` is set:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
uv run pytest -q # default suite, live tests skipped
|
|
199
|
+
TTYPLAYER_LIVE=1 uv run pytest -q tests/test_live.py # live tests, needs network
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
History lives in `$XDG_DATA_HOME/ttyplayer/history.jsonl`, by default `~/.local/share/ttyplayer/history.jsonl` (`%LOCALAPPDATA%\ttyplayer\history.jsonl` on Windows). Favorites live next to it in `favorites.jsonl`. History and favorites kept under the player's earlier name are moved here on the first run.
|
|
203
|
+
|
|
204
|
+
### Releasing
|
|
205
|
+
|
|
206
|
+
CI (`.github/workflows/tests.yml`) runs the suite on Linux and macOS on every push. Pushing a `v*` tag runs `.github/workflows/release.yml`, which builds with `uv build` and publishes to PyPI through trusted publishing, so there is no token to store.
|
|
207
|
+
|
|
208
|
+
One-time setup on PyPI: create an account, then under "Publishing" add a pending GitHub publisher for the project `ttyplayer` with owner `webliftro`, repository `ttyplayer` and workflow `release.yml`. The first tagged release creates the project.
|
|
209
|
+
|
|
210
|
+
To release, bump the version (`uv version --bump minor`, or edit `version` in `pyproject.toml`), commit, then:
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
git tag v0.3.0 && git push --tags
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## How it works
|
|
217
|
+
|
|
218
|
+
yt-dlp resolves what to play: a search or a playlist becomes a list of videos, a link becomes one. mpv produces the sound, started in the background with a private IPC socket. ttyplayer talks to it in JSON over that socket, owns the keyboard, and redraws a one-line status. See `docs/architecture.md`.
|
|
219
|
+
|
|
220
|
+
## License
|
|
221
|
+
|
|
222
|
+
MIT. See `LICENSE`.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
ttyplayer/__init__.py,sha256=Ixj3lj1latdXCZL7K_TZZKkn-Vls3FNkPDxjc-Kdx8M,55
|
|
2
|
+
ttyplayer/cli.py,sha256=Zx4CHUd3K-jcJePpkRqIbrOJvDkAaiBLIXFBkv4OHok,10337
|
|
3
|
+
ttyplayer/control.py,sha256=EjHdygzm7cvXvuD7bsCbbeCCPK6wZI7ojD19paKgvZ0,8043
|
|
4
|
+
ttyplayer/favorites.py,sha256=v_wHQZvcEYd82kj9zIdDl2CeMKoGjO5WU6Lj8HJP3q0,3013
|
|
5
|
+
ttyplayer/history.py,sha256=m21Ea-O30jXpvZuKFN0upUtrObh4uYgDYDnJLlm4RNw,1919
|
|
6
|
+
ttyplayer/models.py,sha256=CjWg_HaEjs4xuSfe5-HS0SunU61Xa01TZiMoBohlIlE,287
|
|
7
|
+
ttyplayer/player.py,sha256=iXCPzrOn6RYeYC5Ookfo65Y-bCD06KgxUOYRPADoWKc,23817
|
|
8
|
+
ttyplayer/tui.py,sha256=7r_Sxdd5d8uwzbNO4csa0f8T4oSAZxpa6UmxMWzN8_Q,23139
|
|
9
|
+
ttyplayer/tui.tcss,sha256=6nXouucTm5t1CSPVPMFepIpNPlRqjqHRK5FGTeuTl7I,1616
|
|
10
|
+
ttyplayer/utils.py,sha256=_8mu7TAYF1n2JIEl5_L1e891cvnc7aNicpMrbPxDmKI,2492
|
|
11
|
+
ttyplayer/youtube.py,sha256=aIY5C9ZsTfo8pr-v3e5gWc0etslJGkk0yW08lsnizIs,1552
|
|
12
|
+
ttyplayer-0.3.0.dist-info/licenses/LICENSE,sha256=AQ3oquFLP9MqkykFhM-xegULu0DKVGGIfl3caMbqbvA,1068
|
|
13
|
+
ttyplayer-0.3.0.dist-info/WHEEL,sha256=3iQx15CyXwGi4dbygedzA4M5T1eqO_SjwdPfUmqt2Cw,81
|
|
14
|
+
ttyplayer-0.3.0.dist-info/entry_points.txt,sha256=yDHJQx-Xohn4cbq9y0ot_5a4rgW0_Y3R5rnECT9FzrQ,50
|
|
15
|
+
ttyplayer-0.3.0.dist-info/METADATA,sha256=pRqyRKpb9aGsVjqgrRInwLDs6mc2UHUwjg1X-9AmAl0,9600
|
|
16
|
+
ttyplayer-0.3.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Weblift SRL
|
|
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.
|