use mkdir() instead of system() + a few clean-ups
This commit is contained in:
@@ -85,7 +85,7 @@
|
||||
## - color is optional (if it's not present, default window color will be used)
|
||||
##
|
||||
#
|
||||
#song_columns_list_format = "(8)[green]{l} (28)[cyan]{a} (28)[yellow]{b} (50)[red]{t}"
|
||||
#song_columns_list_format = "(8)[green]{l} (28)[cyan]{a} (28){b} (50)[red]{t}"
|
||||
#
|
||||
##### various settings #####
|
||||
#
|
||||
|
||||
@@ -19,9 +19,9 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include "lyrics.h"
|
||||
#include <fcntl.h>
|
||||
|
||||
const string lyrics_folder = home_folder + "/" + ".lyrics";
|
||||
const string mkdir_command = "mkdir " + lyrics_folder + " &>/dev/null";
|
||||
|
||||
size_t write_data(char *buffer, size_t size, size_t nmemb, string data)
|
||||
{
|
||||
@@ -38,7 +38,7 @@ string GetLyrics(string artist, string song)
|
||||
{
|
||||
const string filename = artist + " - " + song + ".txt";
|
||||
const string fullpath = lyrics_folder + "/" + filename;
|
||||
system(mkdir_command.c_str());
|
||||
mkdir(lyrics_folder.c_str(), 0755);
|
||||
|
||||
string result;
|
||||
std::ifstream input(fullpath.c_str());
|
||||
|
||||
@@ -309,7 +309,7 @@ string Menu<T>::GetCurrentOption() const
|
||||
{
|
||||
try
|
||||
{
|
||||
return OmitBBCodes(DisplayOption(itsOptions.at(itsHighlight)->item));
|
||||
return DisplayOption(itsOptions.at(itsHighlight)->item);
|
||||
}
|
||||
catch (std::out_of_range)
|
||||
{
|
||||
@@ -322,7 +322,7 @@ string Menu<T>::GetOption(int i) const
|
||||
{
|
||||
try
|
||||
{
|
||||
return OmitBBCodes(DisplayOption(itsOptions.at(i-1)->item));
|
||||
return DisplayOption(itsOptions.at(i-1)->item);
|
||||
}
|
||||
catch (std::out_of_range)
|
||||
{
|
||||
|
||||
@@ -814,7 +814,7 @@ int main(int argc, char *argv[])
|
||||
if (id >= 0)
|
||||
{
|
||||
Mpd->PlayID(id);
|
||||
ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s)));
|
||||
ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format));
|
||||
}
|
||||
mBrowser->Refresh();
|
||||
break;
|
||||
@@ -1125,7 +1125,7 @@ int main(int argc, char *argv[])
|
||||
if (id >= 0)
|
||||
{
|
||||
Mpd->PlayID(id);
|
||||
ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s)));
|
||||
ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -1185,7 +1185,7 @@ int main(int argc, char *argv[])
|
||||
int id = Mpd->AddSong(s);
|
||||
if (id >= 0)
|
||||
{
|
||||
ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s)));
|
||||
ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format));
|
||||
if (Keypressed(input, Key.Enter))
|
||||
Mpd->PlayID(id);
|
||||
}
|
||||
@@ -1229,7 +1229,7 @@ int main(int argc, char *argv[])
|
||||
int id = Mpd->AddSong(s);
|
||||
if (id >= 0)
|
||||
{
|
||||
ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s)));
|
||||
ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format));
|
||||
if (Keypressed(input, Key.Enter))
|
||||
Mpd->PlayID(id);
|
||||
}
|
||||
@@ -1286,7 +1286,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Song &s = *item.song;
|
||||
if (Mpd->AddSong(s) != -1)
|
||||
ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s)));
|
||||
ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format));
|
||||
break;
|
||||
}
|
||||
case itPlaylist:
|
||||
@@ -1316,7 +1316,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
Song &s = *vSearched[id];
|
||||
if (Mpd->AddSong(s) != -1)
|
||||
ShowMessage("Added to playlist: " + OmitBBCodes(DisplaySong(s)));
|
||||
ShowMessage("Added to playlist: " + DisplaySong(s, &Config.song_status_format));
|
||||
mSearcher->Go(wDown);
|
||||
}
|
||||
else if (current_screen == csLibrary)
|
||||
@@ -1833,7 +1833,7 @@ int main(int argc, char *argv[])
|
||||
if (s->GetDirectory() == EMPTY_TAG) // for streams
|
||||
continue;
|
||||
|
||||
string option = OmitBBCodes(DisplaySong(*s));
|
||||
string option = DisplaySong(*s);
|
||||
GetDirectory(s->GetDirectory());
|
||||
for (int i = 1; i <= mBrowser->Size(); i++)
|
||||
{
|
||||
@@ -2127,7 +2127,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
for (int i = (wCurrent == mBrowser ? search_engine_static_option : 1); i <= mCurrent->Size(); i++)
|
||||
{
|
||||
string name = mCurrent->GetOption(i);
|
||||
string name = OmitBBCodes(mCurrent->GetOption(i));
|
||||
transform(name.begin(), name.end(), name.begin(), tolower);
|
||||
if (name.find(findme) != string::npos && !mCurrent->IsStatic(i))
|
||||
{
|
||||
|
||||
@@ -312,7 +312,7 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da
|
||||
tracklength = " [" + ShowTime(elapsed) + "/" + s.GetLength() + "]";
|
||||
else
|
||||
tracklength = " [" + ShowTime(elapsed) + "]";
|
||||
ncmpcpp_string_t playing_song = TO_WSTRING(OmitBBCodes(DisplaySong(s, &Config.song_status_format)));
|
||||
ncmpcpp_string_t playing_song = TO_WSTRING(DisplaySong(s, &Config.song_status_format));
|
||||
|
||||
int max_length_without_scroll = wFooter->GetWidth()-player_state.length()-tracklength.length();
|
||||
|
||||
@@ -334,7 +334,7 @@ void NcmpcppStatusChanged(MPDConnection *Mpd, MPDStatusChanges changed, void *da
|
||||
playing_song_scroll_begin = 0;
|
||||
}
|
||||
else
|
||||
wFooter->WriteXY(player_state.length(), 1, OmitBBCodes(DisplaySong(s, &Config.song_status_format)), 1);
|
||||
wFooter->WriteXY(player_state.length(), 1, DisplaySong(s, &Config.song_status_format), 1);
|
||||
wFooter->Bold(1);
|
||||
|
||||
wFooter->WriteXY(wFooter->GetWidth()-tracklength.length(), 1, tracklength);
|
||||
|
||||
Reference in New Issue
Block a user