Skip to content

Commit

Permalink
Add my-ncmpcpp
Browse files Browse the repository at this point in the history
  • Loading branch information
42LoCo42 committed Feb 27, 2024
1 parent 36756be commit ce0fb20
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
- m9u: A 9P music server - https://sqweek.net/code/m9u/
- msp-cgt: MSP430 code generation tools - https://www.ti.com/tool/MSP-CGT
- mspgcc-ti: Open Source Compiler for MSP Microcontrollers - https://www.ti.com/tool/MSP430-GCC-OPENSOURCE
- my-ncmpcpp: ncmpcpp except the media library always shows Albums - Songs - https://rybczak.net/ncmpcpp/
- nixci: Define and build CI for Nix projects anywhere - https://github.com/srid/nixci
- prettier-plugin-go-template: Fixes prettier formatting for go templates - https://github.com/NiklasPor/prettier-plugin-go-template
- redis-json: RedisJSON - a JSON data type for Redis - https://github.com/RedisJSON/RedisJSON
- samloader: Download Samsung firmware from official servers - https://github.com/samloader/samloader
- wayland-shell: Small-scale replacement of the GNOME Shell - https://github.com/nilsherzig/wayland-shell
- wayland-shell: Small-scale replacement of the GNOME Shell - https://github.com/nilsherzig/wayland-shell
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
redis-json = pkgs.callPackage ./packages/redis-json.nix { };
samloader = pkgs.callPackage ./packages/samloader.nix { };
wayland-shell = pkgs.callPackage ./packages/wayland-shell.nix { inherit gtk4-layer-shell; };

my-ncmpcpp = pkgs.ncmpcpp.overrideAttrs {
patches = [ ./packages/my-ncmpcpp.patch ];
};
};

nixosModules = {
Expand Down
79 changes: 79 additions & 0 deletions packages/my-ncmpcpp.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
diff --git a/src/screens/media_library.cpp b/src/screens/media_library.cpp
index 558458d..f873704 100644
--- a/src/screens/media_library.cpp
+++ b/src/screens/media_library.cpp
@@ -52,8 +52,8 @@ MediaLibrary *myLibrary;

namespace {

-bool hasTwoColumns;
-bool isAlbumOnly;
+bool hasTwoColumns = 1;
+bool isAlbumOnly = 1;
size_t itsLeftColStartX;
size_t itsLeftColWidth;
size_t itsMiddleColWidth;
@@ -189,8 +189,8 @@ MediaLibrary::MediaLibrary()
, m_window_timeout(Config.data_fetching_delay ? 250 : BaseScreen::defaultWindowTimeout)
, m_fetching_delay(boost::posix_time::milliseconds(Config.data_fetching_delay ? 250 : -1))
{
- hasTwoColumns = 0;
- isAlbumOnly = 0;
+ hasTwoColumns = 1;
+ isAlbumOnly = 1;
itsLeftColWidth = COLS/3-1;
itsMiddleColWidth = COLS/3;
itsMiddleColStartX = itsLeftColWidth+1;
@@ -232,6 +232,8 @@ MediaLibrary::MediaLibrary()
));

w = &Tags;
+
+ toggleColumnsMode();
}

void MediaLibrary::resize()
@@ -904,15 +906,8 @@ void MediaLibrary::updateTimer()

void MediaLibrary::toggleColumnsMode()
{
- if (isAlbumOnly)
- {
- hasTwoColumns = 0;
- isAlbumOnly = 0;
- }
- else if (hasTwoColumns)
- isAlbumOnly = 1;
- else
- hasTwoColumns = 1;
+ hasTwoColumns = 1;
+ isAlbumOnly = 1;

Tags.clear();
Albums.clear();
diff --git a/src/settings.cpp b/src/settings.cpp
index 80a2b4e..d86e26e 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -444,9 +444,11 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
p.add("user_interface", &design, "classic");
p.add("data_fetching_delay", &data_fetching_delay, "yes", yes_no);
p.add("media_library_hide_album_dates", &media_lib_hide_album_dates, "no", yes_no);
- p.add("media_library_primary_tag", &media_lib_primary_tag, "artist", [](std::string v) {
+ p.add("media_library_primary_tag", &media_lib_primary_tag, "album", [](std::string v) {
if (v == "artist")
return MPD_TAG_ARTIST;
+ else if (v == "album")
+ return MPD_TAG_ALBUM;
else if (v == "album_artist")
return MPD_TAG_ALBUM_ARTIST;
else if (v == "date")
@@ -507,7 +509,7 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
});
}
});
- p.add("startup_screen", &startup_screen_type, "playlist", [](std::string v) {
+ p.add("startup_screen", &startup_screen_type, "media_library", [](std::string v) {
auto screen = stringtoStartupScreenType(v);
if (screen == ScreenType::Unknown)
invalid_value(v);

0 comments on commit ce0fb20

Please sign in to comment.