Refactor containers and library loading

Replace trackPtr with raw Track* pointers in HashTable, add loadLibrary
to PlayerLocal, remove unused File helpers, and fix broken artwork/artist
SQL bindings.
This commit is contained in:
2026-06-22 11:51:27 +02:00
parent 05bd44a354
commit 00c8d9b843
6 changed files with 29 additions and 15 deletions
+3 -3
View File
@@ -53,8 +53,8 @@ class HashTable {
HashTable ( HashTable && ) noexcept = default;
HashTable &operator= ( HashTable && ) noexcept = default;
void ht_insert ( const std::string &key, trackPtr track );
trackPtr ht_lookup ( const std::string &key ) const;
void ht_insert ( const std::string &key, Track* t );
Track* ht_lookup ( const std::string &key ) const;
bool ht_delete ( const std::string &key );
std::vector<std::string> listAll () const;
@@ -72,7 +72,7 @@ class HashTable {
struct Entry {
std::string key;
uint64_t hash = 0;
trackPtr track;
Track* track;
};
// helpers
+1 -3
View File
@@ -12,11 +12,9 @@ class File {
public:
Track importFile( const std::string& filePath );
void scanFolder( const std::string& folderPath, std::vector<Track>& tracks );
void updateLibrary();
void readFileTag( Track& t );
TagLib::VariantMap importArtwork( Track& t );
std::string parseFiletype( const std::string& path );
void updateLibrary();
uint64_t hashString( Track t );
private:
std::string path_;
+5
View File
@@ -9,6 +9,7 @@ class PlayerLocal : public Player {
public:
// Library Controls
void loadFile ( Track track ) override;
void loadLibrary();
void scanLibrary() override;
void updateLibrary() override;
void editMetadata() override;
@@ -30,4 +31,8 @@ class PlayerLocal : public Player {
unsigned int currentTrack_;
db db_;
std::string musicFolder_ = "data/";
ht tracks_;
ht artists_;
ht albums_;
};