feat(train): the marked playlists downloaded by a WorkManager job, the app open or not (ADR 0030, D52)
The app reads the playlists as before and hands the missing tracks to MusicWorker.kt, which runs every 6 hours and once whenever the list changes, on unmetered networks with the battery and storage not low. MusicFetcher.kt downloads each with the token from JellyfinTokens, works out its tempo and appends a line to fetched.txt, which the app takes in as it opens and as each track comes. The app's own download is gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
parent
6bde74f0ba
commit
409a2519f9
1 changed files with 830 additions and 207 deletions
|
|
@ -1348,6 +1348,26 @@ Strava. What was found, 27 Oct:
|
|||
over the music channel and moves a token the keyring holds under
|
||||
`train_jellyfin:` over as it is first read; keeping one, and forgetting others',
|
||||
clears the keyring's too.
|
||||
- Built: 14b. `MusicDownloads` reads the playlists as before and hands the tracks
|
||||
not yet downloaded, or without a tempo worked out, to `MusicPlatform.schedule`
|
||||
(`MusicJob`: the person, their music folder, the server, Jellyfin's
|
||||
`Authorization` header without the token, and each track's path), none where no
|
||||
one is signed in or nothing is missing. `MusicWorker.kt` keeps the list in the
|
||||
no-backup folder's `music_background.json` and enqueues a periodic run of 6 hours
|
||||
and a run now, both unique and kept where one waits, under WorkManager's
|
||||
unmetered network, battery and storage constraints; one run at a time in the
|
||||
process (a mutex), which reads the list again as it ends and runs again where it
|
||||
changed. `MusicFetcher.kt` (tested on the JVM against a server of the test's own)
|
||||
downloads each track through a part file, adds the token from `JellyfinTokens`,
|
||||
works out its tempo with `MusicBridge.of`, and appends a line to the folder's
|
||||
`fetched.txt`, skipping what a line names already; a refused token stops the run,
|
||||
a server out of reach has WorkManager try again later, a track the server fails is
|
||||
left for the next run. The app takes the lines in as it opens and resumes, and as
|
||||
`…/music/fetched` says one came while it listens (the file renamed first, so a
|
||||
line written meanwhile lands in the next); a track no longer kept has its file
|
||||
deleted. The app's own download (`JellyfinClient.download`) is gone, and so is
|
||||
the tempo over the channel. Not tried on a phone: WorkManager's runs, the
|
||||
downloads of large files over HttpURLConnection.
|
||||
|
||||
## Consequences
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue