2009-03-13 18:43:16 +01:00
|
|
|
/*
|
2011-01-29 10:13:54 +01:00
|
|
|
* Copyright (C) 2003-2011 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"
|
2004-02-24 00:41:20 +01:00
|
|
|
#include "ls.h"
|
2009-02-25 16:44:06 +01:00
|
|
|
#include "uri.h"
|
2008-09-07 14:02:40 +02:00
|
|
|
#include "client.h"
|
2008-12-29 17:28:32 +01:00
|
|
|
|
2012-08-02 18:15:49 +02:00
|
|
|
#include <glib.h>
|
|
|
|
|
2009-01-04 17:46:42 +01:00
|
|
|
#include <assert.h>
|
2008-12-29 17:28:32 +01:00
|
|
|
#include <string.h>
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2009-03-03 17:01:42 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* file:// is not included in remoteUrlPrefixes, the connection method
|
|
|
|
* is detected at runtime and displayed as a urlhandler if the client is
|
|
|
|
* connected by IPC socket.
|
|
|
|
*/
|
2008-02-05 11:17:33 +01:00
|
|
|
static const char *remoteUrlPrefixes[] = {
|
2011-08-24 03:23:12 +02:00
|
|
|
#if defined(ENABLE_CURL) || defined(ENABLE_SOUP)
|
2006-07-20 18:02:40 +02:00
|
|
|
"http://",
|
2009-01-29 21:42:10 +01:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_MMS
|
|
|
|
"mms://",
|
|
|
|
"mmsh://",
|
|
|
|
"mmst://",
|
|
|
|
"mmsu://",
|
2010-05-18 20:48:52 +02:00
|
|
|
#endif
|
|
|
|
#ifdef HAVE_FFMPEG
|
|
|
|
"gopher://",
|
|
|
|
"rtp://",
|
|
|
|
"rtsp://",
|
|
|
|
"rtmp://",
|
|
|
|
"rtmpt://",
|
|
|
|
"rtmps://",
|
2010-12-21 22:23:01 +01:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_CDIO_PARANOIA
|
|
|
|
"cdda://",
|
2011-03-27 08:41:05 +02:00
|
|
|
#endif
|
|
|
|
#ifdef ENABLE_DESPOTIFY
|
|
|
|
"spt://",
|
2008-10-26 19:32:43 +01:00
|
|
|
#endif
|
2004-06-02 03:26:15 +02:00
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
2009-03-03 17:01:42 +01:00
|
|
|
void print_supported_uri_schemes_to_fp(FILE *fp)
|
|
|
|
{
|
|
|
|
const char **prefixes = remoteUrlPrefixes;
|
|
|
|
|
|
|
|
#ifdef HAVE_UN
|
2012-06-12 22:29:04 +02:00
|
|
|
fprintf(fp, " file://");
|
2009-03-03 17:01:42 +01:00
|
|
|
#endif
|
|
|
|
while (*prefixes) {
|
2012-06-12 22:29:04 +02:00
|
|
|
fprintf(fp, " %s", *prefixes);
|
2009-03-03 17:01:42 +01:00
|
|
|
prefixes++;
|
|
|
|
}
|
2009-03-03 22:07:34 +01:00
|
|
|
fprintf(fp,"\n");
|
2009-03-03 17:01:42 +01:00
|
|
|
}
|
|
|
|
|
2009-01-04 17:46:42 +01:00
|
|
|
void print_supported_uri_schemes(struct client *client)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2008-02-05 11:17:33 +01:00
|
|
|
const char **prefixes = remoteUrlPrefixes;
|
2004-06-03 01:22:37 +02:00
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
while (*prefixes) {
|
2008-09-07 14:02:40 +02:00
|
|
|
client_printf(client, "handler: %s\n", *prefixes);
|
2006-07-20 18:02:40 +02:00
|
|
|
prefixes++;
|
|
|
|
}
|
2004-06-03 01:22:37 +02:00
|
|
|
}
|
|
|
|
|
2009-01-04 17:46:42 +01:00
|
|
|
bool uri_supported_scheme(const char *uri)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2008-02-05 11:17:33 +01:00
|
|
|
const char **urlPrefixes = remoteUrlPrefixes;
|
2004-05-14 23:35:20 +02:00
|
|
|
|
2009-01-04 17:46:42 +01:00
|
|
|
assert(uri_has_scheme(uri));
|
|
|
|
|
2006-07-20 18:02:40 +02:00
|
|
|
while (*urlPrefixes) {
|
2009-01-04 17:46:42 +01:00
|
|
|
if (g_str_has_prefix(uri, *urlPrefixes))
|
2008-12-16 21:18:33 +01:00
|
|
|
return true;
|
2004-05-14 23:35:20 +02:00
|
|
|
urlPrefixes++;
|
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
|
|
|
}
|