|
|
|
|
@ -953,16 +953,18 @@ void Add::run() |
|
|
|
|
Mpd.AddToPlaylist(myPlaylistEditor->Playlists.current()->value().path(), path); |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
const char lastfm_url[] = "lastfm://"; |
|
|
|
|
if (path.compare(0, const_strlen(lastfm_url), lastfm_url) == 0 |
|
|
|
|
|| path.find(".asx", path.length()-4) != std::string::npos |
|
|
|
|
|| path.find(".cue", path.length()-4) != std::string::npos |
|
|
|
|
|| path.find(".m3u", path.length()-4) != std::string::npos |
|
|
|
|
|| path.find(".pls", path.length()-4) != std::string::npos |
|
|
|
|
|| path.find(".xspf", path.length()-5) != std::string::npos) |
|
|
|
|
Mpd.LoadPlaylist(path); |
|
|
|
|
else |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
Mpd.Add(path); |
|
|
|
|
} |
|
|
|
|
catch (MPD::ServerError &err) |
|
|
|
|
{ |
|
|
|
|
// If a path is not a file or directory, assume it is a playlist.
|
|
|
|
|
if (err.code() == MPD_SERVER_ERROR_NO_EXIST) |
|
|
|
|
Mpd.LoadPlaylist(path); |
|
|
|
|
else |
|
|
|
|
throw; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|