Skip to content

Add playlist import/export functionality for JSON and M3U8#28

Open
katagaki wants to merge 5 commits intomainfrom
claude/migrate-swift-data-playlists-wW9qR
Open

Add playlist import/export functionality for JSON and M3U8#28
katagaki wants to merge 5 commits intomainfrom
claude/migrate-swift-data-playlists-wW9qR

Conversation

@katagaki
Copy link
Owner

Summary

This PR adds comprehensive import and export functionality for playlists, supporting both JSON and M3U8 formats. Users can now export playlists to portable formats and import them back, with full localization support across 6 languages.

Key Changes

  • Playlist Import/Export Core Logic: Added toJSON(), importFromJSON(), toM3U8(), and fromM3U8() methods to the Playlist model to handle serialization and deserialization of playlists in both formats
  • PlaylistJSON Structure: Created a new PlaylistJSON codable struct to represent playlists in a portable JSON format with file metadata and ordering information
  • PlaylistsView Import UI: Added import functionality with a document picker that accepts JSON, M3U8, and M3U files, with error handling and user feedback
  • PlaylistDetailView Export UI: Added export menu with options to export as JSON or M3U8, using a share sheet for file distribution
  • ShareSheet Component: Created a new ShareSheet view controller wrapper to enable native iOS sharing functionality
  • Localization: Added 5 new localization keys (Playlists.Export, Playlists.Export.JSON, Playlists.Export.M3U8, Playlists.Import, Playlists.Import.Error) with translations in English, Japanese, Korean, Vietnamese, Simplified Chinese, and Traditional Chinese
  • File Type Support: Implemented support for importing relative paths from M3U8/M3U files while safely skipping absolute paths and URLs

Notable Implementation Details

  • Import/export uses temporary files that are automatically cleaned up after sharing
  • M3U8 format preserves playlist names via #PLAYLIST: metadata and uses relative paths for portability
  • JSON export includes file metadata (name, extension, order) for accurate reconstruction
  • Security-scoped resource access is properly managed during file import operations
  • The import menu is now a dropdown menu alongside the existing create playlist action

https://claude.ai/code/session_014fUoyswmhgqTqc4bjYWAkv

claude added 5 commits March 21, 2026 22:34
- Add PlaylistJSON Codable struct for portable JSON representation
- Add toJSON/importFromJSON methods on Playlist for JSON round-tripping
- Add toM3U8/fromM3U8 methods with relative-paths-only support
- Add export menu (JSON/M3U8) to PlaylistDetailView toolbar
- Add import button to PlaylistsView supporting .json/.m3u8/.m3u files
- Add ShareSheet UIKit wrapper for export sharing
- Add localized strings for export/import UI in all supported languages

https://claude.ai/code/session_014fUoyswmhgqTqc4bjYWAkv
- Remove SwiftData dependency entirely (no @model, @query, modelContainer)
- Playlists are now Codable structs stored as .melodee JSON files in folders
- Use relative file paths instead of URL bookmarks for portability
- Add PlaylistManager with static methods for load/save/create
- Add .playlist file type to FileType enum and FilesystemManager
- Add "+" toolbar button in FolderView to create playlists (Apple Music-style sheet)
- CreatePlaylistSheet with album art, name field, and selectable song list
- Remove Playlists tab from MainTabView (playlists now live in folders)
- Remove PlaylistsView and PlaylistRow (replaced by folder-based browsing)
- PlaylistDetailView now loads from .melodee file with relative path resolution
- Add FBPlaylistFileRow for playlist file navigation in folder browser
- Keep M3U8/JSON export in PlaylistDetailView toolbar
- Add localized strings for SelectAll, Songs in all supported languages

https://claude.ai/code/session_014fUoyswmhgqTqc4bjYWAkv
- '+' button always enabled in FolderView toolbar (no longer requires audio in current folder)
- CreatePlaylistSheet now enumerates all audio files recursively from the scope root
  (On My Device, iCloud Drive, or external folder)
- File selection shows relative path from scope root for disambiguation
- PlaylistManager.create computes proper relative paths from playlist save location
  to each selected file (supports files in subdirectories via ../ paths)
- Add "No Audio Files" empty state in CreatePlaylistSheet
- Add localized strings for NoAudioFiles.Title and NoAudioFiles.Description

https://claude.ai/code/session_014fUoyswmhgqTqc4bjYWAkv
- Remove Japanese メロディー translations from CFBundleDisplayName and
  CFBundleName in InfoPlist.xcstrings
- Replace dynamic CFBundleDisplayName lookups with hardcoded "Melodee"
  in FSFile.swift and MediaPlayerManager.swift
- Replace メロディー with Melodee in Japanese help text strings

https://claude.ai/code/session_014fUoyswmhgqTqc4bjYWAkv
@sonarqubecloud
Copy link

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.

2 participants