-
- mpd_Status *status;
- mpd_InfoEntity *entity;
- mpd_sendCommandListOkBegin(current_info->conn);
- mpd_sendStatusCommand(current_info->conn);
- mpd_sendCurrentSongCommand(current_info->conn);
- mpd_sendCommandListEnd(current_info->conn);
- if ((status = mpd_getStatus(current_info->conn)) == NULL) {
- //ERR("MPD error: %s\n", current_info->conn->errorStr);
- mpd_closeConnection(current_info->conn);
- current_info->conn = 0;
- if (current_info->mpd.artist == NULL)
- current_info->mpd.artist =
- malloc(TEXT_BUFFER_SIZE);
- if (current_info->mpd.album == NULL)
- current_info->mpd.album = malloc(TEXT_BUFFER_SIZE);
- if (current_info->mpd.title == NULL)
- current_info->mpd.title = malloc(TEXT_BUFFER_SIZE);
- if (current_info->mpd.random == NULL)
- current_info->mpd.random =
- malloc(TEXT_BUFFER_SIZE);
- if (current_info->mpd.repeat == NULL)
- current_info->mpd.repeat =
- malloc(TEXT_BUFFER_SIZE);
- if (current_info->mpd.track == NULL)
- current_info->mpd.track = malloc(TEXT_BUFFER_SIZE);
- if (current_info->mpd.status == NULL)
- current_info->mpd.status = malloc(TEXT_BUFFER_SIZE);
- if (current_info->mpd.name == NULL)
- current_info->mpd.name = malloc(TEXT_BUFFER_SIZE);
- if (current_info->mpd.file == NULL)
- current_info->mpd.file = malloc(TEXT_BUFFER_SIZE);
- strncpy(current_info->mpd.name, "Unknown",
- TEXT_BUFFER_SIZE - 1);
- strncpy(current_info->mpd.file, "Unknown",
- TEXT_BUFFER_SIZE - 1);
- strncpy(current_info->mpd.artist, "Unknown",
- TEXT_BUFFER_SIZE - 1);
- strncpy(current_info->mpd.album, "Unknown",
- TEXT_BUFFER_SIZE - 1);
- strncpy(current_info->mpd.title, "Unknown",
- TEXT_BUFFER_SIZE - 1);
- strncpy(current_info->mpd.random, "Unknown",
- TEXT_BUFFER_SIZE - 1);
- strncpy(current_info->mpd.repeat, "Unknown",
- TEXT_BUFFER_SIZE - 1);
- strncpy(current_info->mpd.track, "Unknown",
- TEXT_BUFFER_SIZE - 1);
- strncpy(current_info->mpd.status, "MPD not responding", TEXT_BUFFER_SIZE - 1);
- current_info->mpd.bitrate = 0;
- current_info->mpd.progress = 0;
- current_info->mpd.elapsed = 0;
- current_info->mpd.length = 0;
- return;
+ if (mpd->random == NULL) {
+ mpd->random = malloc(text_buffer_size);
+ }
+ if (mpd->repeat == NULL) {
+ mpd->repeat = malloc(text_buffer_size);
+ }
+ if (mpd->track == NULL) {
+ mpd->track = malloc(text_buffer_size);
+ }
+ if (mpd->status == NULL) {
+ mpd->status = malloc(text_buffer_size);
+ }
+ if (mpd->name == NULL) {
+ mpd->name = malloc(text_buffer_size);