new feature: refetch lyrics
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <cerrno>
|
||||
#include <cstring>
|
||||
#ifdef WIN32
|
||||
# include <io.h>
|
||||
@@ -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
|
||||
|
||||
@@ -58,6 +58,7 @@ class Lyrics : public Screen<Scrollpad>
|
||||
virtual List *GetList() { return 0; }
|
||||
|
||||
void Edit();
|
||||
void FetchAgain();
|
||||
|
||||
static bool Reload;
|
||||
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user