From 5625874ccf11a306a81dae1f6d1ba88527fbe4c9 Mon Sep 17 00:00:00 2001 From: Night Gryphon Date: Tue, 19 May 2020 01:42:10 +0300 Subject: [PATCH 1/3] update playlist module for modern python releases --- src/playlist/pm_python.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/playlist/pm_python.c b/src/playlist/pm_python.c index 7c2c89a..930e8a4 100644 --- a/src/playlist/pm_python.c +++ b/src/playlist/pm_python.c @@ -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 @@ -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"); @@ -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"); From bb0fd13fdd3d7bedc7de800552b1577a2af0f939 Mon Sep 17 00:00:00 2001 From: Night Gryphon Date: Tue, 19 May 2020 01:48:31 +0300 Subject: [PATCH 2/3] fix song name update on shoutcast server fix shoutcast metadata update with libshout-2.4.1 caused by ssl/tls autodetection --- src/setup.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/setup.c b/src/setup.c index 0fe512c..9efad3e 100644 --- a/src/setup.c +++ b/src/setup.c @@ -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); From 1aa8aa0d809cdef863528b2c1b142c5c0e2fd9a3 Mon Sep 17 00:00:00 2001 From: Night Gryphon Date: Tue, 19 May 2020 01:52:50 +0300 Subject: [PATCH 3/3] Add timestamps to log --- src/log.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/log.c b/src/log.c index c59c184..3f078fd 100755 --- a/src/log.c +++ b/src/log.c @@ -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 @@ -20,6 +20,7 @@ */ #include "definitions.h" +#include extern ices_config_t ices_config; @@ -140,7 +141,12 @@ 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)); + if (ices_config.logfile) { + fprintf (ices_config.logfile, "%s: ", tstr); fprintf(ices_config.logfile, format, string); #ifndef HAVE_SETLINEBUF fflush(ices_config.logfile); @@ -148,8 +154,10 @@ static void ices_log_string(char *format, char *string) { } /* 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 */