[PR #113] [MERGED] Improve token flow reliability, metadata fallback tagging, and proxy-aware networking #297

Closed
opened 2026-03-13 18:01:58 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/afkarxyz/SpotiDownloader/pull/113
Author: @Laynholt
Created: 2/28/2026
Status: Merged
Merged: 3/11/2026
Merged by: @afkarxyz

Base: mainHead: main


📝 Commits (10+)

  • beb1933 Fix filename template in batch downloads
  • dc10f90 Preserve boundary underscores in sanitized names
  • fe84f4f Merge branch 'main' of https://github.com/afkarxyz/SpotiDownloader
  • 4694338 Add Edge fallback and force browser shutdown after token fetch
  • 7c24a5d Fix batch downloads by auto-fetching and refreshing session token
  • 62d593a Improve genre metadata embedding with multi-source fallbacks
  • ee96786 Add system proxy support for backend HTTP clients
  • b60b0a9 Refine genre sourcing and remove duplicated year metadata
  • 2da7b5d Update ignore and dependency checksum files
  • 32aa88b Fix playlist metadata track number resolution using track ID

📊 Changes

34 files changed (+1548 additions, -481 deletions)

View changed files

📝 .gitignore (+6 -1)
📝 app.go (+7 -2)
backend/chosic_genre.go (+191 -0)
📝 backend/chrome_check.go (+46 -11)
📝 backend/cover.go (+1 -1)
📝 backend/ffmpeg.go (+1 -1)
backend/http_client.go (+35 -0)
📝 backend/lyrics.go (+1 -1)
📝 backend/metadata.go (+8 -1)
📝 backend/musicbrainz.go (+128 -56)
backend/proxy_other.go (+12 -0)
backend/proxy_windows.go (+188 -0)
📝 backend/songlink.go (+131 -15)
📝 backend/spotfetch.go (+95 -20)
📝 backend/spotfetch_api.go (+15 -3)
📝 backend/spotidownloader.go (+66 -5)
📝 backend/spotify_metadata.go (+28 -18)
📝 backend/token_fetcher.go (+8 -3)
📝 backend/uploader.go (+3 -3)
📝 frontend/package.json.md5 (+1 -1)

...and 14 more files

📄 Description

Summary

This PR combines the latest reliability and metadata improvements across token fetching, batch downloads, tagging, networking, and download path handling.

What changed
Added a Windows browser fallback for token extraction:

  • Uses Microsoft Edge when Google Chrome is not available.
  • Closes the temporary browser window immediately after token retrieval.

Fixed first-run batch download behavior when no token exists:

  • Batch downloads now automatically fetch and refresh the session token instead of failing all tracks.

Improved metadata tagging for downloaded tracks:

  • Genre resolution now uses a multi-source fallback chain: MusicBrainz -> Chosic -> Deezer (if previous sources are empty or unavailable).
  • Release year is now correctly parsed and embedded into track metadata tags.
  • Fixed playlist track numbering in embedded tags: track number is now resolved from album metadata (via track ID) instead of defaulting to 1.

Added proxy-aware HTTP behavior for backend requests:

  • Introduced a shared HTTP client/transport across backend network calls.
  • Uses standard proxy environment variables (HTTP_PROXY, HTTPS_PROXY, NO_PROXY).
  • On Windows, falls back to system proxy settings (Internet Settings) when environment variables are not set.

Fixed custom download path handling:

  • Resolved a settings sync issue where downloads could still fall back to the default Music folder even when a custom download directory was configured.
  • Download, lyrics, and cover actions now use the latest persisted settings instead of stale cached values.
  • Prevented token refresh and other partial settings updates from overwriting the configured download path.

Fixed folder structure handling for batch downloads:

  • Download All and Download Selected now respect the configured folder structure template instead of saving everything directly into the playlist root folder.
  • Batch downloads now use the same effective per-track output path logic as single-track downloads.

Fixed release year handling in folder templates:

  • Folder templates using {year} or {date} no longer fall back to 0000 when release metadata is available.
  • Batch downloads now enrich release date metadata when needed so generated folder paths use the correct year.

Cleaned up the download hook implementation:

  • Removed any-based Wails API access in favor of typed imports.
  • Replaced weak typing and empty catches in useDownload.ts to keep the download path logic easier to maintain and safer to extend.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/afkarxyz/SpotiDownloader/pull/113 **Author:** [@Laynholt](https://github.com/Laynholt) **Created:** 2/28/2026 **Status:** ✅ Merged **Merged:** 3/11/2026 **Merged by:** [@afkarxyz](https://github.com/afkarxyz) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (10+) - [`beb1933`](https://github.com/afkarxyz/SpotiDownloader/commit/beb1933522552647c5f37b063543f7b80a2c4f0e) Fix filename template in batch downloads - [`dc10f90`](https://github.com/afkarxyz/SpotiDownloader/commit/dc10f9030715981ac29fc32f31dd673f89b50a2f) Preserve boundary underscores in sanitized names - [`fe84f4f`](https://github.com/afkarxyz/SpotiDownloader/commit/fe84f4f225295962f617f631bfb5d7303eb2d5d3) Merge branch 'main' of https://github.com/afkarxyz/SpotiDownloader - [`4694338`](https://github.com/afkarxyz/SpotiDownloader/commit/46943384b007aa36874569602e340a0fcab08004) Add Edge fallback and force browser shutdown after token fetch - [`7c24a5d`](https://github.com/afkarxyz/SpotiDownloader/commit/7c24a5dd638928c94674886f224f3f508999028d) Fix batch downloads by auto-fetching and refreshing session token - [`62d593a`](https://github.com/afkarxyz/SpotiDownloader/commit/62d593abb17adea40b3dd3b02491ae4236b5af80) Improve genre metadata embedding with multi-source fallbacks - [`ee96786`](https://github.com/afkarxyz/SpotiDownloader/commit/ee96786efe84be63326ee84bfa40e69e450da552) Add system proxy support for backend HTTP clients - [`b60b0a9`](https://github.com/afkarxyz/SpotiDownloader/commit/b60b0a9fa52cd5e59fc463af1b6251ca1ef975d3) Refine genre sourcing and remove duplicated year metadata - [`2da7b5d`](https://github.com/afkarxyz/SpotiDownloader/commit/2da7b5d6b80561f7eb38e98bedc3f0ebfd9b288a) Update ignore and dependency checksum files - [`32aa88b`](https://github.com/afkarxyz/SpotiDownloader/commit/32aa88b554ae4a21c6aa7bf08681b6626be99351) Fix playlist metadata track number resolution using track ID ### 📊 Changes **34 files changed** (+1548 additions, -481 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+6 -1) 📝 `app.go` (+7 -2) ➕ `backend/chosic_genre.go` (+191 -0) 📝 `backend/chrome_check.go` (+46 -11) 📝 `backend/cover.go` (+1 -1) 📝 `backend/ffmpeg.go` (+1 -1) ➕ `backend/http_client.go` (+35 -0) 📝 `backend/lyrics.go` (+1 -1) 📝 `backend/metadata.go` (+8 -1) 📝 `backend/musicbrainz.go` (+128 -56) ➕ `backend/proxy_other.go` (+12 -0) ➕ `backend/proxy_windows.go` (+188 -0) 📝 `backend/songlink.go` (+131 -15) 📝 `backend/spotfetch.go` (+95 -20) 📝 `backend/spotfetch_api.go` (+15 -3) 📝 `backend/spotidownloader.go` (+66 -5) 📝 `backend/spotify_metadata.go` (+28 -18) 📝 `backend/token_fetcher.go` (+8 -3) 📝 `backend/uploader.go` (+3 -3) 📝 `frontend/package.json.md5` (+1 -1) _...and 14 more files_ </details> ### 📄 Description ## Summary This PR combines the latest reliability and metadata improvements across token fetching, batch downloads, tagging, networking, and download path handling. What changed Added a Windows browser fallback for token extraction: - Uses Microsoft Edge when Google Chrome is not available. - Closes the temporary browser window immediately after token retrieval. Fixed first-run batch download behavior when no token exists: - Batch downloads now automatically fetch and refresh the session token instead of failing all tracks. Improved metadata tagging for downloaded tracks: - Genre resolution now uses a multi-source fallback chain: MusicBrainz -> Chosic -> Deezer (if previous sources are empty or unavailable). - Release year is now correctly parsed and embedded into track metadata tags. - Fixed playlist track numbering in embedded tags: track number is now resolved from album metadata (via track ID) instead of defaulting to 1. Added proxy-aware HTTP behavior for backend requests: - Introduced a shared HTTP client/transport across backend network calls. - Uses standard proxy environment variables (`HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY`). - On Windows, falls back to system proxy settings (Internet Settings) when environment variables are not set. Fixed custom download path handling: - Resolved a settings sync issue where downloads could still fall back to the default `Music` folder even when a custom download directory was configured. - Download, lyrics, and cover actions now use the latest persisted settings instead of stale cached values. - Prevented token refresh and other partial settings updates from overwriting the configured download path. Fixed folder structure handling for batch downloads: - `Download All` and `Download Selected` now respect the configured folder structure template instead of saving everything directly into the playlist root folder. - Batch downloads now use the same effective per-track output path logic as single-track downloads. Fixed release year handling in folder templates: - Folder templates using `{year}` or `{date}` no longer fall back to `0000` when release metadata is available. - Batch downloads now enrich release date metadata when needed so generated folder paths use the correct year. Cleaned up the download hook implementation: - Removed `any`-based Wails API access in favor of typed imports. - Replaced weak typing and empty catches in `useDownload.ts` to keep the download path logic easier to maintain and safer to extend. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-13 18:01:58 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SpotiDownloader#297
No description provided.