Nest all platforms under channels_root (was: siblings)
Previously platform_root resolved YouTube to channels_root verbatim and
non-YouTube to siblings under channels_root.parent(). That assumed the
user's library was split across two levels:
/library/yt-offline/ ← config.backup.directory (YouTube)
/library/bandcamp/ ← sibling
/library/tiktok/ ← sibling
In practice users (myself included) keep everything under one umbrella:
/library/yt-offline/
channels/ ← YouTube
bandcamp/
tiktok/
music/
…
Make that the canonical layout. platform_root now returns
channels_root.join(dir_name) for every platform including YouTube
(which keeps its `channels` dir_name for back-compat with existing
on-disk trees that already have the channels/ subdir populated).
library_root is now == channels_root in both app.rs and web.rs — the
two-level concept is gone. The field stays as a distinct name so
file_url() and the /files/ static-file mount keep working without
churn at every call site. music_root and music dir also moved from
channels_root.with_file_name("music") to channels_root.join("music").
Tests in platform.rs updated to the new layout. 74 pass.
Note: this is a breaking change for installs that had the sibling
layout. The fix is to mv the platform dirs into the channels_root.
The next commit walks the user through that for my install.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
4cead6cf93
commit
4f15ab873f
4 changed files with 37 additions and 30 deletions
12
src/web.rs
12
src/web.rs
|
|
@ -2182,13 +2182,11 @@ async fn serve(config: Config, shutdown_rx: std::sync::mpsc::Receiver<()>) {
|
|||
let channels_root = config.backup.directory.clone();
|
||||
let _ = std::fs::create_dir_all(&channels_root);
|
||||
// library_root holds every platform folder side-by-side (channels/,
|
||||
// tiktok/, twitch/, …). The implicit anchor is the parent of the
|
||||
// user-configured channels dir.
|
||||
let library_root = channels_root
|
||||
.parent()
|
||||
.map(|p| p.to_path_buf())
|
||||
.unwrap_or_else(|| channels_root.clone());
|
||||
let _ = std::fs::create_dir_all(&library_root);
|
||||
// tiktok/, twitch/, …). Post-2026-05 layout nests them all under
|
||||
// channels_root, so the two paths are identical. The field is kept
|
||||
// distinct because file_url() and the /files/ static-file mount
|
||||
// still resolve URLs against it as a separate concept.
|
||||
let library_root = channels_root.clone();
|
||||
// Pre-create every platform's folder so the static-file mount can serve
|
||||
// them without 404ing on first access.
|
||||
for &p in crate::platform::Platform::all() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue