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
f86f5ad2
Commit
f86f5ad2
authored
Jan 26, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/upnp: move generic code to lib/upnp/
parent
8b6b3ff2
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
118 additions
and
88 deletions
+118
-88
Makefile.am
Makefile.am
+13
-9
UpnpDatabasePlugin.cxx
src/db/plugins/UpnpDatabasePlugin.cxx
+5
-5
ContentDirectoryService.cxx
src/db/plugins/upnp/ContentDirectoryService.cxx
+4
-73
Directory.cxx
src/db/plugins/upnp/Directory.cxx
+1
-1
Action.hxx
src/lib/upnp/Action.hxx
+0
-0
ContentDirectoryService.cxx
src/lib/upnp/ContentDirectoryService.cxx
+93
-0
ContentDirectoryService.hxx
src/lib/upnp/ContentDirectoryService.hxx
+2
-0
Device.cxx
src/lib/upnp/Device.cxx
+0
-0
Device.hxx
src/lib/upnp/Device.hxx
+0
-0
Discovery.cxx
src/lib/upnp/Discovery.cxx
+0
-0
Discovery.hxx
src/lib/upnp/Discovery.hxx
+0
-0
Domain.cxx
src/lib/upnp/Domain.cxx
+0
-0
Domain.hxx
src/lib/upnp/Domain.hxx
+0
-0
Util.cxx
src/lib/upnp/Util.cxx
+0
-0
Util.hxx
src/lib/upnp/Util.hxx
+0
-0
WorkQueue.hxx
src/lib/upnp/WorkQueue.hxx
+0
-0
ixmlwrap.cxx
src/lib/upnp/ixmlwrap.cxx
+0
-0
ixmlwrap.hxx
src/lib/upnp/ixmlwrap.hxx
+0
-0
upnpplib.cxx
src/lib/upnp/upnpplib.cxx
+0
-0
upnpplib.hxx
src/lib/upnp/upnpplib.hxx
+0
-0
No files found.
Makefile.am
View file @
f86f5ad2
...
...
@@ -216,6 +216,17 @@ src_mpd_SOURCES = \
src/PlaylistFile.cxx src/PlaylistFile.hxx
\
src/Timer.cxx
UPNP_SOURCES
=
\
src/lib/upnp/Device.cxx src/lib/upnp/Device.hxx
\
src/lib/upnp/ContentDirectoryService.cxx src/lib/upnp/ContentDirectoryService.hxx
\
src/lib/upnp/Discovery.cxx src/lib/upnp/Discovery.hxx
\
src/lib/upnp/Domain.cxx src/lib/upnp/Domain.hxx
\
src/lib/upnp/ixmlwrap.cxx src/lib/upnp/ixmlwrap.hxx
\
src/lib/upnp/upnpplib.cxx src/lib/upnp/upnpplib.hxx
\
src/lib/upnp/Util.cxx src/lib/upnp/Util.hxx
\
src/lib/upnp/WorkQueue.hxx
\
src/lib/upnp/Action.hxx
#
# Windows resource file
#
...
...
@@ -444,18 +455,11 @@ DB_LIBS = \
if
HAVE_LIBUPNP
libdb_plugins_a_SOURCES
+=
\
$(UPNP_SOURCES)
\
src/db/plugins/UpnpDatabasePlugin.cxx src/db/plugins/UpnpDatabasePlugin.hxx
\
src/db/plugins/upnp/Tags.cxx src/db/plugins/upnp/Tags.hxx
\
src/db/plugins/upnp/ContentDirectoryService.cxx src/db/plugins/upnp/ContentDirectoryService.hxx
\
src/db/plugins/upnp/Device.cxx src/db/plugins/upnp/Device.hxx
\
src/db/plugins/upnp/ContentDirectoryService.cxx
\
src/db/plugins/upnp/Directory.cxx src/db/plugins/upnp/Directory.hxx
\
src/db/plugins/upnp/Discovery.cxx src/db/plugins/upnp/Discovery.hxx
\
src/db/plugins/upnp/Domain.cxx src/db/plugins/upnp/Domain.hxx
\
src/db/plugins/upnp/ixmlwrap.cxx src/db/plugins/upnp/ixmlwrap.hxx
\
src/db/plugins/upnp/upnpplib.cxx src/db/plugins/upnp/upnpplib.hxx
\
src/db/plugins/upnp/Util.cxx src/db/plugins/upnp/Util.hxx
\
src/db/plugins/upnp/Action.hxx
\
src/db/plugins/upnp/WorkQueue.hxx
\
src/db/plugins/upnp/Object.cxx src/db/plugins/upnp/Object.hxx
DB_LIBS
+=
\
$(EXPAT_LIBS)
\
...
...
src/db/plugins/UpnpDatabasePlugin.cxx
View file @
f86f5ad2
...
...
@@ -19,13 +19,13 @@
#include "config.h"
#include "UpnpDatabasePlugin.hxx"
#include "upnp/Domain.hxx"
#include "upnp/upnpplib.hxx"
#include "upnp/Discovery.hxx"
#include "upnp/ContentDirectoryService.hxx"
#include "lib/upnp/Domain.hxx"
#include "lib/upnp/upnpplib.hxx"
#include "lib/upnp/Discovery.hxx"
#include "lib/upnp/ContentDirectoryService.hxx"
#include "lib/upnp/Util.hxx"
#include "upnp/Directory.hxx"
#include "upnp/Tags.hxx"
#include "upnp/Util.hxx"
#include "db/DatabasePlugin.hxx"
#include "db/Selection.hxx"
#include "db/DatabaseError.hxx"
...
...
src/db/plugins/upnp/ContentDirectoryService.cxx
View file @
f86f5ad2
...
...
@@ -18,41 +18,16 @@
*/
#include "config.h"
#include "ContentDirectoryService.hxx"
#include "Domain.hxx"
#include "
Device
.hxx"
#include "
ixmlwrap
.hxx"
#include "
lib/upnp/
ContentDirectoryService.hxx"
#include "
lib/upnp/
Domain.hxx"
#include "
lib/upnp/ixmlwrap
.hxx"
#include "
lib/upnp/Action
.hxx"
#include "Directory.hxx"
#include "Util.hxx"
#include "Action.hxx"
#include "util/NumberParser.hxx"
#include "util/Error.hxx"
#include <string.h>
#include <stdio.h>
ContentDirectoryService
::
ContentDirectoryService
(
const
UPnPDevice
&
device
,
const
UPnPService
&
service
)
:
m_actionURL
(
caturl
(
device
.
URLBase
,
service
.
controlURL
)),
m_serviceType
(
service
.
serviceType
),
m_deviceId
(
device
.
UDN
),
m_friendlyName
(
device
.
friendlyName
),
m_manufacturer
(
device
.
manufacturer
),
m_modelName
(
device
.
modelName
),
m_rdreqcnt
(
200
)
{
if
(
!
m_modelName
.
compare
(
"MediaTomb"
))
{
// Readdir by 200 entries is good for most, but MediaTomb likes
// them really big. Actually 1000 is better but I don't dare
m_rdreqcnt
=
500
;
}
}
ContentDirectoryService
::~
ContentDirectoryService
()
{
/* this destructor exists here just so it won't get inlined */
}
static
bool
ReadResultTag
(
UPnPDirContent
&
dirbuf
,
IXML_Document
*
response
,
Error
&
error
)
{
...
...
@@ -192,50 +167,6 @@ ContentDirectoryService::search(UpnpClient_Handle hdl,
}
bool
ContentDirectoryService
::
getSearchCapabilities
(
UpnpClient_Handle
hdl
,
std
::
list
<
std
::
string
>
&
result
,
Error
&
error
)
const
{
assert
(
result
.
empty
());
IXML_Document
*
request
=
UpnpMakeAction
(
"GetSearchCapabilities"
,
m_serviceType
.
c_str
(),
0
,
nullptr
,
nullptr
);
if
(
request
==
0
)
{
error
.
Set
(
upnp_domain
,
"UpnpMakeAction() failed"
);
return
false
;
}
IXML_Document
*
response
;
auto
code
=
UpnpSendAction
(
hdl
,
m_actionURL
.
c_str
(),
m_serviceType
.
c_str
(),
0
/*devUDN*/
,
request
,
&
response
);
ixmlDocument_free
(
request
);
if
(
code
!=
UPNP_E_SUCCESS
)
{
error
.
Format
(
upnp_domain
,
code
,
"UpnpSendAction() failed: %s"
,
UpnpGetErrorMessage
(
code
));
return
false
;
}
const
char
*
s
=
ixmlwrap
::
getFirstElementValue
(
response
,
"SearchCaps"
);
if
(
s
==
nullptr
||
*
s
==
0
)
{
ixmlDocument_free
(
response
);
return
true
;
}
bool
success
=
true
;
if
(
!
csvToStrings
(
s
,
result
))
{
error
.
Set
(
upnp_domain
,
"Bad response"
);
success
=
false
;
}
ixmlDocument_free
(
response
);
return
success
;
}
bool
ContentDirectoryService
::
getMetadata
(
UpnpClient_Handle
hdl
,
const
char
*
objectId
,
UPnPDirContent
&
dirbuf
,
...
...
src/db/plugins/upnp/Directory.cxx
View file @
f86f5ad2
...
...
@@ -19,7 +19,7 @@
#include "config.h"
#include "Directory.hxx"
#include "Util.hxx"
#include "
lib/upnp/
Util.hxx"
#include "lib/expat/ExpatParser.hxx"
#include "Tags.hxx"
#include "tag/TagBuilder.hxx"
...
...
src/
db/plugins
/upnp/Action.hxx
→
src/
lib
/upnp/Action.hxx
View file @
f86f5ad2
File moved
src/lib/upnp/ContentDirectoryService.cxx
0 → 100644
View file @
f86f5ad2
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* 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.
*
* 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.
*/
#include "config.h"
#include "ContentDirectoryService.hxx"
#include "Domain.hxx"
#include "Device.hxx"
#include "ixmlwrap.hxx"
#include "Util.hxx"
#include "Action.hxx"
#include "util/Error.hxx"
ContentDirectoryService
::
ContentDirectoryService
(
const
UPnPDevice
&
device
,
const
UPnPService
&
service
)
:
m_actionURL
(
caturl
(
device
.
URLBase
,
service
.
controlURL
)),
m_serviceType
(
service
.
serviceType
),
m_deviceId
(
device
.
UDN
),
m_friendlyName
(
device
.
friendlyName
),
m_manufacturer
(
device
.
manufacturer
),
m_modelName
(
device
.
modelName
),
m_rdreqcnt
(
200
)
{
if
(
!
m_modelName
.
compare
(
"MediaTomb"
))
{
// Readdir by 200 entries is good for most, but MediaTomb likes
// them really big. Actually 1000 is better but I don't dare
m_rdreqcnt
=
500
;
}
}
ContentDirectoryService
::~
ContentDirectoryService
()
{
/* this destructor exists here just so it won't get inlined */
}
bool
ContentDirectoryService
::
getSearchCapabilities
(
UpnpClient_Handle
hdl
,
std
::
list
<
std
::
string
>
&
result
,
Error
&
error
)
const
{
assert
(
result
.
empty
());
IXML_Document
*
request
=
UpnpMakeAction
(
"GetSearchCapabilities"
,
m_serviceType
.
c_str
(),
0
,
nullptr
,
nullptr
);
if
(
request
==
0
)
{
error
.
Set
(
upnp_domain
,
"UpnpMakeAction() failed"
);
return
false
;
}
IXML_Document
*
response
;
auto
code
=
UpnpSendAction
(
hdl
,
m_actionURL
.
c_str
(),
m_serviceType
.
c_str
(),
0
/*devUDN*/
,
request
,
&
response
);
ixmlDocument_free
(
request
);
if
(
code
!=
UPNP_E_SUCCESS
)
{
error
.
Format
(
upnp_domain
,
code
,
"UpnpSendAction() failed: %s"
,
UpnpGetErrorMessage
(
code
));
return
false
;
}
const
char
*
s
=
ixmlwrap
::
getFirstElementValue
(
response
,
"SearchCaps"
);
if
(
s
==
nullptr
||
*
s
==
0
)
{
ixmlDocument_free
(
response
);
return
true
;
}
bool
success
=
true
;
if
(
!
csvToStrings
(
s
,
result
))
{
error
.
Set
(
upnp_domain
,
"Bad response"
);
success
=
false
;
}
ixmlDocument_free
(
response
);
return
success
;
}
src/
db/plugins
/upnp/ContentDirectoryService.hxx
→
src/
lib
/upnp/ContentDirectoryService.hxx
View file @
f86f5ad2
...
...
@@ -20,6 +20,8 @@
#ifndef _UPNPDIR_HXX_INCLUDED_
#define _UPNPDIR_HXX_INCLUDED_
#include "Compiler.h"
#include <upnp/upnp.h>
#include <string>
...
...
src/
db/plugins
/upnp/Device.cxx
→
src/
lib
/upnp/Device.cxx
View file @
f86f5ad2
File moved
src/
db/plugins
/upnp/Device.hxx
→
src/
lib
/upnp/Device.hxx
View file @
f86f5ad2
File moved
src/
db/plugins
/upnp/Discovery.cxx
→
src/
lib
/upnp/Discovery.cxx
View file @
f86f5ad2
File moved
src/
db/plugins
/upnp/Discovery.hxx
→
src/
lib
/upnp/Discovery.hxx
View file @
f86f5ad2
File moved
src/
db/plugins
/upnp/Domain.cxx
→
src/
lib
/upnp/Domain.cxx
View file @
f86f5ad2
File moved
src/
db/plugins
/upnp/Domain.hxx
→
src/
lib
/upnp/Domain.hxx
View file @
f86f5ad2
File moved
src/
db/plugins
/upnp/Util.cxx
→
src/
lib
/upnp/Util.cxx
View file @
f86f5ad2
File moved
src/
db/plugins
/upnp/Util.hxx
→
src/
lib
/upnp/Util.hxx
View file @
f86f5ad2
File moved
src/
db/plugins
/upnp/WorkQueue.hxx
→
src/
lib
/upnp/WorkQueue.hxx
View file @
f86f5ad2
File moved
src/
db/plugins
/upnp/ixmlwrap.cxx
→
src/
lib
/upnp/ixmlwrap.cxx
View file @
f86f5ad2
File moved
src/
db/plugins
/upnp/ixmlwrap.hxx
→
src/
lib
/upnp/ixmlwrap.hxx
View file @
f86f5ad2
File moved
src/
db/plugins
/upnp/upnpplib.cxx
→
src/
lib
/upnp/upnpplib.cxx
View file @
f86f5ad2
File moved
src/
db/plugins
/upnp/upnpplib.hxx
→
src/
lib
/upnp/upnpplib.hxx
View file @
f86f5ad2
File moved
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