5#include <ftxui/component/component.hpp>
8#include <unordered_map>
54 std::unordered_map<std::string, std::string>
112 vector<string> lines;
113 std::string currentLine;
114 bool insideSquareBrackets =
false;
115 bool insideCurlBrackets =
false;
116 bool lastWasUppercase =
false;
117 bool lastWasSpecialChar =
false;
118 char previousChar =
'\0';
122 if (c ==
'[' || c ==
'(')
124 if (!currentLine.empty())
126 lines.push_back(currentLine);
130 insideSquareBrackets =
true;
132 insideCurlBrackets =
true;
137 if (insideSquareBrackets || insideCurlBrackets)
140 if (c ==
']' && insideSquareBrackets)
142 lines.push_back(currentLine);
144 insideSquareBrackets =
false;
147 else if (c ==
')' && insideCurlBrackets)
149 lines.push_back(currentLine);
151 insideCurlBrackets =
false;
156 if (c ==
'\'' || c ==
'-')
159 lastWasSpecialChar =
true;
163 if (std::isupper(c) && !lastWasUppercase && !lastWasSpecialChar && !currentLine.empty() &&
164 previousChar !=
'\n' && previousChar !=
' ')
166 lines.push_back(currentLine);
174 if (!currentLine.empty())
176 lines.push_back(currentLine);
181 lastWasUppercase = std::isupper(c);
182 lastWasSpecialChar =
false;
186 if (!currentLine.empty())
188 lines.push_back(currentLine);
192 lines.erase(std::remove_if(lines.begin(), lines.end(),
193 [](
const std::string& line) { return line.empty(); }),
Implements the Trie (Prefix Tree) data structure.
Definition trie.hpp:47
Definition image_view.cpp:17
Holds the components used for rendering the UI.
Definition state.hpp:22
Component songs_queue_comp
Definition state.hpp:25
Component audioDeviceMenu
Definition state.hpp:29
Component lyrics_scroller
Definition state.hpp:26
Component artists_list
Definition state.hpp:23
Component MainRenderer
Definition state.hpp:27
Component songs_list
Definition state.hpp:24
Component ThumbnailRenderer
Definition state.hpp:28
Represents the current state of the song being played.
Definition state.hpp:40
std::string filePath
Definition state.hpp:56
unsigned int year
Definition state.hpp:49
unsigned int track
Definition state.hpp:50
int bitrate
Definition state.hpp:48
unsigned int discNumber
Definition state.hpp:51
auto HasComments() -> bool
Checks if the song has comments.
Definition state.hpp:100
std::unordered_map< std::string, std::string > additionalProperties
Definition state.hpp:55
std::string genre
Definition state.hpp:43
bool has_lyrics
Definition state.hpp:46
bool has_comment
Definition state.hpp:45
auto HasLyrics() -> bool
Checks if the song has lyrics.
Definition state.hpp:92
std::string album
Definition state.hpp:44
auto formatLyrics() -> vector< string >
Formats the lyrics into a vector of strings.
Definition state.hpp:110
int duration
Definition state.hpp:47
std::string lyrics
Definition state.hpp:52
std::string title
Definition state.hpp:42
void copyMetadata(const Metadata &metadata)
Copies the metadata from a given Metadata object.
Definition state.hpp:66
std::string artist
Definition state.hpp:41
std::string comment
Definition state.hpp:53
Represents the state of the song queue.
Definition state.hpp:227
void insertSongToIndex(const Song &newSong)
Inserts a song at the current index in the queue.
Definition state.hpp:262
void qPush(const Song &song)
Pushes a song to the end of the queue.
Definition state.hpp:273
vector< string > song_queue_names
Definition state.hpp:229
void incrementQIndex()
Increments the queue index.
Definition state.hpp:248
void UpdateSongQueueList()
Updates the list of song names in the queue.
Definition state.hpp:310
void clearQueue()
Clears the song queue.
Definition state.hpp:238
void qPopIndex()
Pops the song at the current screen index from the queue.
Definition state.hpp:279
vector< Song > song_queue
Definition state.hpp:228
void decrementQIndex()
Decrements the queue index.
Definition state.hpp:254
auto getQueueSize() -> int
Returns the current size of the song queue.
Definition state.hpp:287
int qScreenIndex
Definition state.hpp:231
auto GetCurrentSongFromQueue() -> Song *
Retrieves the current song from the queue.
Definition state.hpp:295
int qIndex
Definition state.hpp:230
Holds the state for searching artists and songs.
Definition state.hpp:209
string input
Definition state.hpp:214
Trie SongSearchTrie
Definition state.hpp:211
int songIndex
Definition state.hpp:213
Trie ArtistSearchTrie
Definition state.hpp:210
int artistIndex
Definition state.hpp:212
int albumsIndex
Definition state.hpp:215
mutex mtx
Definition state.hpp:216
Represents a song with associated metadata and inode.
Definition songmap.hpp:46