diff --git a/src/mpdclient.c b/src/mpdclient.c
index c15c34d6dce5924cf0029716eefff654ecb7fbdd..df636a566caea042d455aa648d673d8293c24c6c 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
#include "mpdclient.h"
#include "screen_utils.h"
#include "config.h"
-#include "ncmpc.h"
-#include "support.h"
+#include "charset.h"
#include "options.h"
#include "strfsong.h"
if (e1 && e2 &&
e1->type == MPD_INFO_ENTITY_TYPE_SONG &&
e2->type == MPD_INFO_ENTITY_TYPE_SONG) {
- strfsong(key1, BUFSIZE, LIST_FORMAT, e1->info.song);
- strfsong(key2, BUFSIZE, LIST_FORMAT, e2->info.song);
+ strfsong(key1, BUFSIZE, options.list_format, e1->info.song);
+ strfsong(key2, BUFSIZE, options.list_format, e2->info.song);
n = strcmp(key1,key2);
}
mpd_finishCommand(c->connection);
if (c->connection->error) {
- gchar *msg = locale_to_utf8(c->connection->errorStr);
gint error = c->connection->error;
+ gchar *msg;
- if (error == MPD_ERROR_ACK)
- error = error | (c->connection->errorCode << 8);
-
- if (c->connection->errorCode == MPD_ACK_ERROR_PERMISSION &&
+ if (error == MPD_ERROR_ACK &&
+ c->connection->errorCode == MPD_ACK_ERROR_PERMISSION &&
screen_auth(c) == 0)
return 0;
+ if (error == MPD_ERROR_ACK)
+ error = error | (c->connection->errorCode << 8);
+
+ msg = locale_to_utf8(c->connection->errorStr);
error_cb(c, error, msg);
g_free(msg);
return error;
c->status = mpd_getStatus(c->connection);
if ((retval=mpdclient_finish_command(c)))
return retval;
-#ifndef NDEBUG
- if (c->status->error)
- D("status> %s\n", c->status->error);
-#endif
/* check if the playlist needs an update */
if (c->playlist.id != c->status->playlist) {
#ifdef ENABLE_SONG_ID
struct mpd_song *song = playlist_get_song(c, idx);
- D("Play id:%d\n", song ? song->id : -1);
if (song)
mpd_sendPlayIdCommand(c->connection, song->id);
else
gint
mpdclient_cmd_seek(mpdclient_t *c, gint id, gint pos)
{
- D("Seek id:%d\n", id);
mpd_sendSeekIdCommand(c->connection, id, pos);
return mpdclient_finish_command(c);
}
/* send the delete command to mpd */
#ifdef ENABLE_SONG_ID
- D("Delete id:%d\n", song->id);
mpd_sendDeleteIdCommand(c->connection, song->id);
#else
mpd_sendDeleteCommand(c->connection, idx);
/* send the move command to mpd */
#ifdef ENABLE_SONG_ID
- D("Swapping id:%d with id:%d\n", song1->id, song2->id);
mpd_sendSwapIdCommand(c->connection, song1->id, song2->id);
#else
- D("Moving index %d to id:%d\n", old_index, new_index);
mpd_sendMoveCommand(c->connection, old_index, new_index);
#endif
if( (n=mpdclient_finish_command(c)) )
#endif
/* call playlist updated callback */
- D("move> new_index=%d, old_index=%d\n", new_index, old_index);
mpdclient_playlist_callback(c, PLAYLIST_EVENT_MOVE, (gpointer) &new_index);
return 0;
{
mpd_InfoEntity *entity;
- D("mpdclient_playlist_update() [%lld]\n", c->status->playlist);
-
if (MPD_ERROR(c))
return -1;
{
mpd_InfoEntity *entity;
- D("mpdclient_playlist_update_changes() [%lld -> %lld]\n",
- c->status->playlist, c->playlist.id);
-
if (MPD_ERROR(c))
return -1;
if (song->pos >= 0 && (guint)song->pos < c->playlist.list->len) {
/* update song */
- D("updating pos:%d, id=%d - %s\n",
- song->pos, song->id, song->file);
playlist_replace(&c->playlist, song->pos, song);
} else {
/* add a new song */
- D("adding song at pos %d\n", song->pos);
playlist_append(&c->playlist, song);
}
guint pos = c->playlist.list->len - 1;
/* Remove the last playlist entry */
- D("removing song at pos %d\n", pos);
playlist_remove(&c->playlist, pos);
}
gchar *path_utf8 = locale_to_utf8(path);
gboolean has_dirs_only = TRUE;
- D("mpdclient_filelist_get(%s)\n", path);
mpd_sendLsInfoCommand(c->connection, path_utf8);
filelist = filelist_new(path);
if (path && path[0] && strcmp(path, "/"))
mpdclient_finish_command(c);
g_free(path_utf8);
- filelist->updated = TRUE;
// If there are only directory entities in the filelist, we sort it
- if (has_dirs_only) {
- D("mpdclient_filelist_get: only dirs; sorting!\n");
+ if (has_dirs_only)
filelist_sort(filelist, compare_filelistentry_dir);
- }
return filelist;
}
mpdclient_filelist_t *filelist;
mpd_InfoEntity *entity;
- D("mpdclient_filelist_search(%s)\n", filter_utf8);
if (exact_match)
mpd_sendFindCommand(c->connection, table, filter_utf8);
else
return NULL;
}
- filelist->updated = TRUE;
return filelist;
}
mpdclient_filelist_t *filelist;
gchar *filter_utf8 = locale_to_utf8(_filter);
- D("mpdclient_filelist_search(%s)\n", _filter);
filelist = mpdclient_filelist_search_utf8(c, exact_match, table,
filter_utf8);
g_free(filter_utf8);
gchar *str = NULL;
GList *list = NULL;
- D("mpdclient_get_artists()\n");
mpd_sendListCommand(c->connection, MPD_TABLE_ARTIST, NULL);
while ((str = mpd_getNextArtist(c->connection)))
list = g_list_append(list, (gpointer) str);
gchar *str = NULL;
GList *list = NULL;
- D("mpdclient_get_albums(%s)\n", artist_utf8);
mpd_sendListCommand(c->connection, MPD_TABLE_ALBUM, artist_utf8);
while ((str = mpd_getNextAlbum(c->connection)))
list = g_list_append(list, (gpointer) str);