Skip to content

Add simple web UI for playlist management#24

Open
Pallesen01 wants to merge 15 commits intomasterfrom
codex/add-web-interface-for-playlist-tracking
Open

Add simple web UI for playlist management#24
Pallesen01 wants to merge 15 commits intomasterfrom
codex/add-web-interface-for-playlist-tracking

Conversation

@Pallesen01
Copy link
Owner

Summary

  • introduce web_interface.py providing a basic Flask web UI
  • persist playlist URLs to playlists.json
  • periodically run playlist_downloader.py for stored lists
  • document web interface usage
  • add Flask to requirements

Testing

  • PAFY_BACKEND=internal python playlist_downloader.py https://open.spotify.com/playlist/37i9dQZF1DXcBWIGoYBM5M --limit 1 > /tmp/test.log 2>&1 && tail -n 20 /tmp/test.log (fails: Resource not found)

https://chatgpt.com/codex/tasks/task_e_68412324c1988325bd5366e4e4e0021d

Pallesen01 added 14 commits June 5, 2025 17:57
…ce to check for credentials

- Introduced `config.json` to store Spotify client ID and secret.
- Added `load_config` function to read configuration from `config.json`.
- Updated the web interface to display a warning if Spotify credentials are not configured.
- Updated import in `playlist_downloader.py` to use relative import for better module management.
- Added project root to Python path in `web_interface.py` to ensure correct script execution.
- Restructured `playlist_downloader.py` to improve readability and maintainability.
- Moved the main logic into a `main()` function for better organization.
- Enhanced the threading mechanism for downloading songs, allowing for better progress tracking and management.
- Updated the progress bar to reflect the current downloading status more accurately.
- Changed the way songs are downloaded to avoid duplicates and ensure a smoother user experience.
- Implemented Spotify client setup and playlist retrieval functionality in `web_interface.py`.
- Enhanced the `add_playlist` and `delete_playlist` functions to handle playlist objects with name and track count.
- Updated the HTML template to display playlist names and track counts, improving user experience.
- Added error handling for invalid Spotify URLs and missing credentials.
- Updated `requirements.txt` to specify exact versions for `spotipy`, `tqdm`, and `Flask`, ensuring compatibility.
- Refactored `playlist_downloader.py` to include configuration loading from `config.json` and improved Spotify client initialization.
- Added functions to manage downloaded songs and download tracks using `spotdl`, enhancing the downloading process.
- Improved progress tracking in the downloader with better status updates and error handling.
- Enhanced the web interface to display download progress and allow stopping the downloader process.
…nchronization

- Added drag-and-drop functionality for reordering playlists in the web interface, allowing users to rearrange their playlists easily.
- Introduced a new endpoint `/reorder` to handle playlist order updates on the server.
- Improved the downloader loop to include a more accurate waiting mechanism for the next sync, providing better user feedback on the status of downloads.
…ack fetching

- Added concurrent downloading of songs using a thread pool, allowing for faster processing of large playlists.
- Improved track fetching logic to handle pagination and provide progress updates during the retrieval of playlist tracks.
- Updated progress bar to reflect the status of downloads more accurately, enhancing user feedback during the download process.
…tracking

- Increased the maximum number of concurrent downloads from 5 to 8 in `playlist_downloader.py`, allowing for faster processing of playlists.
- Added logging for completed song downloads, updating the web interface to reflect the last finished song, enhancing user feedback during the download process.
…erval settings

- Updated the `DownloadProvider` class to use `file_basename` for output file naming, improving consistency in file management.
- Enhanced the `Song` class to build a new folder structure that includes artist and album year, improving organization of downloaded files.
- Introduced a configuration option for setting the sync interval in the web interface, allowing users to customize the download frequency.
- Added a form in the HTML template to change the sync interval, improving user interaction and control over the downloader's behavior.
… download logic

- Added debug print statements in the `Song` class to log initialization and file download events, improving traceability during downloads.
- Refactored the `download_song` function in `playlist_downloader.py` to utilize the `Song` class for better folder structure management and error handling.
- Updated the web interface to ensure proper execution of the downloader subprocess with unbuffered output for real-time logging.
…web interface

- Added user authentication with Spotify using OAuth, allowing users to log in and manage their playlists securely.
- Introduced functions to handle user token storage and retrieval, improving session management.
- Enhanced the web interface with a form for setting the download directory, providing users with more control over file organization.
- Updated the downloader subprocess to utilize the specified download directory, ensuring consistency in file paths.
- Improved the HTML template to reflect user authorization status and facilitate login/logout actions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant