Skip to content

Commit

Permalink
[MED] ALPHA 2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
nots1dd committed Feb 1, 2025
1 parent 535c89f commit 8180b50
Show file tree
Hide file tree
Showing 25 changed files with 909 additions and 413 deletions.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -955,3 +955,38 @@ Medium commit with some refactoring and small, nice QOL changes
- Fixing current_position bug when run refresh thread is woken up a lot of times (BIG)

---

## [ALPHA 2.9] --- 01-02-2025

### Added
- Trie `src/helpers/trie.hpp` --> For efficient string search

- Powerful and neat string search for artists (songs does not work atm) with next and previous search match (circular match)

### Changed
- Every header now uses `#pragma once` instead of `#ifndef` (idk why i was doing that)

- Overall refactor / code change to most headers

- Added 2 new debug parser logs (keybinds and colors)

- Much better UI for Song Info screen

- Readme changes to explain the default keybinds and their use

### Fixed
- Centered the Image View component in Song Info Screen

### Removed
- setDevice in MiniAudioPlayer (will add in future but not the priority right now)

Medium commit with some refactoring and neat changes, getting to better UI and codebase maybe

### Known Issues to fix in immediate commits
- Holding the keybind for PlayNextSong() / PlayPrevSong() doesnt break anything, but MiniAudioPlayer class is not as responsive as the UI, so it lags behind (MAJOR ISSUE)

(The outcome of the above issue would be that if you hold PlayNextSong() func call and it goes to Song A, the MiniAudioPlayer might still be playing Song B, which appears BEFORE Song A)

- Fixing current_position bug when run refresh thread is woken up a lot of times (BIG)

