From 4d604a7540ae43ff01346f388ef3dede95ac856f Mon Sep 17 00:00:00 2001 From: Viliam Mateicka Date: Tue, 16 Dec 2008 21:42:42 +0100 Subject: ls: adding get_archive_by_suffix() function --- src/ls.c | 15 +++++++++++++++ src/ls.h | 4 ++++ 2 files changed, 19 insertions(+) diff --git a/src/ls.c b/src/ls.c index 7a2eb11f7..b5cb5cfeb 100644 --- a/src/ls.c +++ b/src/ls.c @@ -128,3 +128,18 @@ hasMusicSuffix(const char *utf8file, unsigned int next) return ret; } + +const struct archive_plugin * +get_archive_by_suffix(const char *utf8file) +{ + const struct archive_plugin *ret = NULL; + + const char *s = getSuffix(utf8file); + if (s) { + ret = archive_plugin_from_suffix(s); + } else { + g_debug("get_archive_by_suffix: The file: %s has no valid suffix\n", + utf8file); + } + return ret; +} diff --git a/src/ls.h b/src/ls.h index ed0f0677f..92839e018 100644 --- a/src/ls.h +++ b/src/ls.h @@ -20,6 +20,7 @@ #define MPD_LS_H #include "decoder_list.h" +#include "archive_list.h" #include @@ -35,6 +36,9 @@ int isRemoteUrl(const char *url); const struct decoder_plugin * hasMusicSuffix(const char *utf8file, unsigned int next); +const struct archive_plugin * +get_archive_by_suffix(const char *utf8file); + int printRemoteUrlHandlers(struct client *client); #endif -- cgit v1.2.3