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
084fd8df
Commit
084fd8df
authored
Oct 15, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist/soundcloud: use std::string
parent
328131b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
SoundCloudPlaylistPlugin.cxx
src/playlist/SoundCloudPlaylistPlugin.cxx
+14
-14
No files found.
src/playlist/SoundCloudPlaylistPlugin.cxx
View file @
084fd8df
...
...
@@ -32,10 +32,12 @@
#include <glib.h>
#include <yajl/yajl_parse.h>
#include <string>
#include <string.h>
static
struct
{
char
*
apikey
;
std
::
string
apikey
;
}
soundcloud_config
;
static
constexpr
Domain
soundcloud_domain
(
"soundcloud"
);
...
...
@@ -43,8 +45,8 @@ static constexpr Domain soundcloud_domain("soundcloud");
static
bool
soundcloud_init
(
const
config_param
&
param
)
{
soundcloud_config
.
apikey
=
param
.
DupBlockString
(
"apikey
"
);
if
(
soundcloud_config
.
apikey
==
NULL
)
{
soundcloud_config
.
apikey
=
param
.
GetBlockValue
(
"apikey"
,
"
"
);
if
(
soundcloud_config
.
apikey
.
empty
()
)
{
LogDebug
(
soundcloud_domain
,
"disabling the soundcloud playlist plugin "
"because API key is not set"
);
...
...
@@ -54,12 +56,6 @@ soundcloud_init(const config_param ¶m)
return
true
;
}
static
void
soundcloud_finish
(
void
)
{
g_free
(
soundcloud_config
.
apikey
);
}
/**
* Construct a full soundcloud resolver URL from the given fragment.
* @param uri uri of a soundcloud page (or just the path)
...
...
@@ -79,7 +75,8 @@ soundcloud_resolve(const char* uri) {
}
ru
=
g_strconcat
(
"http://api.soundcloud.com/resolve.json?url="
,
u
,
"&client_id="
,
soundcloud_config
.
apikey
,
NULL
);
u
,
"&client_id="
,
soundcloud_config
.
apikey
.
c_str
(),
nullptr
);
g_free
(
u
);
return
ru
;
...
...
@@ -212,7 +209,8 @@ static int handle_end_map(void *ctx)
Song
*
s
;
char
*
u
;
u
=
g_strconcat
(
data
->
stream_url
,
"?client_id="
,
soundcloud_config
.
apikey
,
NULL
);
u
=
g_strconcat
(
data
->
stream_url
,
"?client_id="
,
soundcloud_config
.
apikey
.
c_str
(),
nullptr
);
s
=
Song
::
NewRemote
(
u
);
g_free
(
u
);
...
...
@@ -356,10 +354,12 @@ soundcloud_open_uri(const char *uri, Mutex &mutex, Cond &cond)
char
*
u
=
NULL
;
if
(
strcmp
(
arg
,
"track"
)
==
0
)
{
u
=
g_strconcat
(
"http://api.soundcloud.com/tracks/"
,
rest
,
".json?client_id="
,
soundcloud_config
.
apikey
,
NULL
);
rest
,
".json?client_id="
,
soundcloud_config
.
apikey
.
c_str
(),
nullptr
);
}
else
if
(
strcmp
(
arg
,
"playlist"
)
==
0
)
{
u
=
g_strconcat
(
"http://api.soundcloud.com/playlists/"
,
rest
,
".json?client_id="
,
soundcloud_config
.
apikey
,
NULL
);
rest
,
".json?client_id="
,
soundcloud_config
.
apikey
.
c_str
(),
nullptr
);
}
else
if
(
strcmp
(
arg
,
"url"
)
==
0
)
{
/* Translate to soundcloud resolver call. libcurl will automatically
follow the redirect to the right resource. */
...
...
@@ -409,7 +409,7 @@ const struct playlist_plugin soundcloud_playlist_plugin = {
"soundcloud"
,
soundcloud_init
,
soundcloud_finish
,
nullptr
,
soundcloud_open_uri
,
nullptr
,
...
...
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