14#include <unordered_map>
44 void leftRotate(
Node* x)
69 void rightRotate(
Node* x)
94 void fixInsert(
Node* k)
146 void inorderHelper(
Node* node)
152 inorderHelper(node->
left);
154 if (metadataMap.empty())
157 "Error: No files found matching the inode or no metadata extracted.");
160 for (
const auto& pair : metadataMap)
163 songTree.addSong(
Song(node->
data, pair.second));
165 inorderHelper(node->
right);
174 NIL->left = NIL->right = NIL;
181 new_node->
left = NIL;
182 new_node->
right = NIL;
184 Node* parent =
nullptr;
185 Node* current = root;
187 while (current != NIL)
192 current = current->
left;
196 current = current->
right;
200 new_node->
parent = parent;
202 if (parent ==
nullptr)
206 else if (new_node->
data < parent->
data)
208 parent->
left = new_node;
212 parent->
right = new_node;
215 if (new_node->
parent ==
nullptr)
RedBlackTree()
Definition rbtree.hpp:170
void insert(ino_t data)
Definition rbtree.hpp:178
SongTree returnSongTree()
Definition rbtree.hpp:231
void printSongTree()
Definition rbtree.hpp:230
void inorderStoreMetadata()
Definition rbtree.hpp:229
Represents a hierarchical tree structure to store songs by artist, album, disc number,...
Definition songmap.hpp:78
A class for parsing metadata from audio files.
Definition taglib_parser.h:72
std::unordered_map< std::string, Metadata > parseFromInode(ino_t inode, const std::string &directory)
Parse metadata from files in a directory based on inode.
Definition taglib_parser.h:196
string DEBUG_LOG_PARSE
Definition rbtree.hpp:24
string DIRECTORY_FIELD
Definition rbtree.hpp:22
#define BLACK
Definition rbtree.hpp:20
#define RED
Definition rbtree.hpp:19
Node(ino_t data)
Definition rbtree.hpp:33
ino_t data
Definition rbtree.hpp:29
Node * left
Definition rbtree.hpp:31
Node * parent
Definition rbtree.hpp:31
char color
Definition rbtree.hpp:30
Node * right
Definition rbtree.hpp:31
Represents a song with associated metadata and inode.
Definition songmap.hpp:38
void sendErrMsg(std::string debugLogBoolStr, std::string errMsg)
Sends an error message based on the debug log setting.
Definition taglib_parser.h:117
#define PARENT_DBG
Definition toml_parser.hpp:26
string_view parseTOMLField(string parent, string field)
Parses a string field from the TOML configuration.
Definition toml_parser.hpp:121
#define PARENT_LIB_FIELD_DIR
Definition toml_parser.hpp:19
#define PARENT_LIB
Macros for parent and field names used in the TOML configuration.
Definition toml_parser.hpp:17
#define PARENT_DBG_FIELD_PARSER_LOG
Definition toml_parser.hpp:27