-
Notifications
You must be signed in to change notification settings - Fork 38
Add database schema, migrations, and song management enhancements #403
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/4.0.0
Are you sure you want to change the base?
Conversation
- Created a new schema file defining tables for palettes, artworks, albums, songs, artists, genres, playlists, and related entities. - Implemented a seeding script to populate the database with initial data for palettes, swatch types, artworks, albums, artists, genres, songs, and listening data. - Added a journal metadata file to track database versioning and changes.
- Updated the `schema.ts` file to introduce new enums for artwork sources and swatch types. - Added new tables: `artists`, `songs`, `artworks`, `palettes`, `play_events`, `seek_events`, `skip_events`, and their respective relationships. - Removed deprecated fields and adjusted primary keys and foreign key constraints for better normalization. - Created a new SQL migration file to reflect the updated schema, including type definitions and table structures. - Ensured all foreign key relationships are properly defined to maintain data integrity.
…ean up unused imports in main.ts and filesystem.ts
- Updated `parseFolderStructuresForSongPaths.ts` to fetch folder structures from the database asynchronously. - Changed logging levels in `logger.ts` from 'verbose' to 'debug'. - Enhanced `artworks.ts` to include new artwork properties and adjusted the artwork storage logic. - Modified `parseSong.ts` to handle bitrate calculations and temporarily set artwork IDs to a default value. - Added SQL schema for new tables and types related to artworks, albums, artists, and genres. - Implemented folder queries in `folders.ts` to retrieve folder structures and all folders from the database. - Generated route tree for the application with updated routes and types.
- Update song path handling in addMusicFromFolderStructures - Introduce linkArtworksToSong function for artwork associations - Add getAllSongs query for retrieving all songs - Implement folder structure saving and retrieval improvements - Refactor song parsing to include folder ID - Extend type definitions for saved folder structures
…ngs for sorting options
…ndling in SongsPage component
- upgraded dotenv from ^16.5.0 to ^17.0.1 - upgraded @types/jest from ^29.5.12 to ^30.0.0 - upgraded @types/node from ^22.13.4 to ^24.0.10 - upgraded electron-vite from ^3.1.0-beta.0 to ^4.0.0 - upgraded jest from ^29.7.0 to ^30.0.4 - upgraded material-symbols from ^0.31.1 to ^0.32.0 - upgraded vite from ^6.1.1 to ^7.0.2
…r song artworks and enhance song retrieval by path
… formatting across multiple files
…rk parsing and query options
…and updated song and artwork tables Home Page 🏠 The home page's load time improved by 99.44%, going from 1.418s to 0.008s. This means the page now loads approximately 177 times faster. Songs Page 🎵 The songs page's load time improved by 90.75%, decreasing from 1.471s to 0.136s. This makes the page approximately 10.8 times faster than before.
…ded a temperary fix for electron song steaming issues
…log reference handling
…pendencies, and remove MusixmatchSettingsPrompt component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 163 out of 170 changed files in this pull request and generated 8 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
navigate({ | ||
search: (prev) => ({ | ||
...prev, | ||
sortingOrder: e.currentTarget.value as AlbumSortTypes |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type mismatch: casting to AlbumSortTypes
when it should be GenreSortTypes
for genres page.
sortingOrder: e.currentTarget.value as AlbumSortTypes | |
sortingOrder: e.currentTarget.value as GenreSortTypes |
Copilot uses AI. Check for mistakes.
userSettings.useSystemTheme && | ||
userSettings.isDarkMode && |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic error: Light theme should be selected when !userSettings.isDarkMode
, not when both useSystemTheme
and isDarkMode
are true.
Copilot uses AI. Check for mistakes.
value="lightTheme" | ||
id="lightThemeRadioBtn" | ||
defaultChecked={!theme.useSystemTheme && !theme.isDarkMode} | ||
defaultChecked={userSettings.useSystemTheme && userSettings.isDarkMode} |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic error: Light theme radio button should be checked when !userSettings.useSystemTheme && !userSettings.isDarkMode
.
defaultChecked={userSettings.useSystemTheme && userSettings.isDarkMode} | |
defaultChecked={!userSettings.useSystemTheme && !userSettings.isDarkMode} |
Copilot uses AI. Check for mistakes.
userSettings.useSystemTheme && | ||
userSettings.isDarkMode && |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic error: Dark theme should be selected when !userSettings.useSystemTheme && userSettings.isDarkMode
.
Copilot uses AI. Check for mistakes.
value="darkTheme" | ||
id="darkThemeRadioBtn" | ||
defaultChecked={!theme.useSystemTheme && theme.isDarkMode} | ||
defaultChecked={userSettings.useSystemTheme && userSettings.isDarkMode} |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic error: Dark theme radio button should be checked when !userSettings.useSystemTheme && userSettings.isDarkMode
.
defaultChecked={userSettings.useSystemTheme && userSettings.isDarkMode} | |
defaultChecked={!userSettings.useSystemTheme && userSettings.isDarkMode} |
Copilot uses AI. Check for mistakes.
|
||
const imgRef = useRef<HTMLImageElement>(null); | ||
const imgPropsRef = useRef<ImgProperties>(); | ||
const imgPropsRef = useRef<ImgProperties>(null); |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type error: useRef<ImgProperties>()
should be initialized with undefined
instead of null
since ImgProperties
is not a nullable type.
const imgPropsRef = useRef<ImgProperties>(null); | |
const imgPropsRef = useRef<ImgProperties>(undefined); |
Copilot uses AI. Check for mistakes.
|
||
const fetchRecentlyPlayedSongs = async ( | ||
noOfRecentlyAddedSongCards: number | ||
): Promise<SongData[]> => []; | ||
const fetchRecentSongArtists = async ( | ||
noOfRecentlyAddedArtistCards: number | ||
): Promise<Artist[]> => []; |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Empty placeholder functions should have TODO comments explaining their intended implementation or be removed if not needed.
const fetchRecentlyPlayedSongs = async ( | |
noOfRecentlyAddedSongCards: number | |
): Promise<SongData[]> => []; | |
const fetchRecentSongArtists = async ( | |
noOfRecentlyAddedArtistCards: number | |
): Promise<Artist[]> => []; | |
// TODO: Implement logic to fetch recently played songs from the backend or local storage. | |
const fetchRecentlyPlayedSongs = async ( | |
noOfRecentlyAddedSongCards: number | |
): Promise<SongData[]> => []; | |
// TODO: Implement logic to fetch recent song artists from the backend or local storage. | |
const fetchRecentSongArtists = async ( | |
noOfRecentlyAddedArtistCards: number | |
): Promise<Artist[]> => []; | |
// TODO: Implement logic to fetch most loved songs from the backend or local storage. |
Copilot uses AI. Check for mistakes.
if (this.isKnownSource) | ||
window.api.audioLibraryControls.updateSongListeningData(this.songId, 'fullListens', 1); | ||
// if (this.isKnownSource) | ||
// window.api.audioLibraryControls.updateSongListeningData(this.songId, 'fullListens', 1); |
Copilot
AI
Sep 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented-out code should be removed rather than left in the codebase. If this logic is intentionally disabled, add a comment explaining why.
// window.api.audioLibraryControls.updateSongListeningData(this.songId, 'fullListens', 1); |
Copilot uses AI. Check for mistakes.
- Refactored getStorageUsage to include database size in storage metrics. - Added getDatabaseMetrics function to fetch counts of songs, artists, albums, genres, and playlists. - Updated IPC handlers to support fetching database metrics. - Integrated database metrics into the StorageSettings component. - Modified various settings components to use onSettled instead of onSuccess for mutation callbacks. - Cleaned up unused state and effects in StorageSettings and AppStats components. - Updated type definitions to include new database metrics. - Added translations for new database metrics in the localization files.
…s to latest versions
- Updated AllSongResults component to use VirtualList for better performance and added scrollTopOffset prop. - Simplified SearchStartPlaceholder by removing unnecessary query options and directly using searchQuery. - Enhanced VirtualizedList to support debounced scrolling and improved item rendering. - Fixed search query parameter order in search.ts. - Added new routes for Favorites and History playlists in routeTree. - Implemented UI for Favorites and History playlists in HomePage. - Refactored SongsPage to utilize VirtualList and improved state management. - Created new components for Favorites and History playlists with basic structure. - Added tsr.config.json for route generation configuration.
- Updated song filter types to include 'favorites' and 'nonFavorites'. - Implemented new functionality to retrieve all songs from history with pagination and sorting options. - Added IPC handlers for fetching all history songs and integrated them into the renderer. - Enhanced the UI for favorites and history playlists, including sorting and queue management. - Refactored database queries for albums, artists, genres, playlists, and songs to improve type safety and consistency. - Updated localization files to include new filter options and playlist titles.
- Added unique IDs to various settings containers in the SettingsPage components to facilitate easier navigation and linking within the application. - Updated the `OtherSongControlsContainer` to use the new IDs for navigating to specific settings sections.
- Updated the `_journal.json` to reflect the latest version timestamp. - Changed the way blacklisted songs are identified in `convert.ts` and `sendAudioData.ts` by using `song.isBlacklisted` instead of `song.blacklist`. - Refactored `blacklistFolders.ts` to use async/await and improved logic for adding folders to the blacklist. - Removed references to the old blacklist tables in `folders.ts`, `history.ts`, `search.ts`, and `songs.ts`. - Updated the database schema to include `isBlacklisted` fields in `musicFolders` and `songs` tables. - Removed the `songBlacklist` and `folderBlacklist` tables and their associated relations. - Cleaned up the `filesystem.ts` by removing unused user data handling and listening data management. - Adjusted migration scripts to remove user data migrations and ensure compatibility with the new schema. - Updated `removeSongsFromLibrary.ts` to eliminate references to listening data, streamlining the removal process.
- Deleted `isLatestVersion.test.ts` and `parseLyrics.test.ts` from the main tests directory. - Added new test files for `parseLyrics` and `hasDataChanged` in the appropriate subdirectories. - Updated `tsconfig.test.json` to include path mappings for better module resolution. - Implemented comprehensive tests for `hasDataChanged` and `isLatestVersion` with various version comparison scenarios.
…graphy components for improved styling
…croll handling and improved props
- Removed unused functions and imports related to artwork management in addArtworkToAPlaylist.ts. - Simplified the process of adding artwork to playlists by directly linking artwork to playlists in the database. - Updated addNewPlaylist.ts to import linkArtworkToPlaylist from the correct module. - Refactored clearSongHistory.ts to utilize clearFullSongHistory from the database queries. - Streamlined removeFromFavorites.ts by directly updating song favorite statuses in the database. - Enhanced sendAudioData.ts to use a new function for parsing artwork data for audio player. - Modified sendAudioDataFromPath.ts to improve song data retrieval and artwork handling. - Updated sendSongId3Tags.ts to fetch song data using a new database query for ID3 tags. - Added new database queries for linking artworks to playlists and clearing song history. - Improved song re-parsing logic in reParseSong.ts to utilize database queries for song data. - Updated TypeScript types to reflect changes in song tags structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 185 out of 209 changed files in this pull request and generated 6 comments.
Comments suppressed due to low confidence (1)
src/renderer/src/components/VirtualizedList.tsx:1
- The useRef should be initialized with undefined or {} instead of null for object types. TypeScript expects ImgProperties | undefined, not ImgProperties | null.
import { type CSSProperties, type ReactNode, forwardRef } from 'react';
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
import { queryOptions, useSuspenseQuery } from '@tanstack/react-query'; | ||
import { queryClient } from '@renderer/index'; | ||
import { songQuery } from '@renderer/queries/songs'; | ||
import { artistQuery } from '@renderer/queries/aritsts'; |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'aritsts' to 'artists'.
import { artistQuery } from '@renderer/queries/aritsts'; | |
import { artistQuery } from '@renderer/queries/artists'; |
Copilot uses AI. Check for mistakes.
@@ -0,0 +1,50 @@ | |||
import { createQueryKeys } from '@lukemorales/query-key-factory'; |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File name should be 'artists.ts' instead of 'aritsts.ts'.
Copilot uses AI. Check for mistakes.
console.warn(`User listened to 90% of ${this.songId}`); | ||
if (this.isKnownSource) | ||
window.api.audioLibraryControls.updateSongListeningData(this.songId, 'fullListens', 1); | ||
// if (this.isKnownSource) |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider removing commented-out code or adding a TODO comment explaining why this logic is disabled.
// if (this.isKnownSource) | |
// if (this.isKnownSource) | |
// TODO: Enable the following line when song listening data updates are ready to be tracked. |
Copilot uses AI. Check for mistakes.
type Props = { | ||
searchInput: string; | ||
searchResults: SearchResult; | ||
searchResults?: SearchResult; |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making searchResults optional changes the component's API contract. Ensure all callers handle the undefined case properly.
Copilot uses AI. Check for mistakes.
}, [songIds]); | ||
const { data: playlists } = useSuspenseQuery({ | ||
...playlistQuery.all({ sortType: 'aToZ' }), | ||
select: (data) => data.data |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The component expects playlists to have isSelected property but the query doesn't provide this. This will cause runtime errors when accessing playlist.isSelected.
select: (data) => data.data | |
select: (data) => data.data.map((playlist) => ({ ...playlist, isSelected: false })) |
Copilot uses AI. Check for mistakes.
return `hsl(${hsl[0] * 360} ${hsl[1] * 100}% ${hsl[2] * 100}%)`; | ||
} | ||
return 'hsl(0 0% 0%)'; | ||
return undefined; |
Copilot
AI
Oct 7, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning undefined for background color may cause CSS issues. Consider returning a default color or empty string.
return undefined; | |
return ''; |
Copilot uses AI. Check for mistakes.
…work removal process - Implemented `deleteArtworks` and `updateArtwork` functions in the artworks query module. - Updated the artwork management logic to include a new `removeArtworks` function that deletes artworks from the database and filesystem. - Refactored the `storeArtworks` function to improve error handling and artwork storage. - Modified the search results handling in the main player search component to utilize React Query for data fetching. - Removed obsolete state management and effects related to search results, streamlining the component's logic.
refactor: enhance AppearanceSettings component with optimistic updates for theme changes feat: add settings mutation for changing app theme
…and error handling. Disabled biome.
…efactor theme-related components and remove obsolete user data handling
… loader and pending components
…ctions; add new comprehensive tests for parseLyrics and restore hasDataChanged and isLatestVersion tests with updated structures. Update TypeScript configuration files to enable source maps for better debugging.
Introduce a new database schema with initial data seeding, refactor migration scripts, and enhance song and artwork management functionalities. Improve folder structure handling, logging, and dependency updates while ensuring data integrity and performance optimizations.