---
143 changes: 119 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,43 +116,31 @@ Check out [BUILD.md](https://github.com/nots1dd/inLimbo/blob/main/BUILD.md) for
> To try debug build check out [DEBUGGING](https://github.com/nots1dd/inLimbo?tab=readme-ov-file#debugging)
>
## DEBUGGING
## **GETTING STARTED**

inLimbo is in active development and is prone to having *A LOT* of issues

-> Makefile also allows for building and running of a debug build.

To try out **DEBUG BUILD** to find bugs/issues:

1. Debug build with `AddressSanitizer` (ASan):
To get started:

```bash
mkdir build-dbg/
cd build-dbg/
cmake -DCMAKE_BUILD_TYPE=Debug-ASan ..
make
./inLimbo-DBG-Asan
inLimbo # or wherever you have built the binary
```

2. Debug build with `Thread Sanitizer` (TSan):
To get help regarding the command-line arguments available with inLimbo:

```bash
mkdir build-dbg/
cd build-dbg/
cmake -DCMAKE_BUILD_TYPE=Debug-TSan ..
make
./inLimbo-Debug-Tsan
inLimbo --help
```

The **DEBUG BUILD** will account for the following issues:
If you update the songs directory in `config.toml`, inLimbo binary will not automatically change the directory and remove the static serialized `lib.bin` from which it loads the song map from.

-> Threads
You need to run:

-> Address Sanitation (ASan)
```bash
inLimbo --update-cache-run # will load the directory dynamically everytime (will have slower song map times of course)
```

-> Undefined Behaviour Sanitation (UBSan)
That should help with everything.

## CONFIGURATION
## **CONFIGURATION**

There is quite a lot to configure in the inLimbo project. A basic config file will be setup in your `$HOME/.config/inLimbo/` directory while using CMake to build

Expand All @@ -175,10 +163,117 @@ There is quite a lot to configure in the inLimbo project. A basic config file wi
> For TrueColors, check out [COLORS](https://github.com/nots1dd/inLimbo/blob/main/COLORS.md) for more information on how to set up colors in `inLimbo`
>
**DEFAULT KEYBINDS**

### **General Navigation**
| Keybind | Action |
|---------|--------|
| `q` | **Quit the application** |
| `Tab` | **Toggle focus** between the "Artists" and "Songs" panes |
| `?` | **Show or hide the help menu** |
| `/` | **Open the search menu** |

---

### **Scrolling and Selection**
| Keybind | Action |
|---------|--------|
| `j` | **Scroll down** (move selection down in the list) |
| `k` | **Scroll up** (move selection up in the list) |
| `0` | **Move to the next search result** (if search is active) |
| `9` | **Move to the previous search result** (if search is active) |

---

### **Playback Controls**
| Keybind | Action |
|---------|--------|
| `Space` | **Toggle play/pause** for the currently playing song |
| `Enter` | **Play the currently selected song** |
| `n` | **Play the next song** in the queue |
| `p` | **Play the previous song** in the queue |
| `r` | **Replay the current song** |
| `m` | **Toggle mute** on/off |

---

### **Seeking and Volume Control**
| Keybind | Action |
|---------|--------|
| `h` | **Seek backward by 5 seconds** |
| `l` | **Seek forward by 5 seconds** |
| `=` | **Increase volume** |
| `-` | **Decrease volume** |
| `w` | **Toggle between available audio devices** |

---

### **Song and Queue Management**
| Keybind | Action |
|---------|--------|
| `a` | **Add the currently selected song to the queue** |
| `e` | **Add all songs of the selected artist to the queue** |
| `b` | **Play this song next** (insert it into the queue immediately after the current song) |
| `d` | **Remove the currently selected song from the queue** |
| `3` | **View the current song queue** |

---

### **Song Information and UI Navigation**
| Keybind | Action |
|---------|--------|
| `1` | **Go to the main UI screen** |
| `2` or `L` | **View lyrics of the currently playing song** |
| `i` | **View detailed information about the current song** |

---

### **Status Bar & UI Settings**
| Keybind | Action |
|---------|--------|
| `true/false` (UI setting) | **Show or hide bitrate information** in the status bar |


<div align="center">
<img src="assets/gifs/inLimbo-2.gif" alt="inLimbo Demo GIF" width="600">
</div>

## **DEBUGGING**

inLimbo is in active development and is prone to having *A LOT* of issues

-> Makefile also allows for building and running of a debug build.

To try out **DEBUG BUILD** to find bugs/issues:

1. Debug build with `AddressSanitizer` (ASan):

```bash
mkdir build-dbg/
cd build-dbg/
cmake -DCMAKE_BUILD_TYPE=Debug-ASan ..
make
./inLimbo-DBG-Asan
```

2. Debug build with `Thread Sanitizer` (TSan):

```bash
mkdir build-dbg/
cd build-dbg/
cmake -DCMAKE_BUILD_TYPE=Debug-TSan ..
make
./inLimbo-Debug-Tsan
```

The **DEBUG BUILD** will account for the following issues:

-> Threads

-> Address Sanitation (ASan)

-> Undefined Behaviour Sanitation (UBSan)

## DIRECTORY SORTING

To know more about inLimbo Project's logical flow on creating a song map, visit [SONGMAP](https://github.com/nots1dd/inLimbo/blob/main/src/dirsort/SONGMAP.md)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.8 - ALPHA
2.9 - ALPHA
7 changes: 2 additions & 5 deletions src/arg-handler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
* process command-line arguments and execute corresponding actions. It also includes
* helper structures and utilities for managing console output with color.
*/
#ifndef ARGUMENT_HANDLER_HPP
#define ARGUMENT_HANDLER_HPP
#pragma once

#include "./cmd-line-args.hpp"
#include <filesystem>
Expand All @@ -18,7 +17,7 @@
// Constants
constexpr const char* DBUS_SERVICE_NAME =
"org.mpris.MediaPlayer2.inLimbo"; ///< DBus service name used by inLimbo.
constexpr const char* VERSION = "2.7 (ALPHA)"; ///< Current version of the application.
constexpr const char* VERSION = "2.9 (ALPHA)"; ///< Current version of the application.
constexpr const char* REPOSITORY_URL = "https://github.com/nots1dd/inLimbo";

bool shouldRunApp =
Expand Down Expand Up @@ -228,5 +227,3 @@ class ArgumentHandler
shouldRunApp = true;
}
};

#endif // ARGUMENT_HANDLER_HPP
6 changes: 1 addition & 5 deletions src/cmd-line-args.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
* helpful error messages for invalid flags. Additionally, it offers usage information and project
* details.
*/

#ifndef COMMAND_LINE_ARGS_HPP
#define COMMAND_LINE_ARGS_HPP
#pragma once

#include "./helpers/levenshtein.hpp"
#include <iostream>
Expand Down Expand Up @@ -226,5 +224,3 @@ class CommandLineArgs
const std::vector<std::string> CommandLineArgs::validFlags = {
"--help", "--show-dbus-name", "--version", "--clear-cache", "--show-config-file",
"--show-log-dir", "--update-cache-run"};

#endif // COMMAND_LINE_ARGS_HPP
29 changes: 13 additions & 16 deletions src/dbus/mpris-service.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@
* The service provides methods to update metadata, handle playback control, and register the
* service on the D-Bus.
*/

#ifndef MPRIS_SERVER_HPP
#define MPRIS_SERVER_HPP
#pragma once

#include <gio/gio.h>
#include <glib.h>
#include <iostream>
#include <string>
#include <utility>

/**
* @class MPRISService
Expand All @@ -39,7 +38,7 @@ class MPRISService
*
* @param applicationName The name of the media player application.
*/
MPRISService(const std::string& applicationName) : applicationName_(applicationName)
MPRISService(std::string applicationName) : applicationName_(std::move(applicationName))
{

const char* introspection_xml = R"XML(
Expand Down Expand Up @@ -319,10 +318,10 @@ class MPRISService
* @param user_data User data passed from the service constructor.
* @return The value of the requested property.
*/
static GVariant* handle_root_get_property(GDBusConnection* connection, const char* sender,
const char* object_path, const char* interface_name,
const char* property_name, GError** error,
void* user_data)
static auto handle_root_get_property(GDBusConnection* connection, const char* sender,
const char* object_path, const char* interface_name,
const char* property_name, GError** error,
void* user_data) -> GVariant*
{
auto* service = static_cast<MPRISService*>(user_data);

Expand Down Expand Up @@ -357,10 +356,10 @@ class MPRISService
* @param user_data User data passed from the service constructor.
* @return The value of the requested property.
*/
static GVariant* handle_player_get_property(GDBusConnection* connection, const char* sender,
const char* object_path, const char* interface_name,
const char* property_name, GError** error,
void* user_data)
static auto handle_player_get_property(GDBusConnection* connection, const char* sender,
const char* object_path, const char* interface_name,
const char* property_name, GError** error,
void* user_data) -> GVariant*
{
auto* service = static_cast<MPRISService*>(user_data);

Expand Down Expand Up @@ -416,8 +415,8 @@ class MPRISService
* @param error Error output in case of failure.
* @param user_data User data passed from the service constructor.
*/
static gboolean handle_player_set_property(GDBusConnection*, const char*, const char*,
const char*, const char*, GVariant*, GError**, void*)
static auto handle_player_set_property(GDBusConnection*, const char*, const char*, const char*,
const char*, GVariant*, GError**, void*) -> gboolean
{
return TRUE;
}
Expand All @@ -427,5 +426,3 @@ class MPRISService
GDBusConnection* connection_ = nullptr;
GVariant* current_metadata_ = nullptr;
};

#endif
5 changes: 1 addition & 4 deletions src/dirsort/inode_mapper.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef INODE_MAPPER_HPP
#define INODE_MAPPER_HPP
#pragma once

#include "rbtree.hpp"
#include <cstring>
Expand Down Expand Up @@ -77,5 +76,3 @@ void processDirectory(const string& dirPath, RedBlackTree& rbt, InodeFileMapper&

closedir(dir);
}

#endif // INODE_MAPPER_HPP
13 changes: 5 additions & 8 deletions src/dirsort/rbtree.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#ifndef RB_TREE_HPP
#define RB_TREE_HPP
#pragma once

#include "../parser/toml_parser.hpp"
#include "songmap.hpp"
Expand All @@ -18,7 +17,7 @@ using namespace std;

string DIRECTORY_FIELD = string(parseTOMLField(
PARENT_LIB, PARENT_LIB_FIELD_DIR)); // fetches the directory from the example config.toml for now
string DEBUG_LOG_PARSE = string(parseTOMLField(PARENT_DBG, PARENT_DBG_FIELD_PARSER_LOG));
string DEBUG_LOG_PARSE = string(parseTOMLField(PARENT_DBG, PARENT_DBG_FIELD_TAGLIB_PARSER_LOG));

// Node structure for the Red-Black Tree
struct Node
Expand Down Expand Up @@ -223,9 +222,7 @@ class RedBlackTree
fixInsert(new_node);
}

void inorderStoreMetadata() { inorderHelper(root); }
void printSongTree() { songTree.display(); }
SongTree returnSongTree() { return songTree; }
void inorderStoreMetadata() { inorderHelper(root); }
void printSongTree() { songTree.display(); }
auto returnSongTree() -> SongTree { return songTree; }
};

#endif
Loading

0 comments on commit 8180b50

Please sign in to comment.