Add sync command #9
Loading…
Reference in a new issue
No description provided.
Delete branch "3-sync-command"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #3
Adds
sync, the second half of the download/sync split: reads saved playlist metadata from.jellyfin-meta/(no Jellyfin call needed), sanitizes filenames for filesystem safety, and materializes ajellyfin/subfolder on a target directory (e.g. an MP3 player mount point) containing the sanitized mp3s plus correct.m3uplaylists.lib/sync.ts:computeSongRelPaths,computeDesiredFiles,computeDesiredPlaylistFiles,diffDesiredVsExisting(copy/delete/prune), andsyncToTarget(with an injectableconfirmFn)..m3ufiles..m3uon the target no longer part of the synced set triggers a single confirmation prompt (listing all stale playlists) before any copy/delete/write; declining aborts the whole sync with zero filesystem changes.lib/m3uWriter.tsrefactored to exposebuildM3UContent(), shared by bothdownload'swriteM3UFileandsync.index.ts: newsynccommand,SYNC_TARGETenv-var-or-prompt resolution.Targets
2-download-command(PR #8) per the stacked-PR rule in CONTRIBUTING.md, since #1 (PR #7) and #2 (PR #8) have not merged yet.Verified with a throwaway (uncommitted) script against fake in-memory playlist/song data and scratch directories — no live Jellyfin server or real device involved. This surfaced and fixed one bug in the original plan draft: pruning now-empty directories used
fs.rm(dir, { recursive: false }), which throws on any directory regardless of emptiness in Node and was being silently swallowed by a catch; switched tofs.rmdir(), which correctly removes empty directories.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.