docs: document packages, exported API and non-obvious logic

This commit is contained in:
Mathis Maquenne
2026-08-06 13:04:10 +02:00
parent 5dfd832d0d
commit b1ad9b4904
41 changed files with 757 additions and 7 deletions
+12
View File
@@ -6,6 +6,18 @@ import (
"github.com/mathismqn/godeez/internal/fsutil"
)
// shouldSkipDownload reports whether trackID has already been downloaded at
// mediaFormat, returning the path of the existing file.
//
// A recorded download at a different quality is not a skip: asking for flac
// after previously fetching mp3_128 should download again.
//
// When the recorded path is gone the file may simply have been moved or
// renamed by the user, so the content hash is used to look for it elsewhere
// under the output directory before giving up. A match repairs the stored
// path, which keeps the ledger useful across library reorganisations. That
// lookup is best effort throughout: every failure falls through to
// downloading again, which is always safe.
func (d *Downloader) shouldSkipDownload(ctx context.Context, trackID, mediaFormat string) (string, bool) {
existing, err := d.store.DownloadInfo(trackID)
if err != nil || existing.Quality != mediaFormat {