lyrics/lastfm: refetch data if file didn't exist before

This commit is contained in:
Andrzej Rybczak
2010-09-15 18:57:17 +02:00
parent f2ac6cac03
commit 06d5b81125
2 changed files with 6 additions and 10 deletions

View File

@@ -201,15 +201,13 @@ void Lastfm::Save(const std::string &data)
void Lastfm::Refetch()
{
if (!remove(itsFilename.c_str()))
{
Load();
}
else
if (remove(itsFilename.c_str()) && errno != ENOENT)
{
static const char msg[] = "Couldn't remove \"%s\": %s";
ShowMessage(msg, Shorten(TO_WSTRING(itsFilename), COLS-static_strlen(msg)-25).c_str(), strerror(errno));
return;
}
Load();
}
bool Lastfm::SetArtistInfoArgs(const std::string &artist, const std::string &lang)

View File

@@ -303,15 +303,13 @@ void Lyrics::Save(const std::string &lyrics)
void Lyrics::Refetch()
{
if (!remove(itsFilename.c_str()))
{
Load();
}
else
if (remove(itsFilename.c_str()) && errno != ENOENT)
{
static const char msg[] = "Couldn't remove \"%s\": %s";
ShowMessage(msg, Shorten(TO_WSTRING(itsFilename), COLS-static_strlen(msg)-25).c_str(), strerror(errno));
return;
}
Load();
}
#ifdef HAVE_CURL_CURL_H