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
0f99410b
Commit
0f99410b
authored
Jan 07, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist/soundcloud: parse URI without copying it
parent
442dadd6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
19 deletions
+11
-19
SoundCloudPlaylistPlugin.cxx
src/playlist/SoundCloudPlaylistPlugin.cxx
+11
-19
No files found.
src/playlist/SoundCloudPlaylistPlugin.cxx
View file @
0f99410b
...
...
@@ -323,43 +323,35 @@ static SongEnumerator *
soundcloud_open_uri
(
const
char
*
uri
,
Mutex
&
mutex
,
Cond
&
cond
)
{
assert
(
memcmp
(
uri
,
"soundcloud://"
,
13
)
==
0
);
char
*
const
s
=
g_strdup
(
uri
+
13
);
char
*
p
=
s
;
char
*
arg
=
p
;
for
(;
*
p
;
p
++
)
{
if
(
*
p
==
'/'
)
{
*
p
=
0
;
p
++
;
break
;
}
}
char
*
rest
=
p
;
uri
+=
13
;
char
*
u
=
nullptr
;
if
(
strcmp
(
arg
,
"track"
)
==
0
)
{
if
(
memcmp
(
uri
,
"track/"
,
6
)
==
0
)
{
const
char
*
rest
=
uri
+
6
;
u
=
g_strconcat
(
"https://api.soundcloud.com/tracks/"
,
rest
,
".json?client_id="
,
soundcloud_config
.
apikey
.
c_str
(),
nullptr
);
}
else
if
(
strcmp
(
arg
,
"playlist"
)
==
0
)
{
}
else
if
(
memcmp
(
uri
,
"playlist/"
,
9
)
==
0
)
{
const
char
*
rest
=
uri
+
9
;
u
=
g_strconcat
(
"https://api.soundcloud.com/playlists/"
,
rest
,
".json?client_id="
,
soundcloud_config
.
apikey
.
c_str
(),
nullptr
);
}
else
if
(
strcmp
(
arg
,
"user"
)
==
0
)
{
}
else
if
(
memcmp
(
uri
,
"user/"
,
5
)
==
0
)
{
const
char
*
rest
=
uri
+
5
;
u
=
g_strconcat
(
"https://api.soundcloud.com/users/"
,
rest
,
"/tracks.json?client_id="
,
soundcloud_config
.
apikey
.
c_str
(),
nullptr
);
}
else
if
(
strcmp
(
arg
,
"search"
)
==
0
)
{
}
else
if
(
memcmp
(
uri
,
"search/"
,
7
)
==
0
)
{
const
char
*
rest
=
uri
+
7
;
u
=
g_strconcat
(
"https://api.soundcloud.com/tracks.json?q="
,
rest
,
"&client_id="
,
soundcloud_config
.
apikey
.
c_str
(),
nullptr
);
}
else
if
(
strcmp
(
arg
,
"url"
)
==
0
)
{
}
else
if
(
memcmp
(
uri
,
"url/"
,
4
)
==
0
)
{
const
char
*
rest
=
uri
+
4
;
/* Translate to soundcloud resolver call. libcurl will automatically
follow the redirect to the right resource. */
u
=
soundcloud_resolve
(
rest
);
}
g_free
(
s
);
if
(
u
==
nullptr
)
{
LogWarning
(
soundcloud_domain
,
"unknown soundcloud URI"
);
...
...
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