brand new song info screen
This commit is contained in:
@@ -93,6 +93,8 @@
|
|||||||
#
|
#
|
||||||
#key_go_to_position = 'g'
|
#key_go_to_position = 'g'
|
||||||
#
|
#
|
||||||
|
#key_song_info = 'i'
|
||||||
|
#
|
||||||
#key_lyrics = 'l'
|
#key_lyrics = 'l'
|
||||||
#
|
#
|
||||||
#key_reverse_selection = 'v'
|
#key_reverse_selection = 'v'
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
#include "tag_editor.h"
|
||||||
|
|
||||||
extern MPDConnection *Mpd;
|
extern MPDConnection *Mpd;
|
||||||
|
|
||||||
@@ -698,6 +699,40 @@ string DisplaySong(const Song &s, void *s_template)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string GetInfo(Song &s)
|
||||||
|
{
|
||||||
|
string result;
|
||||||
|
# ifdef HAVE_TAGLIB_H
|
||||||
|
string path_to_file = Config.mpd_music_dir + "/" + s.GetFile();
|
||||||
|
TagLib::FileRef f(path_to_file.c_str());
|
||||||
|
if (!f.isNull())
|
||||||
|
s.SetComment(f.tag()->comment().to8Bit(UNICODE));
|
||||||
|
# endif // HAVE_TAGLIB_H
|
||||||
|
|
||||||
|
result = "[.b][.white]Filename: [/white][.green][/b]" + s.GetShortFilename() + "[/green]\n";
|
||||||
|
result += "[.b][.white]Directory: [/white][.green][/b]" + s.GetDirectory() + "[/green]\n\n";
|
||||||
|
result += "[.b][.white]Length: [/white][.green][/b]" + s.GetLength() + "[/green]\n";
|
||||||
|
# ifdef HAVE_TAGLIB_H
|
||||||
|
if (!f.isNull())
|
||||||
|
{
|
||||||
|
result += "[.b][.white]Bitrate: [/white][.green][/b]" + IntoStr(f.audioProperties()->bitrate()) + " kbps[/green]\n";
|
||||||
|
result += "[.b][.white]Sample rate: [/white][.green][/b]" + IntoStr(f.audioProperties()->sampleRate()) + " Hz[/green]\n";
|
||||||
|
result += "[.b][.white]Channels: [/white][.green][/b]" + string(f.audioProperties()->channels() == 1 ? "Mono" : "Stereo") + "[/green]\n";
|
||||||
|
}
|
||||||
|
# endif // HAVE_TAGLIB_H
|
||||||
|
result += "\n[.b]Title:[/b] " + s.GetTitle();
|
||||||
|
result += "\n[.b]Artist:[/b] " + s.GetArtist();
|
||||||
|
result += "\n[.b]Album:[/b] " + s.GetAlbum();
|
||||||
|
result += "\n[.b]Year:[/b] " + s.GetYear();
|
||||||
|
result += "\n[.b]Track:[/b] " + s.GetTrack();
|
||||||
|
result += "\n[.b]Genre:[/b] " + s.GetGenre();
|
||||||
|
result += "\n[.b]Composer:[/b] " + s.GetComposer();
|
||||||
|
result += "\n[.b]Performer:[/b] " + s.GetPerformer();
|
||||||
|
result += "\n[.b]Disc:[/b] " + s.GetDisc();
|
||||||
|
result += "\n[.b]Comment:[/b] " + s.GetComment();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
void ShowMessage(const string &message, int delay)
|
void ShowMessage(const string &message, int delay)
|
||||||
{
|
{
|
||||||
if (messages_allowed)
|
if (messages_allowed)
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ string DisplayItem(const Item &, void * = NULL);
|
|||||||
string DisplayColumns(string);
|
string DisplayColumns(string);
|
||||||
string DisplaySongInColumns(const Song &, void *);
|
string DisplaySongInColumns(const Song &, void *);
|
||||||
string DisplaySong(const Song &, void * = &Config.song_list_format);
|
string DisplaySong(const Song &, void * = &Config.song_list_format);
|
||||||
|
string GetInfo(Song &);
|
||||||
void ShowMessage(const string &, int = Config.message_delay_time);
|
void ShowMessage(const string &, int = Config.message_delay_time);
|
||||||
void GetDirectory(string, string = "/");
|
void GetDirectory(string, string = "/");
|
||||||
|
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ Menu<Song> *mPlaylistEditor;
|
|||||||
|
|
||||||
Scrollpad *sHelp;
|
Scrollpad *sHelp;
|
||||||
Scrollpad *sLyrics;
|
Scrollpad *sLyrics;
|
||||||
|
Scrollpad *sInfo;
|
||||||
|
|
||||||
Window *wHeader;
|
Window *wHeader;
|
||||||
Window *wFooter;
|
Window *wFooter;
|
||||||
@@ -232,6 +233,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
sHelp = new Scrollpad(0, main_start_y, COLS, main_height, "", Config.main_color, brNone);
|
sHelp = new Scrollpad(0, main_start_y, COLS, main_height, "", Config.main_color, brNone);
|
||||||
sLyrics = static_cast<Scrollpad *>(sHelp->EmptyClone());
|
sLyrics = static_cast<Scrollpad *>(sHelp->EmptyClone());
|
||||||
|
sInfo = static_cast<Scrollpad *>(sHelp->EmptyClone());
|
||||||
|
|
||||||
sHelp->Add(" [.b]Keys - Movement\n -----------------------------------------[/b]\n");
|
sHelp->Add(" [.b]Keys - Movement\n -----------------------------------------[/b]\n");
|
||||||
sHelp->Add(DisplayKeys(Key.Up) + "Move Cursor up\n");
|
sHelp->Add(DisplayKeys(Key.Up) + "Move Cursor up\n");
|
||||||
@@ -283,6 +285,7 @@ int main(int argc, char *argv[])
|
|||||||
sHelp->Add(DisplayKeys(Key.EditTags) + "Edit song's tags/playlist's name\n");
|
sHelp->Add(DisplayKeys(Key.EditTags) + "Edit song's tags/playlist's name\n");
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
sHelp->Add(DisplayKeys(Key.GoToPosition) + "Go to chosen position in current song\n");
|
sHelp->Add(DisplayKeys(Key.GoToPosition) + "Go to chosen position in current song\n");
|
||||||
|
sHelp->Add(DisplayKeys(Key.ShowInfo) + "Show song's info\n");
|
||||||
sHelp->Add(DisplayKeys(Key.Lyrics) + "Show/hide song's lyrics\n\n");
|
sHelp->Add(DisplayKeys(Key.Lyrics) + "Show/hide song's lyrics\n\n");
|
||||||
|
|
||||||
sHelp->Add(DisplayKeys(Key.Quit) + "Quit\n\n\n");
|
sHelp->Add(DisplayKeys(Key.Quit) + "Quit\n\n\n");
|
||||||
@@ -365,6 +368,7 @@ int main(int argc, char *argv[])
|
|||||||
mEditorTags->SetTimeout(ncmpcpp_window_timeout);
|
mEditorTags->SetTimeout(ncmpcpp_window_timeout);
|
||||||
# endif // HAVE_TAGLIB_H
|
# endif // HAVE_TAGLIB_H
|
||||||
sLyrics->SetTimeout(ncmpcpp_window_timeout);
|
sLyrics->SetTimeout(ncmpcpp_window_timeout);
|
||||||
|
sInfo->SetTimeout(ncmpcpp_window_timeout);
|
||||||
wFooter->SetTimeout(ncmpcpp_window_timeout);
|
wFooter->SetTimeout(ncmpcpp_window_timeout);
|
||||||
mPlaylistList->SetTimeout(ncmpcpp_window_timeout);
|
mPlaylistList->SetTimeout(ncmpcpp_window_timeout);
|
||||||
mPlaylistEditor->SetTimeout(ncmpcpp_window_timeout);
|
mPlaylistEditor->SetTimeout(ncmpcpp_window_timeout);
|
||||||
@@ -435,6 +439,9 @@ int main(int argc, char *argv[])
|
|||||||
case csTagEditor:
|
case csTagEditor:
|
||||||
title = "Tag editor";
|
title = "Tag editor";
|
||||||
break;
|
break;
|
||||||
|
case csInfo:
|
||||||
|
title = "Song info";
|
||||||
|
break;
|
||||||
case csSearcher:
|
case csSearcher:
|
||||||
title = "Search engine";
|
title = "Search engine";
|
||||||
break;
|
break;
|
||||||
@@ -811,6 +818,7 @@ int main(int argc, char *argv[])
|
|||||||
mPlaylist->SetTitle(Config.columns_in_playlist ? DisplayColumns(Config.song_columns_list_format) : "");
|
mPlaylist->SetTitle(Config.columns_in_playlist ? DisplayColumns(Config.song_columns_list_format) : "");
|
||||||
mBrowser->Resize(COLS, main_height);
|
mBrowser->Resize(COLS, main_height);
|
||||||
mSearcher->Resize(COLS, main_height);
|
mSearcher->Resize(COLS, main_height);
|
||||||
|
sInfo->Resize(COLS, main_height);
|
||||||
sLyrics->Resize(COLS, main_height);
|
sLyrics->Resize(COLS, main_height);
|
||||||
|
|
||||||
lib_artist_width = COLS/3-1;
|
lib_artist_width = COLS/3-1;
|
||||||
@@ -846,8 +854,7 @@ int main(int argc, char *argv[])
|
|||||||
wFooter->MoveTo(0, footer_start_y);
|
wFooter->MoveTo(0, footer_start_y);
|
||||||
wFooter->Resize(COLS, wFooter->GetHeight());
|
wFooter->Resize(COLS, wFooter->GetHeight());
|
||||||
|
|
||||||
if (wCurrent != sHelp && wCurrent != sLyrics)
|
wCurrent->Hide();
|
||||||
wCurrent->Window::Clear();
|
|
||||||
|
|
||||||
# ifdef HAVE_TAGLIB_H
|
# ifdef HAVE_TAGLIB_H
|
||||||
if (current_screen == csLibrary)
|
if (current_screen == csLibrary)
|
||||||
@@ -2624,11 +2631,66 @@ int main(int argc, char *argv[])
|
|||||||
Config.space_selects = !Config.space_selects;
|
Config.space_selects = !Config.space_selects;
|
||||||
ShowMessage("Space mode: " + string(Config.space_selects ? "Select/deselect" : "Add") + " item");
|
ShowMessage("Space mode: " + string(Config.space_selects ? "Select/deselect" : "Add") + " item");
|
||||||
}
|
}
|
||||||
|
else if (Keypressed(input, Key.ShowInfo))
|
||||||
|
{
|
||||||
|
if (wCurrent == sInfo)
|
||||||
|
{
|
||||||
|
wCurrent->Hide();
|
||||||
|
current_screen = prev_screen;
|
||||||
|
wCurrent = wPrev;
|
||||||
|
redraw_screen = 1;
|
||||||
|
if (current_screen == csLibrary)
|
||||||
|
{
|
||||||
|
REFRESH_MEDIA_LIBRARY_SCREEN;
|
||||||
|
}
|
||||||
|
else if (current_screen == csPlaylistEditor)
|
||||||
|
{
|
||||||
|
REFRESH_PLAYLIST_EDITOR_SCREEN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (
|
||||||
|
(wCurrent == mPlaylist && !mPlaylist->Empty())
|
||||||
|
|| (wCurrent == mBrowser && mBrowser->at(mBrowser->GetChoice()).type == itSong)
|
||||||
|
|| (wCurrent == mSearcher && mSearcher->Current().first == ".")
|
||||||
|
|| (wCurrent == mLibSongs && !mLibSongs->Empty())
|
||||||
|
|| (wCurrent == mPlaylistEditor && !mPlaylistEditor->Empty()))
|
||||||
|
{
|
||||||
|
Song *s;
|
||||||
|
int id = wCurrent->GetChoice();
|
||||||
|
switch (current_screen)
|
||||||
|
{
|
||||||
|
case csPlaylist:
|
||||||
|
s = &mPlaylist->at(id);
|
||||||
|
break;
|
||||||
|
case csBrowser:
|
||||||
|
s = mBrowser->at(id).song;
|
||||||
|
break;
|
||||||
|
case csSearcher:
|
||||||
|
s = &mSearcher->at(id).second;
|
||||||
|
break;
|
||||||
|
case csLibrary:
|
||||||
|
s = &mLibSongs->at(id);
|
||||||
|
break;
|
||||||
|
case csPlaylistEditor:
|
||||||
|
s = &mPlaylistEditor->at(id);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
wPrev = wCurrent;
|
||||||
|
wCurrent = sInfo;
|
||||||
|
prev_screen = current_screen;
|
||||||
|
current_screen = csInfo;
|
||||||
|
sInfo->Clear();
|
||||||
|
sInfo->Add(GetInfo(*s));
|
||||||
|
sInfo->Hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (Keypressed(input, Key.Lyrics))
|
else if (Keypressed(input, Key.Lyrics))
|
||||||
{
|
{
|
||||||
if (wCurrent == sLyrics)
|
if (wCurrent == sLyrics)
|
||||||
{
|
{
|
||||||
wCurrent->Window::Clear();
|
wCurrent->Hide();
|
||||||
current_screen = prev_screen;
|
current_screen = prev_screen;
|
||||||
wCurrent = wPrev;
|
wCurrent = wPrev;
|
||||||
redraw_screen = 1;
|
redraw_screen = 1;
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ enum NcmpcppScreen
|
|||||||
csPlaylist,
|
csPlaylist,
|
||||||
csBrowser,
|
csBrowser,
|
||||||
csTagEditor,
|
csTagEditor,
|
||||||
|
csInfo,
|
||||||
csSearcher,
|
csSearcher,
|
||||||
csLibrary,
|
csLibrary,
|
||||||
csLyrics,
|
csLyrics,
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ void DefaultKeys(ncmpcpp_keys &keys)
|
|||||||
keys.PrevFoundPosition[0] = ',';
|
keys.PrevFoundPosition[0] = ',';
|
||||||
keys.ToggleFindMode[0] = 'w';
|
keys.ToggleFindMode[0] = 'w';
|
||||||
keys.EditTags[0] = 'e';
|
keys.EditTags[0] = 'e';
|
||||||
|
keys.ShowInfo[0] = 'i';
|
||||||
keys.GoToPosition[0] = 'g';
|
keys.GoToPosition[0] = 'g';
|
||||||
keys.Lyrics[0] = 'l';
|
keys.Lyrics[0] = 'l';
|
||||||
keys.ReverseSelection[0] = 'v';
|
keys.ReverseSelection[0] = 'v';
|
||||||
@@ -124,6 +125,7 @@ void DefaultKeys(ncmpcpp_keys &keys)
|
|||||||
keys.PrevFoundPosition[1] = null_key;
|
keys.PrevFoundPosition[1] = null_key;
|
||||||
keys.ToggleFindMode[1] = null_key;
|
keys.ToggleFindMode[1] = null_key;
|
||||||
keys.EditTags[1] = null_key;
|
keys.EditTags[1] = null_key;
|
||||||
|
keys.ShowInfo[1] = null_key;
|
||||||
keys.GoToPosition[1] = null_key;
|
keys.GoToPosition[1] = null_key;
|
||||||
keys.Lyrics[1] = null_key;
|
keys.Lyrics[1] = null_key;
|
||||||
keys.ReverseSelection[1] = null_key;
|
keys.ReverseSelection[1] = null_key;
|
||||||
@@ -369,6 +371,8 @@ void ReadKeys(ncmpcpp_keys &keys)
|
|||||||
GetKeys(*it, keys.EditTags);
|
GetKeys(*it, keys.EditTags);
|
||||||
else if (it->find("key_go_to_position ") != string::npos)
|
else if (it->find("key_go_to_position ") != string::npos)
|
||||||
GetKeys(*it, keys.GoToPosition);
|
GetKeys(*it, keys.GoToPosition);
|
||||||
|
else if (it->find("key_song_info ") != string::npos)
|
||||||
|
GetKeys(*it, keys.ShowInfo);
|
||||||
else if (it->find("key_lyrics ") != string::npos)
|
else if (it->find("key_lyrics ") != string::npos)
|
||||||
GetKeys(*it, keys.Lyrics);
|
GetKeys(*it, keys.Lyrics);
|
||||||
else if (it->find("key_reverse_selection ") != string::npos)
|
else if (it->find("key_reverse_selection ") != string::npos)
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ struct ncmpcpp_keys
|
|||||||
int PrevFoundPosition[2];
|
int PrevFoundPosition[2];
|
||||||
int ToggleFindMode[2];
|
int ToggleFindMode[2];
|
||||||
int EditTags[2];
|
int EditTags[2];
|
||||||
|
int ShowInfo[2];
|
||||||
int GoToPosition[2];
|
int GoToPosition[2];
|
||||||
int Lyrics[2];
|
int Lyrics[2];
|
||||||
int ReverseSelection[2];
|
int ReverseSelection[2];
|
||||||
|
|||||||
Reference in New Issue
Block a user