|
|
|
|
@ -29,6 +29,11 @@ |
|
|
|
|
#include "playlist.h" |
|
|
|
|
#include "status.h" |
|
|
|
|
#include "tag_editor.h" |
|
|
|
|
#include "help.h" |
|
|
|
|
#include "playlist_editor.h" |
|
|
|
|
#include "browser.h" |
|
|
|
|
#include "media_library.h" |
|
|
|
|
#include "search_engine.h" |
|
|
|
|
|
|
|
|
|
bool ConnectToMPD() |
|
|
|
|
{ |
|
|
|
|
@ -120,6 +125,7 @@ void ParseArgv(int argc, char **argv) |
|
|
|
|
<< " -?, --help show this help message\n" |
|
|
|
|
<< " -v, --version display version information\n" |
|
|
|
|
<< " --now-playing display now playing song [" << now_playing_format << "]\n" |
|
|
|
|
<< " --screen <name> specify the startup screen\n" |
|
|
|
|
<< "\n" |
|
|
|
|
<< " play start playing\n" |
|
|
|
|
<< " pause pause the currently playing song\n" |
|
|
|
|
@ -135,7 +141,47 @@ void ParseArgv(int argc, char **argv) |
|
|
|
|
if (!ConnectToMPD()) |
|
|
|
|
exit(0); |
|
|
|
|
|
|
|
|
|
if (!strcmp(argv[i], "--now-playing")) |
|
|
|
|
if (!strcmp(argv[i], "-s") || !strcmp(argv[i], "--screen")) |
|
|
|
|
{ |
|
|
|
|
i++; |
|
|
|
|
if (i == argc) { |
|
|
|
|
std::cout << "ncmpcpp: no screen specified" << std::endl; |
|
|
|
|
exit(0); |
|
|
|
|
} |
|
|
|
|
if (!strcmp(argv[i], "help")) |
|
|
|
|
Config.startup_screen = myHelp; |
|
|
|
|
else if (!strcmp(argv[i], "playlist")) |
|
|
|
|
Config.startup_screen = myPlaylist; |
|
|
|
|
else if (!strcmp(argv[i], "browser")) |
|
|
|
|
Config.startup_screen = myBrowser; |
|
|
|
|
else if (!strcmp(argv[i], "search")) |
|
|
|
|
Config.startup_screen = mySearcher; |
|
|
|
|
else if (!strcmp(argv[i], "media-library") || !strcmp(argv[i], "library")) |
|
|
|
|
Config.startup_screen = myLibrary; |
|
|
|
|
else if (!strcmp(argv[i], "playlist-editor")) |
|
|
|
|
Config.startup_screen = myPlaylistEditor; |
|
|
|
|
# ifdef HAVE_TAGLIB_H |
|
|
|
|
else if (!strcmp(argv[i], "tag-editor")) |
|
|
|
|
Config.startup_screen = myTagEditor; |
|
|
|
|
# endif // HAVE_TAGLIB_H
|
|
|
|
|
# ifdef ENABLE_OUTPUTS |
|
|
|
|
else if (!strcmp(argv[i], "outputs")) |
|
|
|
|
Config.startup_screen = myOutputs; |
|
|
|
|
# endif // ENABLE_OUTPUTS
|
|
|
|
|
# ifdef ENABLE_VISUALIZER |
|
|
|
|
else if (!strcmp(argv[i], "visualizer")) |
|
|
|
|
Config.startup_screen = myVisualizer; |
|
|
|
|
# endif // ENABLE_VISUALIZER
|
|
|
|
|
# ifdef ENABLE_CLOCK |
|
|
|
|
else if (!strcmp(argv[i], "clock")) |
|
|
|
|
Config.startup_screen = myClock; |
|
|
|
|
# endif // ENABLE_CLOCK
|
|
|
|
|
else { |
|
|
|
|
std::cout << "ncmpcpp: invalid screen: " << argv[i] << std::endl; |
|
|
|
|
exit(0); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else if (!strcmp(argv[i], "--now-playing")) |
|
|
|
|
{ |
|
|
|
|
Mpd.UpdateStatus(); |
|
|
|
|
if (!Mpd.GetErrorMessage().empty()) |
|
|
|
|
|