mirror of
https://github.com/SuperBFG7/ympd
synced 2024-11-05 22:36:16 +00:00
Fix: code cleanups
This commit is contained in:
parent
2ebb523ada
commit
7db9e2f9cd
@ -805,7 +805,7 @@ void callback_mympd(struct mg_connection *nc, const struct mg_str msg) {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
clock_gettime(CLOCK_MONOTONIC_RAW, &end);
|
clock_gettime(CLOCK_MONOTONIC_RAW, &end);
|
||||||
uint64_t delta_us = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_nsec - start.tv_nsec) / 1000;
|
uint64_t delta_us = (end.tv_sec - start.tv_sec) * 1000000 + (end.tv_nsec - start.tv_nsec) / 1000;
|
||||||
fprintf(stderr, "DEBUG: Time used: %llu\n", delta_us);
|
fprintf(stderr, "DEBUG: Time used: %lu\n", delta_us);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
@ -2309,7 +2309,7 @@ int mympd_search(char *buffer, char *searchstr, char *filter, char *plist, unsig
|
|||||||
if (mpd_send_command(mpd.conn, "searchaddpl", plist, filter, searchstr, NULL) == false)
|
if (mpd_send_command(mpd.conn, "searchaddpl", plist, filter, searchstr, NULL) == false)
|
||||||
RETURN_ERROR_AND_RECOVER("mpd_searchaddpl");
|
RETURN_ERROR_AND_RECOVER("mpd_searchaddpl");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(plist, "") == 0) {
|
if (strcmp(plist, "") == 0) {
|
||||||
while ((song = mpd_recv_song(mpd.conn)) != NULL) {
|
while ((song = mpd_recv_song(mpd.conn)) != NULL) {
|
||||||
entity_count++;
|
entity_count++;
|
||||||
@ -2417,7 +2417,7 @@ int mympd_search_adv(char *buffer, char *expression, char *sort, bool sortdesc,
|
|||||||
else
|
else
|
||||||
len = json_printf(&out, "{type: result, data: ok}");
|
len = json_printf(&out, "{type: result, data: ok}");
|
||||||
#else
|
#else
|
||||||
len = json_printf(&out, "{type: error, data: %s}", "Advanced search is disabled.");
|
len = json_printf(&out, "{type: error, data: %Q}", "Advanced search is disabled.");
|
||||||
#endif
|
#endif
|
||||||
CHECK_RETURN_LEN();
|
CHECK_RETURN_LEN();
|
||||||
return len;
|
return len;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
#define RETURN_ERROR_AND_RECOVER(X) do { \
|
#define RETURN_ERROR_AND_RECOVER(X) do { \
|
||||||
printf("MPD %s: %s\n", X, mpd_connection_get_error_message(mpd.conn)); \
|
printf("MPD %s: %s\n", X, mpd_connection_get_error_message(mpd.conn)); \
|
||||||
len = json_printf(&out, "{ type:error, data : %Q }", mpd_connection_get_error_message(mpd.conn)); \
|
len = json_printf(&out, "{type: error, data: %Q}", mpd_connection_get_error_message(mpd.conn)); \
|
||||||
if (!mpd_connection_clear_error(mpd.conn)) \
|
if (!mpd_connection_clear_error(mpd.conn)) \
|
||||||
mpd.conn_state = MPD_FAILURE; \
|
mpd.conn_state = MPD_FAILURE; \
|
||||||
return len; \
|
return len; \
|
||||||
|
@ -500,8 +500,8 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
snprintf(testdirname, 400, "%s/library", SRC_PATH);
|
snprintf(testdirname, 400, "%s/library", SRC_PATH);
|
||||||
if (testdir("Link to mpd music_directory", testdirname)) {
|
if (testdir("Link to mpd music_directory", testdirname)) {
|
||||||
|
LOG_INFO() printf("Enabling featLibrary support\n");
|
||||||
mpd.feat_library = true;
|
mpd.feat_library = true;
|
||||||
LOG_INFO() printf("Enabling coverimage support\n");
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
LOG_INFO() printf("Disabling coverimage support\n");
|
LOG_INFO() printf("Disabling coverimage support\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user