new feature: custom command execution on song change
This commit is contained in:
@@ -110,6 +110,13 @@
|
||||
#
|
||||
##### various settings #####
|
||||
#
|
||||
##
|
||||
## Note: Custom command that will be executed each time song changes.
|
||||
## It uses the same syntax as song format (for now playing song).
|
||||
## Useful for notifications etc.
|
||||
##
|
||||
#execute_on_song_change = ""
|
||||
#
|
||||
#playlist_show_remaining_time = "no"
|
||||
#
|
||||
#playlist_display_mode = "classic" (classic/columns)
|
||||
|
||||
@@ -533,6 +533,11 @@ void ReadConfiguration(ncmpcpp_config &conf)
|
||||
if (!v.empty())
|
||||
conf.system_encoding = v + "//TRANSLIT";
|
||||
}
|
||||
else if (cl.find("execute_on_song_change") != string::npos)
|
||||
{
|
||||
if (!v.empty())
|
||||
conf.execute_on_song_change = v;
|
||||
}
|
||||
else if (cl.find("browser_playlist_prefix") != string::npos)
|
||||
{
|
||||
if (!v.empty())
|
||||
|
||||
@@ -119,6 +119,7 @@ struct ncmpcpp_config
|
||||
std::string tag_editor_album_format;
|
||||
std::string external_editor;
|
||||
std::string system_encoding;
|
||||
std::string execute_on_song_change;
|
||||
|
||||
std::string pattern;
|
||||
|
||||
|
||||
@@ -343,6 +343,8 @@ void NcmpcppStatusChanged(Connection *Mpd, StatusChanges changed, void *)
|
||||
if (myPlaylist->isPlaying())
|
||||
{
|
||||
np = Mpd->GetCurrentSong();
|
||||
if (!Config.execute_on_song_change.empty())
|
||||
system(np.toString(Config.execute_on_song_change).c_str());
|
||||
if (Mpd->GetState() > psStop)
|
||||
WindowTitle(utf_to_locale_cpy(np.toString(Config.song_window_title_format)));
|
||||
if (Config.autocenter_mode && !myPlaylist->Main()->isFiltered())
|
||||
|
||||
Reference in New Issue
Block a user