2009-03-13 18:43:16 +01:00
|
|
|
/*
|
2018-10-24 20:25:32 +02:00
|
|
|
* Copyright 2003-2018 The Music Player Daemon Project
|
2009-03-13 18:43:16 +01:00
|
|
|
* http://www.musicpd.org
|
2004-02-24 00:41:20 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2009-03-13 18:43:16 +01:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2004-02-24 00:41:20 +01:00
|
|
|
*/
|
|
|
|
|
2009-11-12 09:12:38 +01:00
|
|
|
#include "config.h"
|
2013-01-03 17:34:51 +01:00
|
|
|
#include "ls.hxx"
|
2018-10-24 20:25:32 +02:00
|
|
|
#include "input/Registry.hxx"
|
|
|
|
#include "input/InputPlugin.hxx"
|
2015-08-06 22:10:25 +02:00
|
|
|
#include "client/Response.hxx"
|
2018-08-02 10:38:20 +02:00
|
|
|
#include "util/ASCII.hxx"
|
2013-04-08 23:30:21 +02:00
|
|
|
#include "util/UriUtil.hxx"
|
2013-01-03 10:33:04 +01:00
|
|
|
|
2009-01-04 17:46:42 +01:00
|
|
|
#include <assert.h>
|
2009-03-03 17:01:42 +01:00
|
|
|
|
|
|
|
void print_supported_uri_schemes_to_fp(FILE *fp)
|
|
|
|
{
|
|
|
|
#ifdef HAVE_UN
|
2012-06-12 22:29:04 +02:00
|
|
|
fprintf(fp, " file://");
|
2009-03-03 17:01:42 +01:00
|
|
|
#endif
|
2018-10-24 20:25:32 +02:00
|
|
|
input_plugins_for_each(plugin)
|
|
|
|
for (auto i = plugin->prefixes; *i != nullptr; ++i)
|
|
|
|
fprintf(fp, " %s", *i);
|
2009-03-03 22:07:34 +01:00
|
|
|
fprintf(fp,"\n");
|
2009-03-03 17:01:42 +01:00
|
|
|
}
|
|
|
|
|
2015-08-06 22:10:25 +02:00
|
|
|
void
|
|
|
|
print_supported_uri_schemes(Response &r)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2018-10-24 20:25:32 +02:00
|
|
|
input_plugins_for_each_enabled(plugin)
|
|
|
|
for (auto i = plugin->prefixes; *i != nullptr; ++i)
|
|
|
|
r.Format("handler: %s\n", *i);
|
2004-06-03 01:22:37 +02:00
|
|
|
}
|
|
|
|
|
2017-05-08 14:44:49 +02:00
|
|
|
bool
|
|
|
|
uri_supported_scheme(const char *uri) noexcept
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2009-01-04 17:46:42 +01:00
|
|
|
assert(uri_has_scheme(uri));
|
|
|
|
|
2018-10-24 20:25:32 +02:00
|
|
|
input_plugins_for_each_enabled(plugin)
|
|
|
|
for (auto i = plugin->prefixes; *i != nullptr; ++i)
|
|
|
|
if (StringStartsWithCaseASCII(uri, *i))
|
|
|
|
return true;
|
2004-05-13 20:46:38 +02:00
|
|
|
|
2008-12-16 21:18:33 +01:00
|
|
|
return false;
|
2004-05-13 20:46:38 +02:00
|
|
|
}
|