#include "./arg-handler.hpp"
#include "./ui/keymaps.hpp"
#include "dirsort/inode_mapper.hpp"
#include "signal/signalHandler.hpp"
#include "ui/ui_handler.hpp"
Functions | |
auto | handleArguments (int argc, char *argv[]) -> ArgumentHandler::Paths |
Handles the command line arguments. | |
auto | loadOrProcessSongTree (const string &libBinPath, const string &directoryPath) -> SongTree |
Loads or processes the song tree from the given directory. | |
auto | runMusicPlayer (SongTree &song_tree) -> int |
Runs the music player with the provided song tree. | |
auto | main (int argc, char *argv[]) -> int |
The main entry point of the program. | |
auto handleArguments | ( | int | argc, |
char * | argv[] ) -> ArgumentHandler::Paths |
Handles the command line arguments.
This function processes the command line arguments and sets the appropriate paths for configuration, library binary, and cache directory. It returns a Paths
structure containing the necessary paths for the program's operation.
argc | The number of command line arguments. |
argv | The array of command line arguments. |
Paths
structure containing the paths for the configuration, library binary, and cache directory. auto loadOrProcessSongTree | ( | const string & | libBinPath, |
const string & | directoryPath ) -> SongTree |
Loads or processes the song tree from the given directory.
This function attempts to load a previously cached song tree from a file. If the song tree cannot be loaded, it processes the directory to generate a new song tree, stores it in a red-black tree structure, and saves the tree to a file for future use.
libBinPath | The path to the library binary directory. |
directoryPath | The path to the directory containing the music files. |
SongTree
object. auto main | ( | int | argc, |
char * | argv[] ) -> int |
The main entry point of the program.
This is the main function that initializes signal handling, parses command line arguments, processes the song tree, and runs the music player. It also measures the time taken for the inode insertion and mapping process and prints the duration to the console.
argc | The number of command line arguments. |
argv | The array of command line arguments. |
auto runMusicPlayer | ( | SongTree & | song_tree | ) | -> int |
Runs the music player with the provided song tree.
This function initializes the music player with the provided song tree, keybinds, and color settings, and then runs the player. If any exceptions are encountered, an error message is displayed, and the program exits with a non-zero code.
song_tree | The SongTree object containing the music library. |