diff --git a/src/lyrics.cpp b/src/lyrics.cpp index b7190d19..185efef3 100644 --- a/src/lyrics.cpp +++ b/src/lyrics.cpp @@ -229,15 +229,11 @@ void *Lyrics::Get(void *screen_void_ptr) if (result.first == true) { - screen->w->Clear(); - *screen->w << utf_to_locale_cpy(result.second); + screen->Save(result.second); - std::ofstream output(screen->itsFilenamePath.c_str()); - if (output.is_open()) - { - output << result.second; - output.close(); - } + utf_to_locale(result.second); + screen->w->Clear(); + *screen->w << result.second; } else *screen->w << "\nLyrics weren't found."; @@ -273,6 +269,16 @@ void Lyrics::Edit() system(("nohup " + Config.external_editor + " \"" + itsFilenamePath + "\" > /dev/null 2>&1 &").c_str()); } +void Lyrics::Save(const std::string &lyrics) +{ + std::ofstream output(itsFilenamePath.c_str()); + if (output.is_open()) + { + output << lyrics; + output.close(); + } +} + void Lyrics::FetchAgain() { std::string path = Folder + "/" + locale_to_utf_cpy(itsSong.GetArtist()) + " - " + locale_to_utf_cpy(itsSong.GetTitle()) + ".txt"; diff --git a/src/lyrics.h b/src/lyrics.h index 3e895244..aa86117d 100644 --- a/src/lyrics.h +++ b/src/lyrics.h @@ -46,6 +46,7 @@ class Lyrics : public Screen virtual List *GetList() { return 0; } void Edit(); + void Save(const std::string &lyrics); void FetchAgain(); static bool Reload;