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
dc5ef9ad
Commit
dc5ef9ad
authored
Jan 21, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/upnp: simplify GetSong()
parent
7471f65d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
20 deletions
+18
-20
UpnpDatabasePlugin.cxx
src/db/UpnpDatabasePlugin.cxx
+18
-20
No files found.
src/db/UpnpDatabasePlugin.cxx
View file @
dc5ef9ad
...
...
@@ -219,31 +219,29 @@ UpnpDatabase::ReturnSong(const LightSong *_song) const
const
LightSong
*
UpnpDatabase
::
GetSong
(
const
char
*
uri
,
Error
&
error
)
const
{
UpnpSong
*
song
=
nullptr
;
auto
vpath
=
stringToTokens
(
uri
,
"/"
,
true
);
if
(
vpath
.
size
()
>=
2
)
{
ContentDirectoryService
server
;
if
(
!
m_superdir
->
getServer
(
vpath
[
0
].
c_str
(),
server
,
error
))
return
nullptr
;
if
(
vpath
.
size
()
<
2
)
{
error
.
Format
(
db_domain
,
DB_NOT_FOUND
,
"No such song: %s"
,
uri
)
;
return
nullptr
;
}
vpath
.
erase
(
vpath
.
begin
());
UPnPDirObject
dirent
;
if
(
vpath
[
0
].
compare
(
rootid
))
{
std
::
string
objid
;
if
(
!
Namei
(
server
,
vpath
,
objid
,
dirent
,
error
))
return
nullptr
;
}
else
{
if
(
!
ReadNode
(
server
,
vpath
.
back
().
c_str
(),
dirent
,
error
))
return
nullptr
;
}
ContentDirectoryService
server
;
if
(
!
m_superdir
->
getServer
(
vpath
[
0
].
c_str
(),
server
,
error
))
return
nullptr
;
song
=
new
UpnpSong
(
std
::
move
(
dirent
),
uri
);
vpath
.
erase
(
vpath
.
begin
());
UPnPDirObject
dirent
;
if
(
vpath
[
0
].
compare
(
rootid
))
{
std
::
string
objid
;
if
(
!
Namei
(
server
,
vpath
,
objid
,
dirent
,
error
))
return
nullptr
;
}
else
{
if
(
!
ReadNode
(
server
,
vpath
.
back
().
c_str
(),
dirent
,
error
))
return
nullptr
;
}
if
(
song
==
nullptr
)
error
.
Format
(
db_domain
,
DB_NOT_FOUND
,
"No such song: %s"
,
uri
);
return
song
;
return
new
UpnpSong
(
std
::
move
(
dirent
),
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