1 - Overview
What Orpheus is, what it refuses to be, and why.
The problem
A person with music on disk has two bad options.
A streaming client does not play their files. It plays a catalog somebody
else curates, requires an account, requires the network, and stops working the
day a licence lapses. The record they bought is not in it.
A desktop music player plays their files and stops at the edge of the desk.
The same library is unreachable from the phone in their pocket.
Orpheus is the third option: one player, the owner’s own files, the same
interface on Windows, Linux and Android.
What it does
| |
|---|
| Reads a library from folders you choose | Registers one or more folders, walks them, reads the tags out of every audio file and pulls out the cover art. Nothing is indexed that you did not point it at. |
| Browses by artist, album, song and genre | In rows or as a wall of sleeves, with a breadcrumb back out of whatever you drilled into. Genres have a tab of their own: a record is listed under every genre its tracks carry, and playing a genre plays only the tracks tagged with it. |
| Plays a track, a record, an artist, or everything shuffled | With a queue you can see and jump around in, repeat, and a resume point per track. |
| Shows what is playing everywhere | A persistent bar across the bottom, and a full player with the record’s own sleeve as large as the window allows. |
| Draws the music itself | The bars on the player are the spectrum of the recording, measured from its own samples by the engine that plays it. |
| Keeps playing on Android | From a notification and the lock screen — and stops for a phone call, and for headphones pulled out of the socket. |
| Shows the words, in time with the music | Your own files first; a lookup for the tracks that have none. |
| Selects several songs | Touch and hold a song, or Ctrl-click or Shift-click it, in any list of songs, and tick the ones you want — then edit their tags together, wherever they come from. A song’s own menu is on its ⋮ button or a right-click. |
| Keeps playlists | Add songs, a selection, an album or an artist from their ⋮ menus, and play the result in the order you arranged it, shuffled, or from any song. Give a playlist a cover of your own or let it show its albums’ covers, export it to .m3u, delete it without touching a song. A song whose file has gone stays in the list, greyed out and skipped. Playlists live in Orpheus’s own data, never in your music folders. |
| Keeps two playlists for you | Favourites lately and All-time favourites sit at the top of Playlists and fill themselves as you listen: the songs you have played most in the last 30 days, and the songs you have played most ever, up to 50 each. Play, shuffle, export or copy them into a playlist of your own; they cannot be edited. Show auto playlists in the preferences hides them, and your plays are still counted. |
| Exports your data | Preferences → Your data → Export my data (JSON)… saves your library, playlists, auto playlists, play history and statistics to one JSON file you choose, to read in any tool. It only reads, and writes only that file. The layout is documented and versioned. |
| Backs up and restores Orpheus | Back up Orpheus (ZIP)… adds your playlists’ cover pictures and your preferences to that data, in one ZIP. Restore from a backup… reads it, or an exported JSON, on this device or another: it shows the music folders the backup names so you can point Orpheus at your music, scans, matches the backup’s songs to your library by path and then by tags, and lets you Merge, Skip or Replace the playlists, the play history and the preferences separately. Merge is the default and loses nothing; Replace says what it removes first; a part either side could not read is not written over. Your music files are never touched. |
| Fixes tags, from MusicBrainz or by hand | Autofill a record from MusicBrainz, or edit one track’s tags and cover yourself — or, from an album’s or an artist’s ⋮ menu, the shared tags of all its songs at once; fields they disagree on show as mixed and are left alone unless you type in them. Only what you confirm is written. |
| Fixes the tags of many songs at once | Autofill tags… on an artist, a genre, a playlist, a selection, or the whole library from the Music tab’s ⋮ menu. Orpheus says how many songs and records that is and about how long it will take, then looks them up on MusicBrainz in the background. The records it is sure of are written without asking, replacing their current tags; the doubtful ones are kept, with the reason, for you to check in the usual review. You can stop it and keep what was written. |
| Says what you actually listen to | Total plays, and the most played tracks, artists, records and genres — counted from your own listening and nobody else’s. |
| Adapts to the window | A rail down the side on a desktop, a bar across the bottom on a phone. |
| Light and dark, English and Brazilian Portuguese | |
What it deliberately does not do
It changes your files only when you ask. No renaming, no moving, no
deleting, no transcoding. The one change it ever makes to an audio file is to
its tags, from an autofill whose every change you saw and confirmed, an
autofill of many songs that you started knowing it writes the matches it is sure
of without asking, or an edit you made by hand — and it refuses a file another
program changed since it was read. Besides that, it writes a .lrc next to a
track whose words it looked up, a new file and never a replacement for one you
wrote.
Almost no network. No streaming, no scrobbling, no telemetry, no analytics,
no crash reporting, no cover art fetched unless you ask. There are three
exceptions: the lyrics lookup and, on Windows and Linux, the check for a newer
release
(Keeping it up to date),
both of which can be turned off, and the MusicBrainz and Cover Art Archive
lookups an autofill makes when you start one.
That last promise is enforced rather than asserted. The Android package declares
an exact set of permissions, and CI reads them back out of the built package and
fails the build on any permission not on that list — including one merged in
by a dependency.
No accounts, no sync, no cloud. One person, one machine, one library.
Nothing Orpheus sends identifies you or persists between requests: no account,
no key, no identifier of any kind.
No library management. Organising and de-duplicating a music collection is
a different program. This one reads what is there, and fills in tags only when
you ask it to.
What leaves the machine for the words
For a track with no words on your machine — no .lrc beside it, no SYLT
frame, no lyrics tag — and only while you leave the lookup on, Orpheus asks a
lyrics service for them using that track’s artist and title, with its record
and length where the tags give them.
It sends nothing else: not the file’s name, not its path, not your library, not
what else is on the machine. A track whose tags do not give both an artist and a
title is not looked up at all, because a lookup on a title alone is a guess
between every recording that shares the name.
See the lyrics flow for exactly
how that is ordered.
How it is built
Flutter, one source tree, three targets. The playback engine is libmpv through
media_kit — the one engine in its class that covers Windows, Linux and Android
with the same API and the same codec range, without transcoding anything.
Tags are read in pure Dart, which matters more than convenience: it is the one
component that would otherwise need a native build per target, and a reader that
cannot run in a test is a reader whose parsing nobody checks.
There is no database. The catalog is a JSON document, read once and held for the
run — a library of tens of thousands of tracks is a few megabytes of tags, and
every screen in the music area needs all of it to group by.
2 - Architecture
The layering, the domain models, and the rule every feature follows.
The shape of it
Orpheus is organised by feature, and each feature by layer. There is no
models/, services/, widgets/ split — a change to how lyrics work touches
one directory, not four.
flowchart TD
P["presentation<br/><small>widgets, screens</small>"]
A["application<br/><small>controllers, state</small>"]
D["domain<br/><small>models, interfaces</small>"]
DA["data<br/><small>files, tags, network</small>"]
DI{{"core/di/providers.dart<br/><small>the single composition root</small>"}}
P --> A
A --> D
DA -.implements.-> D
DI -.binds.-> DA
DI -.binds.-> A
classDef pure fill:#4a6fa5,stroke:#2c4368,color:#fff
classDef edge fill:#7a5c9e,stroke:#4a3560,color:#fff
classDef root fill:#3f6b4f,stroke:#264530,color:#fff
class D pure
class DA edge
class DI rootThe rule that matters: domain has no Flutter and no IO. It is models and
interfaces. data implements those interfaces at the outward edges — the
filesystem, the tag reader, the playback engine, the network. Nothing
in domain knows any of them exist.
That is what makes the whole test suite run without a real audio engine, a real
filesystem or a real network: every outward dependency is an interface bound in
one place, and a test overrides the binding.
The features
| Feature | What it owns |
|---|
library | Registering folders, scanning them, the catalog, cover art |
playback | The queue, the engine, the player screen, the spectrum bars |
lyrics | Finding a track’s words, and reading along with them |
stats | The play threshold, the history, and the rankings |
shell | The frame: navigation, the playback bar, preferences |
The library model
What a scan produces, and what every screen in the music area reads from.
classDiagram
class MusicCatalog {
+List~MusicEntry~ entries
+DateTime? scannedAt
+bool isStale
+Map~String, MusicEntry~ byPath
+bool isEmpty
+entryFor(AudioFile) MusicEntry
+entryAt(String path) MusicEntry?
}
class MusicEntry {
+AudioFile file
+TrackMetadata metadata
+String? albumArtistOfRecord
+String? album
+String? artist
+String? albumArtist
}
class AudioFile {
+String path
+int sizeInBytes
+DateTime modifiedAt
}
class TrackMetadata {
+String? title
+String? artist
+String? albumArtist
+String? album
+List~String~ genres
+int? track
+int? disc
+int? year
+Duration? duration
+String? coverId
}
MusicCatalog "1" *-- "many" MusicEntry
MusicEntry "1" *-- "1" AudioFile
MusicEntry "1" *-- "1" TrackMetadataThree things in that model are worth explaining, because each exists to fix a
real bug rather than to be tidy.
byPath is built once and lazily. The player asks “what is this file?” for
every track it opens and every frame the bar draws, and a linear search of the
whole library per frame is what that becomes without an index.
isStale marks a catalog read back from a document another version wrote. It
is refused rather than half-read, so it holds nothing, and startup scans it
whether or not the owner asked for a scan at every launch — otherwise an upgrade
that changed the document would leave that owner with an empty library.
albumArtistOfRecord is how a compilation stays one record. Half-tagged
libraries are the norm, so where a file carries no album-artist tag the answer
is worked out across the whole record rather than falling through to the
performer — which is what keeps a rap album with a guest on every track out of
the artist list twelve times over.
The outward edges
Every one of these is an interface in domain with an implementation in data
and a binding in the composition root. The right-hand column is what a test gets
instead.
classDiagram
direction LR
class CatalogStore {
<<interface>>
+read() Future~MusicCatalog~
+write(MusicCatalog) Future~void~
+clear() Future~void~
}
class MediaPlayer {
<<interface>>
+Stream~PlaybackStatus~ status
+open(String path, Duration startAt) Future~void~
+play() Future~void~
+pause() Future~void~
+seek(Duration) Future~void~
+setVolume(double) Future~void~
}
class LibraryScanner {
<<interface>>
+scan(List~String~ folders) Stream~ScanEvent~
}
class MediaSession {
<<interface>>
}
JsonCatalogStore ..|> CatalogStore
InMemoryCatalogStore ..|> CatalogStore
MediaKitPlayer ..|> MediaPlayer
FakeMediaPlayer ..|> MediaPlayer
IsolateLibraryScanner ..|> LibraryScanner
ScriptedScanner ..|> LibraryScanner
AudioServiceMediaSession ..|> MediaSession
SilentMediaSession ..|> MediaSessionSilentMediaSession is not only a test double. It is the honest answer on the
two desktop targets, which have no notification and no lock screen — the Android
session sits behind the same interface and is bound only there.
The flows
2.1 - Finding a track's words
The flow that reaches a lyrics service, and the order that governs it.
The order is the feature
It never varies, and every part of it is a rule written down in the
specifications rather than a decision made in code:
- What this machine holds. A
.lrc beside the track, then the track’s ID3
SYLT frame, then its lyrics text tag. Whatever these hold is the answer,
and nothing else is asked. - Only then, a lookup — and only if the owner has left it on.
- A sheet that came back is written beside the track as a
.lrc, so the
next launch finds it at step 1 and asks nobody anything.
The sidecar outranks both tags deliberately: it is the one of the three an owner
can write, correct and delete with a text editor and no help from this
application. Of the two tags, the timed frame outranks the text one, because a
file carrying both was written by somebody who put the timed copy in SYLT.
The flow
sequenceDiagram
autonumber
actor Owner
participant Panel as LyricsPanel
participant Ctrl as LyricsController
participant Local as FileLyricsSource
participant Remote as LrclibLyricsSource
participant Side as FileLyricsSidecar
Owner->>Panel: presses the lyrics control
Panel->>Ctrl: build()
Ctrl->>Local: of(path)
Note over Local: .lrc beside it →<br/>SYLT frame →<br/>lyrics text tag
alt this machine has the words
Local-->>Ctrl: Lyrics
Ctrl-->>Panel: Lyrics
Note right of Ctrl: nothing is asked of anybody
else nothing here
Local-->>Ctrl: null
alt the lookup is turned off
Ctrl-->>Panel: null
Note right of Ctrl: nothing leaves the machine
else the lookup is on
Ctrl->>Ctrl: build a query from the catalog
Note over Ctrl: artist + title required;<br/>record and length if tagged
Ctrl->>Remote: find(query)
Remote->>Remote: exact match, with the length
opt no exact match
Remote->>Remote: search, then rank the candidates
end
alt a sheet came back
Remote-->>Ctrl: RemoteLyrics
Ctrl->>Side: write(path, text)
Side-->>Ctrl: landed, or refused
Ctrl-->>Panel: Lyrics
else nothing found, or the network refused
Remote-->>Ctrl: null
Ctrl-->>Panel: null
end
end
end
Panel-->>Owner: the words, or "no lyrics for this track"What leaves, and what does not
The query carries the track’s artist and title, with its record and length
where the tags give them. That is what is printed on the sleeve.
It does not carry the file’s name, its path, the library, what else is on the
machine, or anything that persists between requests — there is no account, no
key and no identifier of any kind. The service needs none, which is why it was
the one chosen.
A track whose tags do not give both an artist and a title is not looked up
at all. A lookup on a title alone is a guess between every recording that shares
the name, and a file tagged that poorly is exactly the one whose words would
come back belonging to somebody else’s song.
Choosing between answers
The exact endpoint is asked first, with the length — which is what separates the
studio take from the live one, since the two share a title and an artist and
share nothing about when a line is sung.
Where that misses, a search follows, and its candidates are ranked here rather
than taken in the order they arrive:
flowchart LR
A[candidates] --> B{timed?}
B -->|yes| C[+4]
B -->|no| D[+0]
C --> E{length within 2s?}
D --> E
E -->|yes| F[+2]
E -->|no| G[+0]
F --> H{artist matches exactly?}
G --> H
H -->|yes| I[+1]
H -->|no| J[+0]
I --> K[highest score wins]
J --> KGetting that ranking wrong is not a cosmetic failure — it puts somebody else’s
words on the owner’s track.
Nothing here is ever a failure
A 404, a timeout, a captive portal, a body that is not the JSON it claimed, a
refused write: every one of them ends at the panel saying this track has no
words. That is where the owner already was, and it is not a thing they can act
on. A lookup is a convenience over a track that already had nothing.
The sidecar
The .lrc written beside the track is the only file Orpheus ever writes into
a music folder, and the rules around it are what keep that defensible:
- One file, in the folder the track is already in. The audio file is not even
opened.
- Never a replacement for a
.lrc that is already there — that file is the
owner’s answer, and this only ever fills a gap. - Written through a temporary file and renamed into place, so a process killed
mid-write leaves either no sidecar or a whole one, never half of one the
parser would read as truncated.
- A refusal is reported, not thrown. Read-only mounts, network shares and
Android’s scoped storage all refuse it, and none of them is a reason to
withhold words the panel already has in hand.
On Android that refusal is the ordinary outcome rather than the exception:
scoped storage grants read access to media and nothing that would let a process
write next to the file it just read. The words show for the session; the saving
is lost.
2.3 - Playing something
The states a player can be in, including the two that are about failure.
The queue
Anything playable produces a queue: a track, a record, an artist, or the whole
library shuffled. The queue knows what kind of thing it came from, which is what
lets the player say what is playing rather than only which file.
classDiagram
class PlaybackQueue {
+List~AudioFile~ tracks
+QueueKind kind
+String? label
+int index
}
class QueueKind {
<<enumeration>>
track
album
artist
playlist
}
class QueueRepeat {
<<enumeration>>
off
all
one
+next() QueueRepeat
}
class AudioPlaybackState {
+PlaybackQueue queue
+AudioStage stage
+PlaybackStatus status
+QueueRepeat repeat
}
AudioPlaybackState *-- PlaybackQueue
AudioPlaybackState *-- QueueRepeat
PlaybackQueue *-- QueueKindlabel is carried but never worded here. The domain has no localized strings,
so what an unnamed record is called is a presentation decision made once, on
the way to the screen.
The stages
stateDiagram-v2
[*] --> idle
idle --> starting: something is played
starting --> playing: the engine opened it
starting --> offeringResume: a resume point exists
offeringResume --> playing: resume, or start over
playing --> idle: stopped
starting --> allFailed: every track refused to decode
allFailed --> starting: something else is played
allFailed --> idle: stopped
note right of offeringResume
A resume point is per track,
and it is offered rather than
applied — landing mid-song
with no explanation is worse
than asking.
end note
note right of allFailed
Not "an error". A queue whose
every file is unplayable is a
state the screen has to show,
and a single bad file is
skipped rather than fatal.
end noteThe stage worth noticing is allFailed. A single file that will not decode is
skipped and the queue moves on — a corrupt track in the middle of a record
should not end the record. It is only when nothing in the queue could be
opened that the player has something to say, and then it says it rather than
sitting silently on a stopped transport.
Position, and what it costs
The engine reports its position several times a second. Everything that follows
the music is driven from that one stream: the progress bar, the spectrum bars,
and the lyric line that is lit.
The lyric lookup for “which line is being sung at this moment” is a binary
search rather than a walk, for exactly that reason — it is asked on every
position report for as long as a track plays.
The spectrum bars
The bars on the player are not decoration and not a random animation. They are
the spectrum of the recording, measured from its own samples by the same engine
that plays it, analysed once per track and cached against a key carrying the
file’s path, length and modification time.
Until that analysis lands — the second or so after a track starts, and forever
for a file that could not be decoded — a stand-in is drawn, derived
deterministically from the track’s path so it is stable rather than jittering
between frames.
flowchart LR
A[track opens] --> B{analysed before?}
B -->|yes| C[read the cached spectrum]
B -->|no| D[draw the stand-in]
D --> E[decode and measure, off the interface isolate]
E --> F[cache it]
F --> C
C --> G[bars follow the music]
D --> GKeeping playing on Android
A foreground service is the only way Android lets a process keep making noise
once it is no longer on screen. Orpheus asks for it with the type that says what
for — mediaPlayback — and the notification and lock-screen controls come with
it, carrying the sleeve and the transport buttons.
Audio focus arrives through the same seam: the phone call that should pause
playback, and the headphones pulled out of the socket that should too.
Both sit behind the MediaSession interface, with a silent implementation bound
on the two desktops — which have no such thing, and where a silent answer is the
honest one rather than a stub.
5 - Contributing
Building from source, running the tests, branching and releasing.
This repository lives at https://git.techcraftsmen.net/artur-rios/orpheus. GitHub is a read-only mirror:
open pull requests on the git server, not on GitHub. To clone it:
git clone https://git.techcraftsmen.net/artur-rios/orpheus.git
The normative rules for how work is delivered — branches, commits, the issue lifecycle, pull requests and the
Definition of Done — are in the
Development Workflow Document, and the tests are specified
in the Testing Specification Document. This file collects
what you need to build, test and release the application.
Prerequisites
- Flutter 3.50.1, stable channel — the version the project is built
and tested against (see the Technology Stack Document).
- Linux:
ninja-build and libgtk-3-dev to build, and libmpv to play (sudo apt install libmpv-dev mpv on
Debian and Ubuntu). flutter test needs a C++ compiler, pkg-config and libgtk-3-dev too: it compiles
window_manager’s native library, against the GTK, X11 and Xi headers that package brings. - Android: a JDK 17 and the Android SDK.
- Windows: the MSVC toolchain Flutter’s Windows build needs, and Inno Setup
for the installer.
- The icon: Python 3 with Pillow.
Layout
lib/
core/ themes, spacing, breakpoints, settings, failures, l10n,
and the single composition root in core/di/providers.dart
features/
library/ folders, scanning, tags, cover and catalog storage
playback/ the queue, the engine and media-session boundaries, and
the music area
lyrics/ finding a track's words on this machine, and reading along
stats/ the play threshold, the history, and the rankings
shell/ the frame: navigation, the playback bar, preferences
tools/ dev.sh / dev.ps1 to run it, verify.sh / verify.ps1 to
check it, and the two installer builds
packaging/windows/ the Inno Setup script the installer is compiled from
packaging/linux/ the shell installer the Linux payload is wrapped in
packaging/icon/ the application icon, and the script that draws it
Each feature is domain (no Flutter, no IO), data (the outward edges),
application (the controllers), presentation (the widgets). Nothing outward
is constructed anywhere but core/di/providers.dart, which is what lets a test
override a binding rather than patching a global.
Building and testing
flutter analyze # must be clean; there is no known-warnings list
flutter test # the unit and widget suite
flutter build linux --release
flutter build windows --release
flutter build apk --release
Tests
Tests are named Given-When-Then, one behaviour apiece, and follow the source
tree: lib/x/y.dart is tested by test/x/y_test.dart. Nothing in the suite
reads the developer’s own preferences, writes into their application-support
folder, records against their listening statistics, opens the native playback
engine, starts a platform media service, or reaches the network — every one of
those is a provider, and every one is overridden by the harness in
test/support/test_container.dart.
tools/verify.sh, tools/verify.ps1 and so the checks run the suite as four
bundles written by tools/test_bundles.dart: each imports a share of the test
files, is compiled once, and runs that share in one process. flutter test
compiles one file at a time, so a run of one entry point per test file was
mostly compiling. A test may therefore not depend on running in a process of
its own: what it changes outside itself, it puts back. flutter test itself
still runs each file in its own process, and flutter test test/features/stats
is still the quick loop for one area.
Two of the tests are guards rather than assertions about behaviour, and they
exist because a rule nobody checks is a comment:
test/core/theme/no_colour_literal_test.dart — every colour comes from the
theme’s single seed, and nothing outside lib/core/theme/ may declare one.test/core/l10n/catalog_parity_test.dart — both languages stay complete, every
message carries a description, and a translation uses the same placeholders as
its original.
The scanner and the tag reader are tested against real files in a temporary
directory, built by test/support/flac_fixture.dart — a genuine FLAC header
with real Vorbis comments and a real embedded picture, small enough to write
from a test.
Running it while you work on it
./tools/dev.sh # Linux and macOS
.\tools\dev.ps1 # Windows
Picks a device, checks what it needs, and starts the application. With no
arguments it runs on this host’s desktop; with one device attached and no
desktop target, on that one; with several, it refuses and lists them rather
than guessing — being handed a phone when you meant the desktop costs more time
than typing --device.
The loop is Flutter’s own. While it runs, r hot-reloads, R hot-restarts,
q quits — so change the code and see it is one keystroke, not another run of
the script. Start it again for the things hot reload cannot carry: a new
dependency, a native or platform file, or a change to either .arb catalog
(then use --generate).
| Flag | |
|---|
--device ID / --android | Where to run. --android takes the attached device or emulator, whatever its id. |
--clean | Delete this application’s own data — the catalog, cover cache, analysed spectra, play history and preferences — so the next start is a first launch. Never touches your music, names exactly what it will delete, and asks first unless --yes. On Android it clears the app’s data on the device. |
--generate | Regenerate the localizations first. |
--test | Run the suite first, and stop if it is red. |
--profile / --release | Run the way an owner would get it. Neither has hot reload — that is debug only, and the script says so rather than letting you press r into silence. |
--no-run | Do everything else and stop. |
On Linux it also checks for libmpv up front, because without it playback fails
at the first press of play rather than at startup — which is a long way from the
cause.
On Windows the first build in a fresh build directory prints Nuget.exe not found, trying to download or use cached version. That is CMake, not this
application: permission_handler_windows compiles against the CppWinRT NuGet
package and fetches a pinned, checksummed nuget.exe when one is not on PATH.
It is a status line rather than a warning — a real failure stops the build with
Failed to install nuget package Microsoft.Windows.CppWinRT — and it prints
once per clean build directory. winget install Microsoft.NuGet silences it.
The plugin itself does nothing on Windows; it arrives as the endorsed Windows
implementation of the permission_handler that Android needs, and Flutter
builds every plugin registered for a platform whether or not it is used.
tools/dev.ps1 takes the same flags in long form (-Device, -Clean, -Yes).
The icon
The application icon is a lyre — Orpheus’s own instrument — whose strings are
the sound bars from the player screen, standing at the uneven heights a level
meter stands at.
It is drawn in code, not kept as a binary nobody can edit: a change to the
palette, the proportions or the string heights is a diff in one Python file,
and every size every platform wants is regenerated from it.
python3 packaging/icon/make_icon.py # needs Pillow, and nothing else
That writes the Android launcher icons at all five densities — the square one
for releases before Android 8, and the adaptive icon’s foreground layer, drawn
without its background so the launcher can mask the pair into whatever shape
the device uses — the Windows .ico, the Linux window icon, and the 1024px
master in packaging/icon/.
The two smallest .ico frames are drawn from separate, simpler artwork.
At sixteen and thirty-two pixels the arms and the yoke are a stroke under two
pixels wide, which is not a lyre, it is grey fringing; what those frames show
instead is what the mark is about — three bars at three heights on their
soundbox. An .ico saved from one image is that image downsampled six times,
and the two smallest of those are the mush this avoids.
Flutter’s Linux runner ships no icon at all, so linux/CMakeLists.txt installs
the PNG beside the bundle’s data and my_application.cc loads it into the
window. Beside the bundle rather than into a hicolor theme deliberately: this
is the icon of the window this binary opens, which is a different thing from
the icon a packaged application registers with the desktop, and only the first
is the build’s to decide.
Verifying everything at once
./tools/verify.sh # Linux and macOS
.\tools\verify.ps1 # Windows
Each runs the analyzer, the suite, and a release build of every target its host
can build — then prints one summary saying what passed, what was skipped, and
what this operating system could never have done in the first place.
That last distinction is the point of the script. No single machine can build
all three targets: Windows binaries need Windows and MSVC, Linux binaries need
Linux and GTK. So a run reports three outcomes rather than two —
| Meaning | Under --strict |
|---|
PASS | It ran and it passed. | passes |
SKIP | A toolchain that could have been here was not — no Android SDK, no libgtk-3-dev. | fails |
n/a | This operating system cannot build that target at all. | passes |
— because a missing Android SDK is something you can fix, and a Linux machine
not producing a Windows binary is not.
Useful flags: --no-build for the fast loop, --only linux|android|windows for
one target, --strict for CI. tools/verify.ps1 takes the same ones in long
form, plus -Installer.
The linux check (ci/linux.sh, run by Jenkins) and .github/workflows/verify.yml are what make the n/a rows
add up to nothing: they run verify.sh --strict on Linux (Linux + Android) and verify.ps1 -Strict on
Windows (Windows + the installer, the Windows and the installer job on the GitHub mirror). The linux check also reads the built APK’s permissions back
out and fails the build if they are not exactly the nine declared in
AndroidManifest.xml — which is the promise at the top of the README,
enforced rather than asserted. A deny list would only catch the permissions
somebody thought to forbid; pinning the whole set catches the next one
whatever it is, including one merged in by a dependency.
The Windows installer
.\tools\build-windows-installer.ps1
Builds the Windows release and compiles packaging\windows\installer.iss into
dist\orpheus-setup-<version>.exe. It needs Inno Setup
(winget install JRSoftware.InnoSetup); the script looks for ISCC.exe on
PATH and in both standard install directories, and takes -InnoSetupPath if
it is somewhere else. -SkipBuild reuses an existing release build.
Every push to any branch builds it, which is how a pull request gets its result:
the Verify workflow’s Windows job (the GitHub mirror runs it) uploads orpheus-setup-<version>.exe as an
artifact, so the latest one is a download away from the run that produced it.
The Linux installer
./tools/build-linux-installer.sh
Builds the Linux release and wraps it in dist/orpheus-installer-<version>.sh
— a shell script with the release bundle compressed onto the end of it.
--skip-build reuses an existing release build.
A self-extracting script rather than a .deb, a Flatpak or an AppImage, and
the reason is what each of those assumes. A .deb assumes apt, which leaves
out every distribution that does not use it. A Flatpak assumes Flatpak is set
up, and adds a sandbox that would have to be punched through for the one thing
this application does — read music folders the owner chose, anywhere on their
disk. An AppImage is a portable binary rather than an installation: no launcher
entry, no icon.
What the installer does once built is described under
Downloads in the README.
Branching and pull requests
feature/<name> ─┐
fix/<name> ─────┴─▶ develop ──▶ release/x.y.z ──▶ main (tag vx.y.z)
| Branch | Cut from | Merges into | How |
|---|
feature/<name>, fix/<name> | develop | develop | Pull request, squash or merge. The branch is deleted on merge. |
release/x.y.z | develop | main | Pull request, merge commit. Carries no commits of its own. |
develop, main | — | — | Protected: no direct pushes, no force pushes, no deletion. |
develop is the default branch, and nothing is committed to it or to main directly. One branch per issue, named
feature/uc-<number>-<short-name> — e.g. feature/uc-14-resume-a-track. Work that is not a use case takes the same
pattern without the uc- segment, and a defect fix takes fix/: fix/scan-progress-strip. Names are lowercase:
letters, digits, ., _ and -. A release/ branch is a snapshot of develop: a fix for a release lands on
develop through a fix/ branch and a new release branch is cut.
The branch-policy check, run by Jenkins, checks all of this on every pull request into
develop or main. It, the linux check and the Windows and the installer job, are required checks on both branches. The repository
owner can bypass these rules; that is for emergencies, not for routine work.
A pull request is titled after the use case (UC-14 — Resume a track where it stopped), says what was built, which
flows and alternative flows are covered and what was deliberately left out, and links its issue so merging closes it.
Nothing is merged with a failing analyzer or a failing suite. The full rules, and the Definition of Done, are in the
Development Workflow Document.
Commit messages follow Conventional Commits, all lower case, subject in the
imperative mood and no longer than 50 characters including the type prefix, e.g.
feat: play in the background on android or fix: let go of a finished scan, so the next one runs. The commit type
is any of feat, fix, refactor, docs, build, chore, test, ci or perf, whatever the branch is called.
Record every change an owner would notice under ## [Unreleased] in CHANGELOG.md, in the same
pull request that makes it.
Versioning
Orpheus follows Semantic Versioning, tagged v<major>.<minor>.<patch>. For an
application, what a version number promises is about the owner who installed it: what it does on screen, the
library, catalog, statistics and settings it keeps between runs, and whether the next release installs over the one
they have.
- Major — a release that breaks something an owner relies on. A feature is removed, or works so differently
that it has to be relearned; the catalog, the play history or the preferences a previous version wrote are no
longer read, so a library has to be registered and scanned again or statistics start from nothing; or the
release cannot be installed over the previous one, drops a platform, or raises the minimum Android release.
Its entry in CHANGELOG.md carries an
### Upgrading from <X>.x to <Y>.0 section saying what to
do. - Minor — something an owner can do that they could not before, leaving everything they already did working as
it did.
- Patch — a fix, or a screen saying something truer.
A pre-release carries a SemVer pre-release identifier, -beta.<n>: v1.3.0-beta.1 is a pre-release of 1.3.0, comes
before it, and is published as a GitHub pre-release. The in-application update check orders versions by SemVer 2.0.0
precedence — 1.3.0-beta.1 < 1.3.0-beta.2 < 1.3.0, build metadata ignored. A stable build asks GitHub for the
latest release, which is never a pre-release, so nobody is offered one who did not go looking for it. A build that is
itself a pre-release reads the release list instead and is offered the highest version on it: the next beta, then the
release it leads to.
The version lives in one place, the version: in pubspec.yaml, as <major>.<minor>.<patch>+<build>, or
<major>.<minor>.<patch>-beta.<n>+<build> for a pre-release: v1.3.0-beta.1 is built from 1.3.0-beta.1+7. Both
installer scripts read it from there, so their file names carry the pre-release (orpheus-setup-1.3.0-beta.1.exe);
Flutter compiles it into the application, which is how a beta knows it is one — built from 1.3.0+7, it would report
itself as 1.3.0 and never be offered the 1.3.0 that follows it; and the release build refuses a tag that is not
v followed by that version, pre-release included and build number left out. The build number rises with every
package that is published, pre-releases included, because Android reads it as versionCode — through
flutter.versionCode in android/app/build.gradle.kts — and an update whose code did not rise is not an update as far
as the platform is concerned.
The next release’s build number must be 13 or higher. 1.7.0 shipped as build 12, after v1.2.2-beta.1 had shipped
an APK built as 1.2.2+6 from the diagnose/android-usb-folder branch, and a phone that installed it holds
versionCode 6.
Releasing
A release branch carries no commits of its own, so everything a release changes in the repository lands on develop
first, through a normal branch and pull request — feature/release-1.3.0, say, with a chore: release 1.3.0
commit:
version: in pubspec.yaml set to the new version — with its -beta.<n> for a pre-release — and the next build
number;## [Unreleased] in CHANGELOG.md renamed to ## [<version>] - <yyyy-mm-dd> above a fresh,
empty ## [Unreleased], and the compare links at the bottom updated.
Then:
Cut the release branch from develop and push it:
git switch develop && git pull
git switch -c release/1.3.0
git push -u origin release/1.3.0
Open a pull request release/1.3.0 → main. The Branch Policy check refuses it if the branch carries a commit that
is not on develop, or if v1.3.0 is already tagged.
When the checks pass, merge it with a merge commit, and delete the release branch.
Tag the merge commit on main and push the tag — only the repository owner can create a v* tag:
git switch main && git pull
git tag v1.3.0
git push origin v1.3.0
A pre-release goes the same way — release/1.3.0, with pubspec.yaml saying 1.3.0-beta.1+<build> — and is tagged
v1.3.0-beta.1 on the merge commit instead. The next beta, or the stable release that follows, is a new package:
pubspec.yaml says 1.3.0-beta.2+<build> or 1.3.0+<build>, with a higher build number, so it goes through develop
and a release branch again.
Jenkins does the rest, from the release section of yggdrasil.yml. It refuses a tag whose commit is not on main —
so a build from any other branch is never published as a release; v1.2.2-beta.1 predates the rule. ci/release-build.sh
refuses a tag that is not v followed by the version in pubspec.yaml, pre-release included — a release whose file
names, installer wizard and application each state something different is worth failing a job over. Jenkins publishes
the release on the git server and its GitHub copy, with the section of CHANGELOG.md for the notes.
Then four artifacts, each built where it can be — the Windows installer, the
portable Windows archive, the Linux installer and the APK, listed under
Downloads in the README. The Linux installer and the APK are built on Jenkins’s release
agent by ci/release-build.sh. The two Windows files are built by the GitHub Actions workflow
.github/workflows/release-windows.yml on the GitHub mirror, which Jenkins dispatches with the tag and whose files it
attaches to the release.
The APK is put through the same permission gate the linux check applies (ci/permissions.sh),
against the package that actually ships, and the same is done with its signer
— see below. The analyzer and the suite are run before anything is built,
because a release is not the place to discover the suite is red. Every file of the release
(the Windows ones included) is checksummed into one SHA256SUMS.txt by ci/finalize.sh, Jenkins’s release.finalize
step, which is the only way somebody can tell that what they downloaded is what was built — both desktop installers are
unsigned.
A release that stopped can be finished, and the Windows files rebuilt for a tag, from Jenkins (release-resume
and actions-release).
The Android signing key
Android refuses to install an update whose signer changed. A package signed
with the debug key would therefore be a package nobody can upgrade to: the
runner generates a fresh debug key per run, so every release would carry a
different signer, and an owner would meet the next one as App not installed
with no way forward but uninstalling — losing the library, the statistics and
the settings that an upgrade is supposed to keep.
So the release build signs with a key the project holds, and refuses to
build without one.
1. Make the keystore. Once, and never again. keytool ships with the JDK
that Android Studio installed, so it is already on your machine.
On Windows, in PowerShell:
keytool -genkeypair -v -keystore orpheus-release.jks -alias orpheus `
-keyalg RSA -keysize 4096 -validity 10000 -storetype pkcs12
On Linux or macOS:
keytool -genkeypair -v -keystore orpheus-release.jks -alias orpheus \
-keyalg RSA -keysize 4096 -validity 10000 -storetype pkcs12
It asks for a password, then for a name, an organisation and a country. None of
those answers are checked by anything or shown to anyone; the password is the
part that matters. Write the password down before you press enter — there is
no way to recover it and no way to replace the keystore later.
2. Encode it. The credential holds the file’s bytes as text, because a
Jenkins secret text is a string.
On Windows, which has no base64 command — this writes the file and puts the
same text on your clipboard, ready to paste:
$encoded = [Convert]::ToBase64String([IO.File]::ReadAllBytes("orpheus-release.jks"))
$encoded | Set-Content -NoNewline keystore.base64.txt
$encoded | Set-Clipboard
On Linux or macOS:
base64 -w0 orpheus-release.jks > keystore.base64.txt
Not certutil -encode: it wraps its output in -----BEGIN CERTIFICATE-----
lines, which are not part of the data and will not decode.
3. Give Jenkins four credentials. Manage Jenkins → Credentials → System →
Global credentials, kind Secret text, with the ID exactly as written (they
are the repository’s releaseCredentials in yggdrasil’s catalog.yaml, and
release.build.credentials in yggdrasil.yml binds them to the variables the
build reads, shown in the second column):
| Credential ID | Variable | What to paste into it |
|---|
orpheus-android-keystore | ORPHEUS_KEYSTORE_BASE64 | The entire contents of keystore.base64.txt — one long run of letters, digits, + and /, possibly ending in =. Paste what step 2 put on the clipboard, or open the file and select all. Not the .jks itself: a secret is text. Line breaks in it are harmless, the build strips them. |
orpheus-android-keystore-password | ORPHEUS_KEYSTORE_PASSWORD | The password you typed at Enter keystore password. |
orpheus-android-key-alias | ORPHEUS_KEY_ALIAS | orpheus — whatever followed -alias in the command above. |
orpheus-android-key-password | ORPHEUS_KEY_PASSWORD | The same password again. A PKCS12 keystore holds one password for both; keytool warns and ignores a -keypass that differs from the store password, so there is no second password to give. |
Then delete keystore.base64.txt — it is the keystore in another form, sitting
in the repository directory. .gitignore refuses to commit it, and the .jks
beside it, but neither belongs there once the credential is set.
Back the .jks up somewhere that is not this machine, and keep the
passwords. Losing it cannot be undone by generating another: every owner who
installed a release signed with the old one would have to uninstall first, and
their catalog, statistics and settings would go with it. It is the one file in
this project that has no copy in the repository and cannot be rebuilt from it.
4. The fingerprint. android/signing-sha256.txt holds the SHA-256 fingerprint of the certificate the releases
are signed with (a public value, committed). ci/release-build.sh reads the signer back out of the APK and fails the
release unless it is that one, instead of shipping an update nobody can install. It prints
Signed with SHA-256 <64 hex characters>; if the key is ever replaced on purpose, put the new fingerprint in the file.
ORPHEUS_SIGNING_SHA256 in the environment overrides the file.
Building a signed package locally needs none of that. flutter build apk --release with no key configured falls back to the debug key and works as it
always did — that is only ever a package for your own device. To sign locally,
put android/key.properties beside the module, which android/.gitignore
already refuses to commit:
storeFile=../orpheus-release.jks
storePassword=...
keyAlias=orpheus
keyPassword=...