Skip to content

Beta - #5

Merged
Twinx015 merged 20 commits into
masterfrom
beta
Oct 11, 2026
Merged

Twinx015 merged 20 commits into
masterfrom
beta

Conversation

@Twinx015

Copy link
Copy Markdown
Owner

Added cross platform support and used rich with some bug fixes.

…ting

Phase 2 (platform abstraction):
- backend/platform.py: is_linux/is_macos/is_windows, pid_exists/kill_pid,
  spawn_detached (start_new_session / DETACHED_PROCESS)
- backend/ipc.py: send/serve control actions; POSIX signals on Linux,
  localhost TCP socket elsewhere (pid registered via ctl_port)
- backend/lockfile.py: flock (POSIX) / msvcrt.locking (Windows)
- rewire control senders+receivers (cli, tui, minimal, rpc, mpris, players,
  radio) off raw os.kill/signal.signal onto ipc
- daemon: TCP loopback socket on Windows, spawn -f child instead of
  double-fork, chmod 0600 POSIX-only; flow_api connects to host:port file
- plugins/web: os.fork and start_new_session replaced by spawn_detached

Phase 3 (input port):
- backend/keys.py: RawReader (termios + O_NONBLOCK on POSIX, msvcrt
  kbhit/getwch thread on Windows) + install_quit_key; players and radio
  use it; cli/tui delegates quit-key remap

Phase 4 (linux extras disable):
- visualizer gated to Linux/curses; --setup-island Linux-only;
  notify(): notify-send / osascript / skip; MPRIS stub no-op confirmed

tests: new tests/test_ipc_control.py (socket + signal round-trip);
to-do.txt updated (Phases 2-4 done, 5-7 pending)
- ci.yml: ubuntu/macos/windows matrix; apt vlc / brew --cask vlc /
  portable VLC zip with PYTHON_VLC_LIB_PATH + VLC_PLUGIN_PATH; smoke step
  that imports vlc and creates a real Instance.
- backend/platform.py: bootstrap_vlc() sets python-vlc env hints from a
  verified on-disk VLC install on macOS/Windows (linux no-op).
- players + cli/tui/minimal/web call bootstrap_vlc() before any
  'import vlc'; test_vlc_bootstrap.py pins the four branches.
- Windows test gating: daemon E2E skipif, shell_quit_key module skip,
  offline radio pty test skip; registry/daemon dispatch tests now use a
  portable Python sleeper so they still run on Windows.
- packaging/flow.linux.spec moved from flow.spec (same drop-bundled-libvlc
  logic); new flow.macos.spec / flow.windows.spec never bundle VLC and rely
  on bootstrap_vlc + runtime env (external VLC.app / portable install).
  Per-OS hiddenimports: dbus/gi linux-only.
- release.yml: tag v* -> 3 parallel onefile builds, --check/--status smoke,
  upload-artifact + attach to GitHub Release.
- ci.yml smoke now imports all entry points (verifies tui/web/minimal on
  macOS/Windows).
- docs/user/installation.md: per-OS VLC install + PYTHON_VLC_LIB_PATH /
  VLC_PLUGIN_PATH instructions.
- test_ipc_control: assert Windows has no signal fallback (socket-only).
- Verified Linux onefile build locally (--check/--status/--help clean).
pathlib.Path.home() reads USERPROFILE on Windows, so overriding only HOME
left the Windows suite reading/writing the real ~/.flow. Set USERPROFILE +
HOMEDRIVE/HOMEPATH so conftest's scratch tree wins on every OS.
First matrix run surfaced three issues:
- Ubuntu 24.04 needs libgirepository-2.0-dev (not 1.0) for pygobject >= 3.52.
- bootstrap_vlc pinned PYTHON_VLC_LIB_PATH on macOS, which skips python-vlc's
  libvlccore pre-load; macOS now only exports the plugin path (and
  DYLD_LIBRARY_PATH for a Homebrew install). Tests updated.
- Windows portable-VLC step: replace Invoke-WebRequest/Expand-Archive with
  curl.exe + tar.exe.
- backend/ipc.py: install control signal handlers on any platform that has
  them (macOS got SIGUSR1/2 installed, right before they were used -> exit 158)
- backend/platform.py: widen_stdio() forces UTF-8 on stdout/stderr so cp1252
  pipes survive box-drawing output in --check/--status
- cli/main.py: call widen_stdio() at entry
- minimal/out.py: private stdout opens with newline='\n' (no CRLF on Windows)
- backend/status.py: _vid_from_thumb normalizes backslashes so Windows cache
  paths yield a video id
- tests/test_minimal.py: seek test delivers over the control socket when no
  seek signal exists (macOS/Windows)
