diff options
Diffstat (limited to 'src/playlist')
-rw-r--r-- | src/playlist/AsxPlaylistPlugin.cxx | 13 | ||||
-rw-r--r-- | src/playlist/CuePlaylistPlugin.cxx | 3 | ||||
-rw-r--r-- | src/playlist/DespotifyPlaylistPlugin.cxx | 8 | ||||
-rw-r--r-- | src/playlist/EmbeddedCuePlaylistPlugin.cxx | 3 | ||||
-rw-r--r-- | src/playlist/PlsPlaylistPlugin.cxx | 17 | ||||
-rw-r--r-- | src/playlist/RssPlaylistPlugin.cxx | 13 | ||||
-rw-r--r-- | src/playlist/SoundCloudPlaylistPlugin.cxx | 21 | ||||
-rw-r--r-- | src/playlist/XspfPlaylistPlugin.cxx | 13 |
8 files changed, 54 insertions, 37 deletions
diff --git a/src/playlist/AsxPlaylistPlugin.cxx b/src/playlist/AsxPlaylistPlugin.cxx index 19fa5a0fb..4dcbf56b9 100644 --- a/src/playlist/AsxPlaylistPlugin.cxx +++ b/src/playlist/AsxPlaylistPlugin.cxx @@ -25,14 +25,15 @@ #include "Song.hxx" #include "tag/Tag.hxx" #include "util/Error.hxx" +#include "util/Domain.hxx" +#include "Log.hxx" #include <glib.h> #include <assert.h> #include <string.h> -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "asx" +static constexpr Domain asx_domain("asx"); /** * This is the state object for the GLib XML parser. @@ -224,7 +225,7 @@ asx_open_stream(struct input_stream *is) if (nbytes == 0) { if (error2.IsDefined()) { g_markup_parse_context_free(context); - g_warning("%s", error2.GetMessage()); + LogError(error2); return NULL; } @@ -234,7 +235,8 @@ asx_open_stream(struct input_stream *is) success = g_markup_parse_context_parse(context, buffer, nbytes, &error); if (!success) { - g_warning("XML parser failed: %s", error->message); + FormatErrno(asx_domain, + "XML parser failed: %s", error->message); g_error_free(error); g_markup_parse_context_free(context); return NULL; @@ -243,7 +245,8 @@ asx_open_stream(struct input_stream *is) success = g_markup_parse_context_end_parse(context, &error); if (!success) { - g_warning("XML parser failed: %s", error->message); + FormatErrno(asx_domain, + "XML parser failed: %s", error->message); g_error_free(error); g_markup_parse_context_free(context); return NULL; diff --git a/src/playlist/CuePlaylistPlugin.cxx b/src/playlist/CuePlaylistPlugin.cxx index 0ec5c3068..5b0b6c6d2 100644 --- a/src/playlist/CuePlaylistPlugin.cxx +++ b/src/playlist/CuePlaylistPlugin.cxx @@ -29,9 +29,6 @@ #include <assert.h> #include <string.h> -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "cue" - class CuePlaylist final : public SongEnumerator { struct input_stream *is; TextInputStream tis; diff --git a/src/playlist/DespotifyPlaylistPlugin.cxx b/src/playlist/DespotifyPlaylistPlugin.cxx index b0394a5da..a1a865c08 100644 --- a/src/playlist/DespotifyPlaylistPlugin.cxx +++ b/src/playlist/DespotifyPlaylistPlugin.cxx @@ -24,13 +24,12 @@ #include "MemorySongEnumerator.hxx" #include "tag/Tag.hxx" #include "Song.hxx" +#include "Log.hxx" extern "C" { #include <despotify.h> } -#include <glib.h> - #include <string.h> #include <stdlib.h> @@ -48,7 +47,8 @@ add_song(std::forward_list<SongPointer> &songs, struct ds_track *track) if (despotify_track_to_uri(track, ds_uri) != ds_uri) { /* Should never really fail, but let's be sure */ - g_debug("Can't add track %s\n", track->title); + FormatDebug(despotify_domain, + "Can't add track %s", track->title); return; } @@ -99,7 +99,7 @@ despotify_playlist_open_uri(const char *url, ds_link *link = despotify_link_from_uri(url + strlen(despotify_playlist_plugin.schemes[0]) + 3); if (link == nullptr) { - g_debug("Can't find %s\n", url); + FormatDebug(despotify_domain, "Can't find %s\n", url); return nullptr; } diff --git a/src/playlist/EmbeddedCuePlaylistPlugin.cxx b/src/playlist/EmbeddedCuePlaylistPlugin.cxx index 6b497d50c..5fc1f28e0 100644 --- a/src/playlist/EmbeddedCuePlaylistPlugin.cxx +++ b/src/playlist/EmbeddedCuePlaylistPlugin.cxx @@ -39,9 +39,6 @@ #include <assert.h> #include <string.h> -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "cue" - class EmbeddedCuePlaylist final : public SongEnumerator { public: /** diff --git a/src/playlist/PlsPlaylistPlugin.cxx b/src/playlist/PlsPlaylistPlugin.cxx index 721f9adab..567add465 100644 --- a/src/playlist/PlsPlaylistPlugin.cxx +++ b/src/playlist/PlsPlaylistPlugin.cxx @@ -25,11 +25,15 @@ #include "Song.hxx" #include "tag/Tag.hxx" #include "util/Error.hxx" +#include "util/Domain.hxx" +#include "Log.hxx" #include <glib.h> #include <string> +static constexpr Domain pls_domain("pls"); + static void pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs) { @@ -40,7 +44,8 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs) int num_entries = g_key_file_get_integer(keyfile, "playlist", "NumberOfEntries", &error); if (error) { - g_debug("Invalid PLS file: '%s'", error->message); + FormatError(pls_domain, + "Invalid PLS file: '%s'", error->message); g_error_free(error); error = NULL; @@ -59,7 +64,8 @@ pls_parser(GKeyFile *keyfile, std::forward_list<SongPointer> &songs) value = g_key_file_get_string(keyfile, "playlist", key, &error); if(error) { - g_debug("Invalid PLS entry %s: '%s'",key, error->message); + FormatError(pls_domain, "Invalid PLS entry %s: '%s'", + key, error->message); g_error_free(error); g_free(key); return; @@ -118,7 +124,7 @@ pls_open_stream(struct input_stream *is) nbytes = is->LockRead(buffer, sizeof(buffer), error2); if (nbytes == 0) { if (error2.IsDefined()) { - g_warning("%s", error2.GetMessage()); + LogError(error2); return NULL; } @@ -130,7 +136,7 @@ pls_open_stream(struct input_stream *is) } while (kf_data.length() < 65536); if (kf_data.empty()) { - g_warning("KeyFile parser failed: No Data"); + LogWarning(pls_domain, "KeyFile parser failed: No Data"); return NULL; } @@ -140,7 +146,8 @@ pls_open_stream(struct input_stream *is) G_KEY_FILE_NONE, &error); if (!success) { - g_warning("KeyFile parser failed: %s", error->message); + FormatError(pls_domain, + "KeyFile parser failed: %s", error->message); g_error_free(error); g_key_file_free(keyfile); return NULL; diff --git a/src/playlist/RssPlaylistPlugin.cxx b/src/playlist/RssPlaylistPlugin.cxx index cd42606d6..c2becc15a 100644 --- a/src/playlist/RssPlaylistPlugin.cxx +++ b/src/playlist/RssPlaylistPlugin.cxx @@ -25,14 +25,15 @@ #include "Song.hxx" #include "tag/Tag.hxx" #include "util/Error.hxx" +#include "util/Domain.hxx" +#include "Log.hxx" #include <glib.h> #include <assert.h> #include <string.h> -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "rss" +static constexpr Domain rss_domain("rss"); /** * This is the state object for the GLib XML parser. @@ -221,7 +222,7 @@ rss_open_stream(struct input_stream *is) if (nbytes == 0) { if (error2.IsDefined()) { g_markup_parse_context_free(context); - g_warning("%s", error2.GetMessage()); + LogError(error2); return NULL; } @@ -231,7 +232,8 @@ rss_open_stream(struct input_stream *is) success = g_markup_parse_context_parse(context, buffer, nbytes, &error); if (!success) { - g_warning("XML parser failed: %s", error->message); + FormatError(rss_domain, + "XML parser failed: %s", error->message); g_error_free(error); g_markup_parse_context_free(context); return NULL; @@ -240,7 +242,8 @@ rss_open_stream(struct input_stream *is) success = g_markup_parse_context_end_parse(context, &error); if (!success) { - g_warning("XML parser failed: %s", error->message); + FormatError(rss_domain, + "XML parser failed: %s", error->message); g_error_free(error); g_markup_parse_context_free(context); return NULL; diff --git a/src/playlist/SoundCloudPlaylistPlugin.cxx b/src/playlist/SoundCloudPlaylistPlugin.cxx index e6dbf5cf9..99bef29e7 100644 --- a/src/playlist/SoundCloudPlaylistPlugin.cxx +++ b/src/playlist/SoundCloudPlaylistPlugin.cxx @@ -26,6 +26,8 @@ #include "Song.hxx" #include "tag/Tag.hxx" #include "util/Error.hxx" +#include "util/Domain.hxx" +#include "Log.hxx" #include <glib.h> #include <yajl/yajl_parse.h> @@ -36,13 +38,16 @@ static struct { char *apikey; } soundcloud_config; +static constexpr Domain soundcloud_domain("soundcloud"); + static bool soundcloud_init(const config_param ¶m) { soundcloud_config.apikey = param.DupBlockString("apikey"); if (soundcloud_config.apikey == NULL) { - g_debug("disabling the soundcloud playlist plugin " - "because API key is not set"); + LogDebug(soundcloud_domain, + "disabling the soundcloud playlist plugin " + "because API key is not set"); return false; } @@ -254,7 +259,7 @@ soundcloud_parse_json(const char *url, yajl_handle hand, error); if (input_stream == NULL) { if (error.IsDefined()) - g_warning("%s", error.GetMessage()); + LogError(error); return -1; } @@ -269,7 +274,7 @@ soundcloud_parse_json(const char *url, yajl_handle hand, input_stream->Read(buffer, sizeof(buffer), error); if (nbytes == 0) { if (error.IsDefined()) - g_warning("%s", error.GetMessage()); + LogError(error); if (input_stream->IsEOF()) { done = true; @@ -296,7 +301,7 @@ soundcloud_parse_json(const char *url, yajl_handle hand, ) { unsigned char *str = yajl_get_error(hand, 1, ubuffer, nbytes); - g_warning("%s", str); + LogError(soundcloud_domain, (const char *)str); yajl_free_error(hand, str); break; } @@ -341,7 +346,9 @@ soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond) rest = p; if (strcmp(scheme, "soundcloud") != 0) { - g_warning("incompatible scheme for soundcloud plugin: %s", scheme); + FormatWarning(soundcloud_domain, + "incompatible scheme for soundcloud plugin: %s", + scheme); g_free(s); return NULL; } @@ -361,7 +368,7 @@ soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond) g_free(s); if (u == NULL) { - g_warning("unknown soundcloud URI"); + LogWarning(soundcloud_domain, "unknown soundcloud URI"); return NULL; } diff --git a/src/playlist/XspfPlaylistPlugin.cxx b/src/playlist/XspfPlaylistPlugin.cxx index 797fd7f3a..9b55f1962 100644 --- a/src/playlist/XspfPlaylistPlugin.cxx +++ b/src/playlist/XspfPlaylistPlugin.cxx @@ -24,14 +24,15 @@ #include "InputStream.hxx" #include "tag/Tag.hxx" #include "util/Error.hxx" +#include "util/Domain.hxx" +#include "Log.hxx" #include <glib.h> #include <assert.h> #include <string.h> -#undef G_LOG_DOMAIN -#define G_LOG_DOMAIN "xspf" +static constexpr Domain xspf_domain("xspf"); /** * This is the state object for the GLib XML parser. @@ -240,7 +241,7 @@ xspf_open_stream(struct input_stream *is) if (nbytes == 0) { if (error2.IsDefined()) { g_markup_parse_context_free(context); - g_warning("%s", error2.GetMessage()); + LogError(error2); return NULL; } @@ -250,7 +251,8 @@ xspf_open_stream(struct input_stream *is) success = g_markup_parse_context_parse(context, buffer, nbytes, &error); if (!success) { - g_warning("XML parser failed: %s", error->message); + FormatError(xspf_domain, + "XML parser failed: %s", error->message); g_error_free(error); g_markup_parse_context_free(context); return NULL; @@ -259,7 +261,8 @@ xspf_open_stream(struct input_stream *is) success = g_markup_parse_context_end_parse(context, &error); if (!success) { - g_warning("XML parser failed: %s", error->message); + FormatError(xspf_domain, + "XML parser failed: %s", error->message); g_error_free(error); g_markup_parse_context_free(context); return NULL; |