new feature: refetch lyrics

This commit is contained in:
Andrzej Rybczak
2009-10-20 00:35:51 +02:00
parent a98eb5e9ac
commit 62b7df69f3
4 changed files with 22 additions and 0 deletions

View File

@@ -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