inLimbo
TUI Music Player that keeps you in Limbo.
 
Loading...
Searching...
No Matches
main.cpp File Reference

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.
 

Function Documentation

◆ handleArguments()

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.

Parameters
argcThe number of command line arguments.
argvThe array of command line arguments.
Returns
The Paths structure containing the paths for the configuration, library binary, and cache directory.

◆ loadOrProcessSongTree()

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.

Parameters
libBinPathThe path to the library binary directory.
directoryPathThe path to the directory containing the music files.
Returns
The processed or loaded SongTree object.

◆ main()

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.

Parameters
argcThe number of command line arguments.
argvThe array of command line arguments.
Returns
0 if the music player runs successfully, or 1 if an error occurs.

◆ runMusicPlayer()

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.

Parameters
song_treeThe SongTree object containing the music library.
Returns
0 if the music player runs successfully, or 1 if an error occurs.