Skip to content

Feature/import playlist - #234

Open
dgloukhman wants to merge 4 commits into
watsonbox:masterfrom
dgloukhman:feature/import-playlist
Open

Feature/import playlist#234
dgloukhman wants to merge 4 commits into
watsonbox:masterfrom
dgloukhman:feature/import-playlist

Conversation

@dgloukhman

Copy link
Copy Markdown

Adds the ability to import Spotify playlists directly from CSV files (both Exportify exports and custom CSVs containing Spotify Track URIs or IDs). Supports single and multi-file selection, pre-import preview with inline editing, track chunking, rate-limited API batching, and full internationalization across all 12 locales. Code has been generated AI-assisted and manually tested for correct functionality.

Key Changes

1. Data Layer & Utilities

  • RFC 4180 CSV Parser (src/utils/csvParser.ts): Robust CSV parsing extracting Track URI, Spotify URI, Track ID, or URI-like fields handling quotes, commas, and multiline values.
  • Rate-Limited API Helper (src/helpers.ts): Wrapped POST requests with the existing Bottleneck limiter to prevent Spotify API rate-limit errors.
  • Playlist Import Service (src/components/data/PlaylistImportService.ts): Creates playlists (POST /v1/me/playlists) and uploads tracks in chunks of 100 (POST /v1/playlists/{id}/items) with sequential processing for multiple files and progress callbacks.
  • OAuth Scopes (src/auth.ts): Added playlist-modify-public and playlist-modify-private scopes.

2. UI Components

  • PlaylistImporter: File picker button supporting single and multi-file drag/select with CSV parsing and error handling.
  • ImportPlaylistModal: Modal dialog displaying an itemized summary of playlists and track counts. Supports inline playlist renaming, per-item removal, and a public/private toggle (defaults to private).
  • PlaylistTable Integration: Placed the Import button in the table toolbar alongside "Export All", displaying live progress badges and completion alerts, invalidating the playlist cache, and resetting pagination upon completion.

3. Internationalization (i18n)

  • Added localized translations for all new strings across all 12 supported languages (ar, de, el, en, es, fr, it, ja, nl, pt, sv, tr).

Test Plan

  • CSV Parser: Verified RFC 4180 compliance, quoted values, column detection, and track URI extraction (csvParser.test.ts).
  • Import Service: Verified single/multi playlist creation, 100-track chunking, progress callbacks, and error reporting (PlaylistImportService.test.ts).
  • UI Components: Verified modal interactions, inline editing, remove actions, and file selection (ImportPlaylistModal.test.tsx, PlaylistImporter.test.tsx).
  • Table Integration: Verified banner alerts, progress feedback, snapshot, and pagination reset (PlaylistTable.test.tsx).
  • Build: npm test (49/49 passing) and npm run build pass cleanly with zero warnings/errors.

dgloukhman added 4 commits August 20, 2026 15:44
- Add playlist-modify-public and playlist-modify-private OAuth scopes
- Add rate-limited apiPost wrapper in helpers
- Register faFileImport icon
- Implement RFC 4180 CSV parser for extracting Spotify track URIs/IDs
- Add cache invalidation method to PlaylistsData
- Implement PlaylistImportService with track batching and multi-playlist support
Add translation strings for import playlist button, modal dialogs, status messages, and errors across Arabic, German, Greek, English, Spanish, French, Italian, Japanese, Dutch, Portuguese, Swedish, and Turkish.
- Add PlaylistImporter supporting single and multi-file CSV selection
- Add ImportPlaylistModal supporting multi-file itemized preview, inline editing, and privacy configuration
- Include unit tests for modal and file importer workflows
…istTable

- Embed PlaylistImporter into PlaylistTable action bar next to Export All
- Display real-time progress and completion/error alerts for imports
- Reset table pagination to page 1 upon successful import
- Update PlaylistTable tests and snapshot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant