convert filenames to current locale if needed / some implementation improvements

This commit is contained in:
Andrzej Rybczak
2009-01-15 20:34:35 +01:00
parent 8226b9b4a2
commit 24c308dac8
9 changed files with 66 additions and 79 deletions

View File

@@ -18,6 +18,7 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include "charset.h"
#include "mpdpp.h"
using namespace MPD;
@@ -482,7 +483,7 @@ int Connection::AddSong(const string &path)
int Connection::AddSong(const Song &s)
{
return !s.Empty() ? (s.IsFromDB() ? AddSong(s.GetFile()) : AddSong("file://" + string(s.GetFile()))) : -1;
return !s.Empty() ? (s.IsFromDB() ? (AddSong(s.Localized() ? locale_to_utf_cpy(s.GetFile()) : s.GetFile())) : AddSong("file://" + (s.Localized() ? locale_to_utf_cpy(s.GetFile()) : s.GetFile()))) : -1;
}
void Connection::QueueAddSong(const string &path)
@@ -499,7 +500,7 @@ void Connection::QueueAddSong(const string &path)
void Connection::QueueAddSong(const Song &s)
{
if (!s.Empty())
QueueAddSong(s.GetFile());
QueueAddSong(s.Localized() ? locale_to_utf_cpy(s.GetFile()) : s.GetFile());
}
void Connection::QueueAddToPlaylist(const string &playlist, const string &path)