v0.26.0: Cassette footing — Syncthing client, host machine, Sync Settings

First step of friend library sharing (Cassette):

- cassette/syncthing_api.py: a typed wrapper over the *local* Syncthing's
  REST API. Key and address come from Syncthing's config.xml (config.json
  may override); every failure is a SyncthingError naming the step, what
  Syncthing said, and whether it's not running / a bad key / a refusal.
- cassette/state.py: friends, invites and share selections, kept in the
  machine-local ~/.local/share/lintunes/cassette, never the synced data dir.
- cassette/host.py: one machine runs Cassette. config.json flags it,
  preferences.json names it, and the other machine greys the menu group
  out and says where friend sharing lives.
- Connections ▸ Sync Settings…: VLC-style list + page, editing a copy
  that only OK writes. General shows Syncthing's status with a next step
  for every failure, the display name and an avatar picker.
This commit is contained in:
2026-09-28 21:01:17 -07:00
parent 549c5bf94f
commit db9e5eab79
11 changed files with 1404 additions and 2 deletions
+6 -1
View File
@@ -25,6 +25,7 @@ from lintunes.importers import file_importer
from lintunes.gui.album_art_dialog import AlbumArtDialog
from lintunes.gui.art_ops import embed_artwork
from lintunes.gui.cast_dialog import ChromecastDialog
from lintunes.gui.cassette_ui import CassetteUi
from lintunes.gui.device_sync_dialog import DeviceSyncSettingsDialog
from lintunes.gui.export_dialog import ExportKindDialog, WebMixDialog
from lintunes.gui.identify_dialog import IdentifyDialog
@@ -94,6 +95,8 @@ class MainWindow(QMainWindow):
# Context playback started from: "library" or "playlist:<pid>". Scopes
# the now-playing speaker icon to where the song is actually playing.
self._now_playing_context = ""
# Friend sharing's menu group and dialogs.
self._cassette = CassetteUi(self, prefs)
self.setWindowTitle("LinTunes")
self.resize(1280, 800)
@@ -375,7 +378,8 @@ class MainWindow(QMainWindow):
# "Sync Playlist to Rabbit (Auxio)" was retired in Round 51, once
# andTunes could play what it syncs. device_sync's helpers stay: the
# export and andTunes code import them.
connections_menu.addSeparator()
# Friend sharing (Cassette) sits between two separators of its own.
self._cassette.build_menu(connections_menu)
self._cast_action = self._add_action(
connections_menu, "Connect to Chromecast…", "", self._toggle_cast)
# Re-checked every time the menu opens: cheap (one gvfs listdir), and
@@ -411,6 +415,7 @@ class MainWindow(QMainWindow):
# Whole-library sync doesn't care which view is open — only that a
# device is plugged in and at least one playlist is ticked.
self._andtunes_action.setEnabled(not busy and device is not None)
self._cassette.refresh_menu()
# Enabled whenever there's an APK to offer; the click finds the
# Rabbit (adb or MTP) and says so if it can't — cheaper than asking
# adb on every menu open.