Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/log.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* log.c
* - Functions for logging in ices
* Copyright (c) 2000 Alexander Hav�ng
* Copyright (c) 2000 Alexander Haväng
* Copyright (c) 2001 Brendan Cully
*
* This program is free software; you can redistribute it and/or
Expand All @@ -20,6 +20,7 @@
*/

#include "definitions.h"
#include <time.h>

extern ices_config_t ices_config;

Expand Down Expand Up @@ -140,16 +141,23 @@ char *ices_log_get_error(void) {

/* Function to log string to both console and file */
static void ices_log_string(char *format, char *string) {
time_t t = time(NULL);
char tstr[48];
strftime(tstr, sizeof(tstr), "%Y.%m.%d %H:%M:%S", localtime(&t));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use hyphens in timestamps and use a different timestamp separator (no 4th colon)? The final result could be like this:

2020-09-07 20:21:22 - Playing /path/to/track1
2020-09-07 20:23:22 - Playing /path/to/track2

At the moment it's more like this:

2020.09.07 20:21:22: Playing /path/to/track1
2020.09.07 20:23:22: Playing /path/to/track2


if (ices_config.logfile) {
fprintf (ices_config.logfile, "%s: ", tstr);
fprintf(ices_config.logfile, format, string);
#ifndef HAVE_SETLINEBUF
fflush(ices_config.logfile);
#endif
}

/* Don't log to console when daemonized */
if (!ices_config.daemon)
if (!ices_config.daemon) {
fprintf (stdout, "%s: ", tstr);
fprintf(stdout, format, string);
}
}

/* Open the ices logfile, create it if needed */
Expand Down
6 changes: 3 additions & 3 deletions src/playlist/pm_python.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* playlist_python.c
* - Interpreter functions for python
* Copyright (c) 2000 Alexander Hav�ng
* Copyright (c) 2000 Alexander Haväng
* Copyright (c) 2001-3 Brendan Cully
*
* This program is free software; you can redistribute it and/or
Expand Down Expand Up @@ -97,7 +97,7 @@ static char *playlist_python_get_next(void) {
PyObject* res;
char* rc = NULL;

if ((res = python_eval(pl_get_next_hook)) && PyString_Check(res))
if ((res = python_eval(pl_get_next_hook)) && PyObject_TypeCheck(res, &PyBaseString_Type))
rc = ices_util_strdup(PyString_AsString(res));
else
ices_log_error("ices_get_next failed");
Expand All @@ -112,7 +112,7 @@ static char*playlist_python_get_metadata(void) {
char* rc = NULL;

if (pl_get_metadata_hook) {
if ((res = python_eval(pl_get_metadata_hook)) && PyString_Check(res))
if ((res = python_eval(pl_get_metadata_hook)) && PyObject_TypeCheck(res, &PyBaseString_Type))
rc = ices_util_strdup(PyString_AsString(res));
else
ices_log_error("ices_get_metadata failed");
Expand Down
5 changes: 3 additions & 2 deletions src/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,9 +490,10 @@ static void ices_setup_activate_libshout_changes(const ices_config_t *ices_confi
shout_set_user(conn, stream->user);
shout_set_password(conn, stream->password);
shout_set_format(conn, SHOUT_FORMAT_MP3);
if (stream->protocol == icy_protocol_e)
if (stream->protocol == icy_protocol_e) {
shout_set_protocol(conn, SHOUT_PROTOCOL_ICY);
else if (stream->protocol == http_protocol_e)
shout_set_tls(conn, SHOUT_TLS_DISABLED);
} else if (stream->protocol == http_protocol_e)
shout_set_protocol(conn, SHOUT_PROTOCOL_HTTP);
else
shout_set_protocol(conn, SHOUT_PROTOCOL_XAUDIOCAST);
Expand Down