diff --git a/src/help.cpp b/src/help.cpp index 66601098..c0211264 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -276,6 +276,7 @@ void Help::GetKeybindings() *w << "\n\n " << fmtBold << "Keys - Lyrics\n -----------------------------------------\n" << fmtBoldEnd; *w << DisplayKeys(Key.Space) << "Switch for following lyrics of now playing song\n"; *w << DisplayKeys(Key.EditTags) << "Open lyrics in external editor\n"; + *w << DisplayKeys(Key.SwitchTagTypeList) << "Refetch lyrics\n"; # ifdef HAVE_TAGLIB_H diff --git a/src/lyrics.cpp b/src/lyrics.cpp index ba5ba82a..dfe983f1 100644 --- a/src/lyrics.cpp +++ b/src/lyrics.cpp @@ -18,6 +18,7 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ +#include #include #ifdef WIN32 # include @@ -300,6 +301,21 @@ void Lyrics::Edit() system(("nohup " + Config.external_editor + " \"" + itsFilenamePath + "\" > /dev/null 2>&1 &").c_str()); } +void Lyrics::FetchAgain() +{ + std::string path = Folder + "/" + locale_to_utf_cpy(itsSong.GetArtist()) + " - " + locale_to_utf_cpy(itsSong.GetTitle()) + ".txt"; + if (!remove(path.c_str())) + { + myScreen = myOldScreen; + SwitchTo(); + } + else + { + static const char msg[] = "Couldn't remove \"%s\": %s"; + ShowMessage(msg, Shorten(TO_WSTRING(path), COLS-static_strlen(msg)-25).c_str(), strerror(errno)); + } +} + #ifdef HAVE_CURL_CURL_H #ifdef HAVE_PTHREAD_H diff --git a/src/lyrics.h b/src/lyrics.h index 80a51c78..77891bcf 100644 --- a/src/lyrics.h +++ b/src/lyrics.h @@ -58,6 +58,7 @@ class Lyrics : public Screen virtual List *GetList() { return 0; } void Edit(); + void FetchAgain(); static bool Reload; diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index c36108dd..3b648b24 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -1853,6 +1853,10 @@ int main(int argc, char *argv[]) ShowMessage("Switched to list of %s tag", item_type.c_str()); } } + else if (myScreen == myLyrics) + { + myLyrics->FetchAgain(); + } } else if (Keypressed(input, Key.SongInfo)) {