- release.yml: overwrite: true so re-tagged test releases re-attach assets
bootstrap_vlc prefers the /Applications/VLC.app bundle, which exists on CI
mac runners, so the homebrew-fallback test never reached the DYLD branch
there. fake /Applications to a nonexistent dir too.
macOS and Linux both built dist/flow, so the last attach step clobbered the
other's asset in the GitHub Release (only one 'flow' survived). Stage the
binary as <artifact> (flow-linux/macos/windows.exe) before attaching and
use the valid overwrite_files input.
Tag v0.8.4-test: CI tests green on ubuntu/macos/windows and the Release
run attached flow-linux / flow-macos / flow-windows.exe, all with passing
--check/--status smoke; flow-linux also verified locally.
…, no dbus on windows

- Replace the hardcoded ANSI _COLORS table with rich styles; Primary/
  Secondary/Tertiary (and all named constants) are now rendered from rich,
  and config primary/secondary/tertiary accept any rich style (named,
  #hex, rgb(), bold/italic). Colors list in 'config -h' and the
  interactive picker now come from rich's 235 named colors.
- Themes rebuilt on rich color names.
- New display mode 'rich': a rich Live panel with an auto-refreshing
  progress bar (Online + Offline players), tty-gated like bars/progress.
- New config field progress_columns (aliases richcols, rich_columns):
  select which rich progress columns the bar shows (bar, percentage,
  spinner, time_elapsed, time_remaining, download, ...).
- mpris: never start the dbus_fast backend on Windows (dbus_fast.aio
  cannot import there — socket.CMSG_LEN missing); Windows uses the stub.
- rich added to pyproject dependencies; tests for the new modes/fields.
Running 'config' with no args shows a single select of every setting
(with its current value) instead of prompting through all of them in
sequence. Choosing one opens just that setting's editor (colors list
rich's palette, numeric ones validate ranges, booleans are confirms),
applies it, and saves. Adds a _interactive_rows() table covering all
plugin-safe targets (incl. theme, spinner, progress_columns).
ui.questionary_style() passed raw ANSI escape codes (config.Primary etc.)
to prompt_toolkit, which rejects them ('Wrong color format'). It now feeds
the chosen rich style strings (_STYLE[...]) to config._cname(), which
resolves them to prompt_toolkit-safe hex. _cname() also tolerates ANSI
input by reverse-mapping the palette, so stray codes fall back safely.
Adds tests/test_ui.py regression coverage.
--full now follows the display mode: 'rich' renders the live rich panel
(spinner + configured columns) fed from status.json, everything else keeps
the bordered progress card. Every display mode shows the same track info
(title/artist/album); only the progress widget differs. When display is
rich, the connection/search spinners and the yt-dlp download bar render via
rich (rich_display.spinner_run / download_start-update-stop). The --full
panel and visualizer footer now carry artist/album too. progress_columns is
hidden from the interactive config list unless display is rich.
'task' and 'percentage' both map to TaskProgressColumn, so a config with
both showed the percentage twice. _progress() now skips duplicate column
classes. The live Panel is capped to ~40% of the terminal (30-80 cols)
instead of spanning the full width.
extract_song() now uses Tile's parse_title() with a merged context:
Tile's curated ignore/artist data plus flow's ignore.txt words (so it
still honors per-user junk words). Fixes titles flow's homegrown parser
mangled: 'Kesariya - Arijit Singh | T-Series | 2023' was returning the
artist, and 'Old Town Road'/'Song Name' lost their first word.

The merged context is memoized keyed on both data files' mtimes, because
Tile's own get_context cache holds a single entry and alternating
between the two keys rebuilt everything on every call (~160ms each).
The preview-file flow (tags scan -> edit tags-preview.tsv -> tags apply) is
gone. Bare `tags` in the shell opens an interactive editor (language,
artist, or free-form tags; set on songs / rename everywhere / delete
everywhere / clear a song), and scriptable forms stay for flow-min:
tags list/add/remove/rename/delete.

free-form tags live in a new song_tags table; language/artist edits go
through comma-aware column ops so 'hindi, punjabi' renames/deletes either
tag. flow --meta (backfill_metadata) is removed too.
tags add -m <tag> / tags remove -m <tag> replace the song name with an
interactive checkbox over the downloaded songs, tagging/untagging every
selection. Uses the same -m flag play and playlist already have; the
single-song forms are unchanged.
Bare `tags` now multi-selects everywhere it makes sense: delete steps
checkbox-pick several tags (free-form, language or artist) and drop them
with one confirm; remove/clear steps pick several songs at once. Rename
stays single (each tag needs its own new name).

Replaces the `tags add -m`/`tags remove -m` subcommand forms, which were
not what was wanted.
@Twinx015
Twinx015 merged commit 9db418d into master Oct 11, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant