make displaying dates of albums in media library optional
This commit is contained in:
@@ -302,6 +302,8 @@
|
||||
#
|
||||
#tag_editor_extended_numeration = "no"
|
||||
#
|
||||
#media_library_display_date = "yes"
|
||||
#
|
||||
#enable_window_title = "yes"
|
||||
#
|
||||
##
|
||||
|
||||
@@ -255,6 +255,9 @@ If enabled, ncmpcpp will be able to delete directories using its browser screen.
|
||||
.B tag_editor_extended_numeration = yes/no
|
||||
If enabled, tag editor will number tracks using format xx/yy (where xx is the current track and yy is total amount of all numbered tracks), not plain xx.
|
||||
.TP
|
||||
.B media_library_display_date = yes/no
|
||||
If enabled, dates of albums in media library will be displayed and respected in searching, otherwise not.
|
||||
.TP
|
||||
.B enable_window_title = yes/no
|
||||
If enabled, ncmpcpp will override current window title with its own one.
|
||||
.TP
|
||||
|
||||
@@ -64,6 +64,7 @@ void MediaLibrary::Init()
|
||||
Albums->SetSelectSuffix(&Config.selected_item_suffix);
|
||||
Albums->SetItemDisplayer(DisplayAlbums);
|
||||
Albums->SetGetStringFunction(AlbumToString);
|
||||
Albums->SetGetStringFunctionUserData(this);
|
||||
|
||||
Songs = new Menu<Song>(itsRightColStartX, MainStartY, itsRightColWidth, MainHeight, "Songs", Config.main_color, brNone);
|
||||
Songs->HighlightColor(Config.main_highlight_color);
|
||||
@@ -193,6 +194,8 @@ void MediaLibrary::Update()
|
||||
Mpd.CommitSearch(list);
|
||||
|
||||
for (TagList::iterator it = list.begin(); it != list.end(); ++it)
|
||||
{
|
||||
if (Config.media_library_display_date)
|
||||
{
|
||||
TagList l;
|
||||
Mpd.StartFieldSearch(MPD_TAG_DATE);
|
||||
@@ -206,6 +209,12 @@ void MediaLibrary::Update()
|
||||
Albums->AddOption(SearchConstraints(*it, *j));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
utf_to_locale(*it);
|
||||
Albums->AddOption(SearchConstraints(*it, ""));
|
||||
}
|
||||
}
|
||||
utf_to_locale(Artists->Current());
|
||||
if (!Albums->Empty())
|
||||
Albums->Sort<SearchConstraintsSorting>();
|
||||
@@ -227,6 +236,8 @@ void MediaLibrary::Update()
|
||||
Mpd.AddSearch(Config.media_lib_primary_tag, *i);
|
||||
Mpd.CommitSearch(albums);
|
||||
for (TagList::iterator j = albums.begin(); j != albums.end(); ++j)
|
||||
{
|
||||
if (Config.media_library_display_date)
|
||||
{
|
||||
if (Config.media_lib_primary_tag != MPD_TAG_DATE)
|
||||
{
|
||||
@@ -250,6 +261,13 @@ void MediaLibrary::Update()
|
||||
Albums->AddOption(SearchConstraints(*i, *j, *i));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
utf_to_locale(*i);
|
||||
utf_to_locale(*j);
|
||||
Albums->AddOption(SearchConstraints(*i, *j, ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!Albums->Empty())
|
||||
Albums->Sort<SearchConstraintsSorting>();
|
||||
@@ -278,6 +296,7 @@ void MediaLibrary::Update()
|
||||
else
|
||||
{
|
||||
Mpd.AddSearch(MPD_TAG_ALBUM, locale_to_utf_cpy(Albums->Current().Album));
|
||||
if (Config.media_library_display_date)
|
||||
Mpd.AddSearch(MPD_TAG_DATE, locale_to_utf_cpy(Albums->Current().Year));
|
||||
}
|
||||
Mpd.CommitSearch(list);
|
||||
@@ -661,12 +680,12 @@ std::string MediaLibrary::SongToString(const MPD::Song &s, void *)
|
||||
return s.toString(Config.song_library_format);
|
||||
}
|
||||
|
||||
std::string MediaLibrary::AlbumToString(const SearchConstraints &sc, void *)
|
||||
std::string MediaLibrary::AlbumToString(const SearchConstraints &sc, void *ptr)
|
||||
{
|
||||
std::string result;
|
||||
if (!sc.Artist.empty())
|
||||
(result += sc.Artist) += " - ";
|
||||
if (!sc.Year.empty())
|
||||
if ((!static_cast<MediaLibrary *>(ptr)->hasTwoColumns || Config.media_lib_primary_tag != MPD_TAG_DATE) && !sc.Year.empty())
|
||||
((result += "(") += sc.Year) += ") ";
|
||||
result += sc.Album.empty() ? "<no album>" : sc.Album;
|
||||
return result;
|
||||
|
||||
@@ -325,6 +325,7 @@ void DefaultConfiguration(ncmpcpp_config &conf)
|
||||
conf.visualizer_use_wave = true;
|
||||
conf.browser_sort_by_mtime = false;
|
||||
conf.tag_editor_extended_numeration = false;
|
||||
conf.media_library_display_date = true;
|
||||
conf.set_window_title = true;
|
||||
conf.mpd_port = 6600;
|
||||
conf.mpd_connection_timeout = 15;
|
||||
@@ -874,6 +875,10 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
||||
{
|
||||
conf.tag_editor_extended_numeration = v == "yes";
|
||||
}
|
||||
else if (cl.find("media_library_display_date") != std::string::npos)
|
||||
{
|
||||
conf.media_library_display_date = v == "yes";
|
||||
}
|
||||
else if (cl.find("enable_window_title") != std::string::npos)
|
||||
{
|
||||
conf.set_window_title = v == "yes";
|
||||
|
||||
@@ -217,6 +217,7 @@ struct ncmpcpp_config
|
||||
bool visualizer_use_wave;
|
||||
bool browser_sort_by_mtime;
|
||||
bool tag_editor_extended_numeration;
|
||||
bool media_library_display_date;
|
||||
|
||||
int mpd_port;
|
||||
int mpd_connection_timeout;
|
||||
|
||||
Reference in New Issue
Block a user