Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
45597cc5
Commit
45597cc5
authored
Jan 04, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ls: renamed functions, no CamelCase
parent
6a008b52
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
18 deletions
+29
-18
command.c
src/command.c
+4
-4
decoder_thread.c
src/decoder_thread.c
+2
-2
ls.c
src/ls.c
+7
-4
ls.h
src/ls.h
+13
-5
song.c
src/song.c
+2
-2
update.c
src/update.c
+1
-1
No files found.
src/command.c
View file @
45597cc5
...
...
@@ -285,7 +285,7 @@ handle_urlhandlers(struct client *client,
{
if
(
client_get_uid
(
client
)
>
0
)
client_puts
(
client
,
"handler: file://
\n
"
);
print
RemoteUrlHandler
s
(
client
);
print
_supported_uri_scheme
s
(
client
);
return
COMMAND_RETURN_OK
;
}
...
...
@@ -462,7 +462,7 @@ handle_add(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
}
if
(
uri_has_scheme
(
uri
))
{
if
(
!
isRemoteUrl
(
uri
))
{
if
(
!
uri_supported_scheme
(
uri
))
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"unsupported URI scheme"
);
return
COMMAND_RETURN_ERROR
;
...
...
@@ -497,7 +497,7 @@ handle_addid(struct client *client, int argc, char *argv[])
&
added_id
);
#endif
}
else
{
if
(
uri_has_scheme
(
uri
)
&&
!
isRemoteUrl
(
uri
))
{
if
(
uri_has_scheme
(
uri
)
&&
!
uri_supported_scheme
(
uri
))
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"unsupported URI scheme"
);
return
COMMAND_RETURN_ERROR
;
...
...
@@ -1258,7 +1258,7 @@ handle_playlistadd(struct client *client, G_GNUC_UNUSED int argc, char *argv[])
enum
playlist_result
result
;
if
(
uri_has_scheme
(
uri
))
{
if
(
!
isRemoteUrl
(
uri
))
{
if
(
!
uri_supported_scheme
(
uri
))
{
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"unsupported URI scheme"
);
return
COMMAND_RETURN_ERROR
;
...
...
src/decoder_thread.c
View file @
45597cc5
...
...
@@ -142,7 +142,7 @@ static void decoder_run_song(const struct song *song, const char *uri)
/* if that fails, try suffix matching the URL: */
if
(
plugin
==
NULL
)
{
const
char
*
s
=
getS
uffix
(
uri
);
const
char
*
s
=
uri_get_s
uffix
(
uri
);
next
=
0
;
while
((
plugin
=
decoder_plugin_from_suffix
(
s
,
next
++
)))
{
if
(
plugin
->
stream_decode
==
NULL
)
...
...
@@ -169,7 +169,7 @@ static void decoder_run_song(const struct song *song, const char *uri)
}
}
else
{
unsigned
int
next
=
0
;
const
char
*
s
=
getS
uffix
(
uri
);
const
char
*
s
=
uri_get_s
uffix
(
uri
);
while
((
plugin
=
decoder_plugin_from_suffix
(
s
,
next
++
)))
{
if
(
plugin
->
file_decode
!=
NULL
)
{
input_stream_close
(
&
input_stream
);
...
...
src/ls.c
View file @
45597cc5
...
...
@@ -20,6 +20,7 @@
#include "client.h"
#include "config.h"
#include <assert.h>
#include <string.h>
static
const
char
*
remoteUrlPrefixes
[]
=
{
...
...
@@ -29,7 +30,7 @@ static const char *remoteUrlPrefixes[] = {
NULL
};
void
print
RemoteUrlHandler
s
(
struct
client
*
client
)
void
print
_supported_uri_scheme
s
(
struct
client
*
client
)
{
const
char
**
prefixes
=
remoteUrlPrefixes
;
...
...
@@ -44,12 +45,14 @@ bool uri_has_scheme(const char *uri)
return
strstr
(
uri
,
"://"
)
!=
NULL
;
}
bool
isRemoteUrl
(
const
char
*
url
)
bool
uri_supported_scheme
(
const
char
*
uri
)
{
const
char
**
urlPrefixes
=
remoteUrlPrefixes
;
assert
(
uri_has_scheme
(
uri
));
while
(
*
urlPrefixes
)
{
if
(
g_str_has_prefix
(
ur
l
,
*
urlPrefixes
))
if
(
g_str_has_prefix
(
ur
i
,
*
urlPrefixes
))
return
true
;
urlPrefixes
++
;
}
...
...
@@ -58,7 +61,7 @@ bool isRemoteUrl(const char *url)
}
/* suffixes should be ascii only characters */
const
char
*
getS
uffix
(
const
char
*
utf8file
)
const
char
*
uri_get_s
uffix
(
const
char
*
utf8file
)
{
const
char
*
dot
=
strrchr
(
g_basename
(
utf8file
),
'.'
);
...
...
src/ls.h
View file @
45597cc5
...
...
@@ -21,19 +21,27 @@
#include <stdbool.h>
struct
stat
;
struct
client
;
const
char
*
getSuffix
(
const
char
*
utf8file
);
/**
* Checks whether the specified URI has a schema in the form
* "scheme://".
*/
bool
uri_has_scheme
(
const
char
*
uri
);
bool
isRemoteUrl
(
const
char
*
url
);
/**
* Checks whether the scheme of the specified URI is supported by MPD.
* It is not allowed to pass an URI without a scheme, check with
* uri_has_scheme() first.
*/
bool
uri_supported_scheme
(
const
char
*
url
);
/**
* Send a list of supported URI schemes to the client. This is the
* response to the "urlhandlers" command.
*/
void
print_supported_uri_schemes
(
struct
client
*
client
);
void
printRemoteUrlHandlers
(
struct
client
*
client
);
const
char
*
uri_get_suffix
(
const
char
*
utf8file
);
#endif
src/song.c
View file @
45597cc5
...
...
@@ -110,7 +110,7 @@ song_file_update(struct song *song)
/* check if there's a suffix and a plugin */
suffix
=
getS
uffix
(
song
->
url
);
suffix
=
uri_get_s
uffix
(
song
->
url
);
if
(
suffix
==
NULL
)
return
false
;
...
...
@@ -156,7 +156,7 @@ song_file_update_inarchive(struct song *song)
/* check if there's a suffix and a plugin */
suffix
=
getS
uffix
(
song
->
url
);
suffix
=
uri_get_s
uffix
(
song
->
url
);
if
(
suffix
==
NULL
)
return
false
;
...
...
src/update.c
View file @
45597cc5
...
...
@@ -346,7 +346,7 @@ static void
update_regular_file
(
struct
directory
*
directory
,
const
char
*
name
,
const
struct
stat
*
st
)
{
const
char
*
suffix
=
getS
uffix
(
name
);
const
char
*
suffix
=
uri_get_s
uffix
(
name
);
if
(
suffix
==
NULL
)
return
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment