lyrics/lastfm: refetch data if file didn't exist before
This commit is contained in:
@@ -201,15 +201,13 @@ void Lastfm::Save(const std::string &data)
|
|||||||
|
|
||||||
void Lastfm::Refetch()
|
void Lastfm::Refetch()
|
||||||
{
|
{
|
||||||
if (!remove(itsFilename.c_str()))
|
if (remove(itsFilename.c_str()) && errno != ENOENT)
|
||||||
{
|
|
||||||
Load();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
static const char msg[] = "Couldn't remove \"%s\": %s";
|
static const char msg[] = "Couldn't remove \"%s\": %s";
|
||||||
ShowMessage(msg, Shorten(TO_WSTRING(itsFilename), COLS-static_strlen(msg)-25).c_str(), strerror(errno));
|
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)
|
bool Lastfm::SetArtistInfoArgs(const std::string &artist, const std::string &lang)
|
||||||
|
|||||||
@@ -303,15 +303,13 @@ void Lyrics::Save(const std::string &lyrics)
|
|||||||
|
|
||||||
void Lyrics::Refetch()
|
void Lyrics::Refetch()
|
||||||
{
|
{
|
||||||
if (!remove(itsFilename.c_str()))
|
if (remove(itsFilename.c_str()) && errno != ENOENT)
|
||||||
{
|
|
||||||
Load();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
static const char msg[] = "Couldn't remove \"%s\": %s";
|
static const char msg[] = "Couldn't remove \"%s\": %s";
|
||||||
ShowMessage(msg, Shorten(TO_WSTRING(itsFilename), COLS-static_strlen(msg)-25).c_str(), strerror(errno));
|
ShowMessage(msg, Shorten(TO_WSTRING(itsFilename), COLS-static_strlen(msg)-25).c_str(), strerror(errno));
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_CURL_CURL_H
|
#ifdef HAVE_CURL_CURL_H
|
||||||
|
|||||||
Reference in New Issue
Block a user